libpqxx  3.1.1
tablestream.hxx
1 /*-------------------------------------------------------------------------
2  *
3  * FILE
4  * pqxx/tablestream.hxx
5  *
6  * DESCRIPTION
7  * definition of the pqxx::tablestream class.
8  * pqxx::tablestream provides optimized batch access to a database table
9  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablestream instead.
10  *
11  * Copyright (c) 2001-2008, Jeroen T. Vermeulen <jtv@xs4all.nl>
12  *
13  * See COPYING for copyright license. If you did not receive a file called
14  * COPYING with this source code, please notify the distributor of this mistake,
15  * or contact the author.
16  *
17  *-------------------------------------------------------------------------
18  */
19 #ifndef PQXX_H_TABLESTREAM
20 #define PQXX_H_TABLESTREAM
21 
22 #include "pqxx/compiler-public.hxx"
23 #include "pqxx/compiler-internal-pre.hxx"
24 
25 #include "pqxx/transaction_base"
26 
27 /* Methods tested in eg. self-test program test001 are marked with "//[t1]"
28  */
29 
30 
31 namespace pqxx
32 {
33 class transaction_base;
34 
35 
37 
46 class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
48 {
49 public:
50  explicit tablestream(transaction_base &Trans,
51  const PGSTD::string &Null=PGSTD::string()); //[t6]
52 
53  virtual ~tablestream() throw () =0; //[t6]
54 
56 
63  virtual void complete() =0;
64 
65 protected:
66  const PGSTD::string &NullStr() const { return m_Null; }
67  bool is_finished() const throw () { return m_Finished; }
68  void base_close();
69 
71  template<typename ITER>
72  static PGSTD::string columnlist(ITER colbegin, ITER colend);
73 
74 private:
75  PGSTD::string m_Null;
76  bool m_Finished;
77 
78  // Not allowed:
79  tablestream();
80  tablestream(const tablestream &);
81  tablestream &operator=(const tablestream &);
82 };
83 
84 
85 template<typename ITER> inline
86 PGSTD::string tablestream::columnlist(ITER colbegin, ITER colend)
87 {
88  return separated_list(",", colbegin, colend);
89 }
90 } // namespace pqxx
91 
92 #include "pqxx/compiler-internal-post.hxx"
93 
94 #endif
95