basic_connection.hxx

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  *   FILE
00004  *      pqxx/basic_connection.hxx
00005  *
00006  *   DESCRIPTION
00007  *      definition of the pqxx::basic_connection class template
00008  *   Instantiations of basic_connection bring connections and policies together
00009  *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection_base instead.
00010  *
00011  * Copyright (c) 2006, 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 #include "pqxx/compiler-public.hxx"
00020 #include "pqxx/compiler-internal-pre.hxx"
00021 
00022 #include <string>
00023 
00024 #include "pqxx/connection_base"
00025 
00026 namespace pqxx
00027 {
00028 
00029 // TODO: Also mix in thread synchronization policy here!
00031 
00045 template<typename CONNECTPOLICY> class basic_connection :
00046   public connection_base
00047 {
00048 public:
00049   basic_connection() :
00050     connection_base(m_policy),
00051     m_options(PGSTD::string()),
00052     m_policy(m_options)
00053         { init(); }
00054 
00055   explicit basic_connection(const PGSTD::string &opt) :
00056     connection_base(m_policy), m_options(opt), m_policy(m_options) {init();}
00057 
00058   explicit basic_connection(const char opt[]) :
00059     connection_base(m_policy),
00060     m_options(opt?opt:PGSTD::string()),
00061     m_policy(m_options)
00062         { init(); }
00063 
00064   ~basic_connection() throw ()
00065   {
00066 #ifdef PQXX_QUIET_DESTRUCTORS
00067     PGSTD::auto_ptr<noticer> n(new nonnoticer);
00068     set_noticer(n);
00069 #endif
00070     close();
00071   }
00072 
00073   const PGSTD::string &options() const throw ()                         //[t1]
00074         {return m_policy.options();}
00075 
00076 private:
00078   PGSTD::string m_options;
00080   CONNECTPOLICY m_policy;
00081 };
00082 
00083 } // namespace
00084 
00085 #include "pqxx/compiler-internal-post.hxx"
00086 

Generated on Thu Feb 1 17:12:08 2007 for libpqxx by  doxygen 1.5.1