tablestream.hxx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /** Definition of the pqxx::tablestream class.
  2. *
  3. * pqxx::tablestream provides optimized batch access to a database table.
  4. *
  5. * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablestream instead.
  6. *
  7. * Copyright (c) 2000-2019, Jeroen T. Vermeulen.
  8. *
  9. * See COPYING for copyright license. If you did not receive a file called
  10. * COPYING with this source code, please notify the distributor of this mistake,
  11. * or contact the author.
  12. */
  13. #ifndef PQXX_H_TABLESTREAM
  14. #define PQXX_H_TABLESTREAM
  15. #include "pqxx/compiler-public.hxx"
  16. #include "pqxx/compiler-internal-pre.hxx"
  17. #include "pqxx/transaction_base.hxx"
  18. namespace pqxx
  19. {
  20. /// Base class for obsolete tablereader/tablewriter classes.
  21. /** @deprecated Use stream_from and stream_to instead.
  22. */
  23. class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
  24. public internal::transactionfocus
  25. {
  26. public:
  27. explicit tablestream(
  28. transaction_base &Trans,
  29. const std::string &Null=std::string{});
  30. virtual ~tablestream() noexcept =0;
  31. virtual void complete() =0;
  32. protected:
  33. const std::string &NullStr() const { return m_null; }
  34. bool is_finished() const noexcept { return m_finished; }
  35. void base_close();
  36. template<typename ITER>
  37. static std::string columnlist(ITER colbegin, ITER colend);
  38. private:
  39. std::string m_null;
  40. bool m_finished = false;
  41. tablestream() =delete;
  42. tablestream(const tablestream &) =delete;
  43. tablestream &operator=(const tablestream &) =delete;
  44. };
  45. template<typename ITER> inline
  46. std::string tablestream::columnlist(ITER colbegin, ITER colend)
  47. {
  48. return separated_list(",", colbegin, colend);
  49. }
  50. } // namespace pqxx
  51. #include "pqxx/compiler-internal-post.hxx"
  52. #endif