# connection.hxx

    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-2008, 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 #ifndef PQXX_H_CONNECTION
    00020 #define PQXX_H_CONNECTION
    00021
    00022 #include "pqxx/compiler-public.hxx"
    00023 #include "pqxx/compiler-internal-pre.hxx"
    00024
    00025 #include "pqxx/connectionpolicy"
    00026 #include "pqxx/basic_connection"
    00027
    00028 namespace pqxx
    00029 {
    00030
    00073
    00074
    00084 class PQXX_LIBEXPORT connect_direct : public connectionpolicy
    00085 {
    00086 public:
    00087   explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {}
    00088   virtual handle do_startconnect(handle);
    00089 };
    00090
    00092 typedef basic_connection<connect_direct> connection;
    00093
    00094
    00096
    00100 class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
    00101 {
    00102 public:
    00103   explicit connect_lazy(const PGSTD::string &opts) : connectionpolicy(opts) {}
    00104   virtual handle do_completeconnect(handle);
    00105 };
    00106
    00107
    00109 typedef basic_connection<connect_lazy> lazyconnection;
    00110
    00111
    00113
    00119 class PQXX_LIBEXPORT connect_async : public connectionpolicy
    00120 {
    00121 public:
    00122   explicit connect_async(const PGSTD::string &opts);
    00123   virtual handle do_startconnect(handle);
    00124   virtual handle do_completeconnect(handle);
    00125   virtual handle do_dropconnect(handle) throw ();
    00126   virtual bool is_ready(handle) const throw ();
    00127
    00128 private:
    00130   bool m_connecting;
    00131 };
    00132
    00133
    00135 typedef basic_connection<connect_async> asyncconnection;
    00136
    00137
    00139
    00143 class PQXX_LIBEXPORT connect_null  : public connectionpolicy
    00144 {
    00145 public:
    00146   explicit connect_null(const PGSTD::string &opts) : connectionpolicy(opts) {}
    00147 };
    00148
    00149
    00151 typedef basic_connection<connect_null> nullconnection;
    00152
    00157 }
    00158
    00159 #include "pqxx/compiler-internal-post.hxx"
    00160
    00161 #endif
    00162