00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include "pqxx/libcompiler.h"
00020 
00021 #include "pqxx/connection_base"
00022 
00023 
00024 
00025 
00026 
00027 namespace pqxx
00028 {
00029 
00031 
00047 class PQXX_LIBEXPORT connection : public connection_base
00048 {
00049 public:
00051 
00055   connection();                                                         
00056 
00058 
00068   explicit connection(const PGSTD::string &ConnInfo);                   
00069 
00071 
00079   explicit connection(const char ConnInfo[]);                           
00080 
00081   virtual ~connection() throw ();
00082 
00083 private:
00084   virtual void PQXX_PRIVATE startconnect() { do_startconnect(); }
00085   virtual void PQXX_PRIVATE completeconnect() {}
00086 
00087   void PQXX_PRIVATE do_startconnect();
00088 };
00089 
00090 
00092 
00100 class PQXX_LIBEXPORT lazyconnection : public connection_base
00101 {
00102 public:
00104   lazyconnection() : connection_base(0) {}                              
00105 
00107 
00115   explicit lazyconnection(const PGSTD::string &ConnInfo) :              
00116         connection_base(ConnInfo) {}
00117 
00119 
00128   explicit lazyconnection(const char ConnInfo[]) :                      
00129         connection_base(ConnInfo) {}
00130 
00131   virtual ~lazyconnection() throw ();
00132 
00133 private:
00134   virtual void PQXX_PRIVATE startconnect() {}
00135   virtual void PQXX_PRIVATE completeconnect();
00136 };
00137 
00138 
00140 
00146 class PQXX_LIBEXPORT asyncconnection : public connection_base
00147 {
00148 public:
00150   asyncconnection();                                                    
00151 
00153 
00161   explicit asyncconnection(const PGSTD::string &ConnInfo);              
00162 
00164 
00173   explicit asyncconnection(const char ConnInfo[]);                      
00174 
00175   virtual ~asyncconnection() throw ();
00176 
00177 private:
00178   virtual void PQXX_PRIVATE startconnect() { do_startconnect(); }
00179   virtual void PQXX_PRIVATE completeconnect();
00180   virtual void PQXX_PRIVATE dropconnect() throw () { do_dropconnect(); }
00181 
00182   void PQXX_PRIVATE do_startconnect();
00183   void PQXX_PRIVATE do_dropconnect() throw () { m_connecting = false; }
00184 
00186   bool m_connecting;
00187 };
00188 
00189 
00191 
00196 class PQXX_LIBEXPORT nullconnection : public connection_base
00197 {
00198 public:
00200   nullconnection() : connection_base("") {}                             
00202   explicit nullconnection(const PGSTD::string &c) :                     
00203         connection_base(c) {}
00205   explicit nullconnection(const char c[]) :                             
00206         connection_base(c) {}
00207 
00208   virtual ~nullconnection() throw ();
00209 
00210 private:
00211   virtual void PQXX_PRIVATE startconnect() {}
00212   virtual void PQXX_PRIVATE completeconnect() {}
00213 };
00214 
00215 }
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 #ifdef _WIN32
00225 inline pqxx::connection::~connection() throw () { close(); }
00226 inline pqxx::lazyconnection::~lazyconnection() throw () { close(); }
00227 inline pqxx::asyncconnection::~asyncconnection() throw () {do_dropconnect();close();}
00228 #endif
00229