connection.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/connection.hxx
*
* DESCRIPTION
* definition of the pqxx::connection and pqxx::lazyconnection classes.
* Different ways of setting up a backend connection.
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/connection instead.
*
* Copyright (c) 2001-2011, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_H_CONNECTION
#define PQXX_H_CONNECTION
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include "pqxx/connectionpolicy"
#include "pqxx/basic_connection"
namespace pqxx
{
class PQXX_LIBEXPORT connect_direct : public connectionpolicy
{
public:
explicit connect_direct(const PGSTD::string &opts) : connectionpolicy(opts) {}
virtual handle do_startconnect(handle);
};
typedef basic_connection<connect_direct> connection;
class PQXX_LIBEXPORT connect_lazy : public connectionpolicy
{
public:
explicit connect_lazy(const PGSTD::string &opts) : connectionpolicy(opts) {}
virtual handle do_completeconnect(handle);
};
typedef basic_connection<connect_lazy> lazyconnection;
class PQXX_LIBEXPORT connect_async : public connectionpolicy
{
public:
explicit connect_async(const PGSTD::string &opts);
virtual handle do_startconnect(handle);
virtual handle do_completeconnect(handle);
virtual handle do_dropconnect(handle) throw ();
virtual bool is_ready(handle) const throw ();
private:
bool m_connecting;
};
typedef basic_connection<connect_async> asyncconnection;
class PQXX_LIBEXPORT connect_null : public connectionpolicy
{
public:
explicit connect_null(const PGSTD::string &opts) : connectionpolicy(opts) {}
};
typedef basic_connection<connect_null> nullconnection;
}
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::connectionpolicy::handle
internal::pq::PGconn * handle
Definition: connectionpolicy.hxx:42
pqxx::connect_async
Asynchronous connection policy; connects "in the background".
Definition: connection.hxx:119
pqxx::connectionpolicy
Definition: connectionpolicy.hxx:39
pqxx::lazyconnection
basic_connection< connect_lazy > lazyconnection
A "lazy" connection type: connect to database only when needed.
Definition: connection.hxx:109
pqxx::connect_null::connect_null
connect_null(const std::string &opts)
Definition: connection.hxx:146
pqxx::connect_lazy::connect_lazy
connect_lazy(const std::string &opts)
Definition: connection.hxx:103
pqxx::connect_direct::connect_direct
connect_direct(const std::string &opts)
Definition: connection.hxx:87
pqxx::connect_lazy
Lazy connection policy; causes connection to be deferred until first use.
Definition: connection.hxx:100
pqxx::basic_connection
The ultimate template that defines a connection type.
Definition: basic_connection.hxx:54
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: basic_connection.hxx:35
pqxx::connect_null
Nonfunctional, always-down connection policy for testing/debugging purposes.
Definition: connection.hxx:143
pqxx::connection
basic_connection< connect_direct > connection
The "standard" connection type: connect to database right now.
Definition: connection.hxx:92
pqxx::asyncconnection
basic_connection< connect_async > asyncconnection
"Asynchronous" connection type: start connecting, but don&#39;t wait for it
Definition: connection.hxx:135
pqxx::connect_direct
Connection policy; creates an immediate connection to a database.
Definition: connection.hxx:84
pqxx::nullconnection
basic_connection< connect_null > nullconnection
A "dummy" connection type: don&#39;t connect to any database at all.
Definition: connection.hxx:151