Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

connection.hxx

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------- 00002 * 00003 * FILE 00004 * pqxx/connection.hxx 00005 * 00006 * DESCRIPTION 00007 * definition of the pqxx::connection and pqxx::lazyconnection classes. 00008 * Different ways of setting up a backend connection. 00009 * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead. 00010 * 00011 * Copyright (c) 2001-2004, 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/connection_base" 00020 00021 00022 /* Methods tested in eg. self-test program test001 are marked with "//[t1]" 00023 */ 00024 00025 namespace pqxx 00026 { 00027 00029 00045 class PQXX_LIBEXPORT connection : public connection_base 00046 { 00047 public: 00049 00053 connection(); //[t1] 00054 00056 00066 explicit connection(const PGSTD::string &ConnInfo); //[t2] 00067 00069 00077 explicit connection(const char ConnInfo[]); //[t3] 00078 00079 virtual ~connection() throw (); 00080 00081 private: 00082 virtual void startconnect() { do_startconnect(); } 00083 virtual void completeconnect() {} 00084 00085 void do_startconnect() { if (!get_conn()) set_conn(PQconnectdb(options())); } 00086 }; 00087 00088 00090 00098 class PQXX_LIBEXPORT lazyconnection : public connection_base 00099 { 00100 public: 00102 lazyconnection() : connection_base(0) {} //[t23] 00103 00105 00113 explicit lazyconnection(const PGSTD::string &ConnInfo) : //[t21] 00114 connection_base(ConnInfo) {} 00115 00117 00126 explicit lazyconnection(const char ConnInfo[]) : //[t22] 00127 connection_base(ConnInfo) {} 00128 00129 virtual ~lazyconnection() throw (); 00130 00131 private: 00132 virtual void startconnect() {} 00133 virtual void completeconnect() 00134 { if (!get_conn()) set_conn(PQconnectdb(options())); } 00135 }; 00136 00137 00139 class PQXX_LIBEXPORT asyncconnection : public connection_base 00140 { 00141 public: 00143 asyncconnection(); //[t63] 00144 00146 00154 explicit asyncconnection(const PGSTD::string &ConnInfo); //[t65] 00155 00157 00166 explicit asyncconnection(const char ConnInfo[]); //[t64] 00167 00168 virtual ~asyncconnection() throw (); 00169 00170 private: 00171 virtual void startconnect() { do_startconnect(); } 00172 virtual void completeconnect(); 00173 virtual void dropconnect() throw () { do_dropconnect(); } 00174 00175 void do_startconnect(); 00176 void do_dropconnect() throw () { m_connecting = false; } 00177 00179 bool m_connecting; 00180 }; 00181 00182 00184 00189 class PQXX_LIBEXPORT nullconnection : public connection_base 00190 { 00191 public: 00193 nullconnection() : connection_base("") {} //[t0] 00195 explicit nullconnection(const PGSTD::string &c) : //[t0] 00196 connection_base(c) {} 00198 explicit nullconnection(const char c[]) : //[t0] 00199 connection_base(c) {} 00200 00201 virtual ~nullconnection() throw (); 00202 00203 private: 00204 virtual void startconnect() {} 00205 virtual void completeconnect() {} 00206 }; 00207 00208 } 00209 00210

Generated on Sat Aug 21 03:39:32 2004 for libpqxx by doxygen 1.3.8