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-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 "pqxx/connectionpolicy" 00023 #include "pqxx/basic_connection" 00024 00025 namespace pqxx 00026 { 00027 00070 00071 00081 class PQXX_LIBEXPORT connect_direct : public connectionpolicy 00082 { 00083 public: 00084 explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {} 00085 virtual handle do_startconnect(handle); 00086 }; 00087 00089 typedef basic_connection<connect_direct> connection; 00090 00091 00093 00097 class PQXX_LIBEXPORT connect_lazy : public connectionpolicy 00098 { 00099 public: 00100 explicit connect_lazy(const PGSTD::string &opts) : connectionpolicy(opts) {} 00101 virtual handle do_completeconnect(handle); 00102 }; 00103 00104 00106 typedef basic_connection<connect_lazy> lazyconnection; 00107 00108 00110 00116 class PQXX_LIBEXPORT connect_async : public connectionpolicy 00117 { 00118 public: 00119 explicit connect_async(const PGSTD::string &opts); 00120 virtual handle do_startconnect(handle); 00121 virtual handle do_completeconnect(handle); 00122 virtual handle do_dropconnect(handle) throw (); 00123 virtual bool is_ready(handle) const throw (); 00124 00125 private: 00127 bool m_connecting; 00128 }; 00129 00130 00132 typedef basic_connection<connect_async> asyncconnection; 00133 00134 00136 00141 class PQXX_LIBEXPORT connect_null : public connectionpolicy 00142 { 00143 public: 00144 explicit connect_null(const PGSTD::string &opts) : connectionpolicy(opts) {} 00145 }; 00146 00147 00149 typedef basic_connection<connect_null> nullconnection; 00150 00155 } 00156 00157 #include "pqxx/compiler-internal-post.hxx"