libpqxx 4.0
tablestream.hxx
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/tablestream.hxx
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::tablestream class.
00008  *   pqxx::tablestream provides optimized batch access to a database table
00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablestream instead.
00010  *
00011  * Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
00012  *
00013  * See COPYING for copyright license.  If you did not receive a file called
00014  * COPYING with this source code, please notify the distributor of this mistake,
00015  * or contact the author.
00016  *
00017  *-------------------------------------------------------------------------
00018  */
00019 #ifndef PQXX_H_TABLESTREAM
00020 #define PQXX_H_TABLESTREAM
00021 #include "pqxx/compiler-public.hxx"
00022 #include "pqxx/compiler-internal-pre.hxx"
00023 #include "pqxx/transaction_base"
00024 namespace pqxx
00025 {
00026 class transaction_base;
00028 class PQXX_LIBEXPORT PQXX_NOVTABLE tablestream :
00029   public internal::transactionfocus
00030 {
00031 public:
00032   explicit tablestream(transaction_base &Trans,
00033               const PGSTD::string &Null=PGSTD::string());
00034   virtual ~tablestream() throw () =0;
00035   virtual void complete() =0;
00036 protected:
00037   const PGSTD::string &NullStr() const { return m_Null; }
00038   bool is_finished() const throw () { return m_Finished; }
00039   void base_close();
00040   template<typename ITER>
00041   static PGSTD::string columnlist(ITER colbegin, ITER colend);
00042 private:
00043   PGSTD::string m_Null;
00044   bool m_Finished;
00045   tablestream();
00046   tablestream(const tablestream &);
00047   tablestream &operator=(const tablestream &);
00048 };
00049 template<typename ITER> inline
00050 PGSTD::string tablestream::columnlist(ITER colbegin, ITER colend)
00051 {
00052   return separated_list(",", colbegin, colend);
00053 }
00054 } // namespace pqxx
00055 #include "pqxx/compiler-internal-post.hxx"
00056 #endif