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 00038 00039 00041 00051 class PQXX_LIBEXPORT connect_direct : public connectionpolicy 00052 { 00053 public: 00054 explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {} 00055 virtual handle do_startconnect(handle); 00056 }; 00057 00059 typedef basic_connection<connect_direct> connection; 00060 00061 00063 00067 class PQXX_LIBEXPORT connect_lazy : public connectionpolicy 00068 { 00069 public: 00070 explicit connect_lazy(const PGSTD::string &opts) : connectionpolicy(opts) {} 00071 virtual handle do_completeconnect(handle); 00072 }; 00073 00074 00076 typedef basic_connection<connect_lazy> lazyconnection; 00077 00078 00080 00086 class PQXX_LIBEXPORT connect_async : public connectionpolicy 00087 { 00088 public: 00089 explicit connect_async(const PGSTD::string &opts); 00090 virtual handle do_startconnect(handle); 00091 virtual handle do_completeconnect(handle); 00092 virtual handle do_dropconnect(handle) throw (); 00093 virtual bool is_ready(handle) const throw (); 00094 00095 private: 00097 bool m_connecting; 00098 }; 00099 00100 00102 typedef basic_connection<connect_async> asyncconnection; 00103 00104 00106 00111 class PQXX_LIBEXPORT connect_null : public connectionpolicy 00112 { 00113 public: 00114 explicit connect_null(const PGSTD::string &opts) : connectionpolicy(opts) {} 00115 }; 00116 00117 00119 typedef basic_connection<connect_null> nullconnection; 00120 00121 00123 00124 } 00125 00126 #include "pqxx/compiler-internal-post.hxx"