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
00034
00036
00052 class PQXX_LIBEXPORT connection : public connection_base
00053 {
00054 public:
00056
00060 connection();
00061
00063
00073 explicit connection(const PGSTD::string &ConnInfo);
00074
00076
00084 explicit connection(const char ConnInfo[]);
00085
00086 virtual ~connection() throw ();
00087
00088 private:
00089 virtual void PQXX_PRIVATE startconnect() { do_startconnect(); }
00090 virtual void PQXX_PRIVATE completeconnect() {}
00091
00092 void PQXX_PRIVATE do_startconnect();
00093 };
00094
00095
00097
00105 class PQXX_LIBEXPORT lazyconnection : public connection_base
00106 {
00107 public:
00109 lazyconnection() : connection_base(0) {}
00110
00112
00120 explicit lazyconnection(const PGSTD::string &ConnInfo) :
00121 connection_base(ConnInfo) {}
00122
00124
00133 explicit lazyconnection(const char ConnInfo[]) :
00134 connection_base(ConnInfo) {}
00135
00136 virtual ~lazyconnection() throw ();
00137
00138 private:
00139 virtual void PQXX_PRIVATE startconnect() {}
00140 virtual void PQXX_PRIVATE completeconnect();
00141 };
00142
00143
00145
00151 class PQXX_LIBEXPORT asyncconnection : public connection_base
00152 {
00153 public:
00155 asyncconnection();
00156
00158
00166 explicit asyncconnection(const PGSTD::string &ConnInfo);
00167
00169
00178 explicit asyncconnection(const char ConnInfo[]);
00179
00180 virtual ~asyncconnection() throw ();
00181
00182 private:
00183 virtual void PQXX_PRIVATE startconnect() { do_startconnect(); }
00184 virtual void PQXX_PRIVATE completeconnect();
00185 virtual void PQXX_PRIVATE dropconnect() throw () { do_dropconnect(); }
00186
00187 void PQXX_PRIVATE do_startconnect();
00188 void PQXX_PRIVATE do_dropconnect() throw () { m_connecting = false; }
00189
00191 bool m_connecting;
00192 };
00193
00194
00196
00201 class PQXX_LIBEXPORT nullconnection : public connection_base
00202 {
00203 public:
00205 nullconnection() : connection_base("") {}
00207 explicit nullconnection(const PGSTD::string &c) :
00208 connection_base(c) {}
00210 explicit nullconnection(const char c[]) :
00211 connection_base(c) {}
00212
00213 virtual ~nullconnection() throw ();
00214
00215 private:
00216 virtual void PQXX_PRIVATE startconnect() {}
00217 virtual void PQXX_PRIVATE completeconnect() {}
00218 };
00219
00221
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231 #ifdef _WIN32
00232 inline pqxx::connection::~connection() throw () { close(); }
00233 inline pqxx::lazyconnection::~lazyconnection() throw () { close(); }
00234 inline pqxx::asyncconnection::~asyncconnection() throw () {do_dropconnect();close();}
00235 #endif
00236