basic_connection.hxx
/*-------------------------------------------------------------------------
*
* FILE
* pqxx/basic_connection.hxx
*
* DESCRIPTION
* definition of the pqxx::basic_connection class template
* Instantiations of basic_connection bring connections and policies together
* DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/basic_connection instead.
*
* Copyright (c) 2006-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_BASIC_CONNECTION
#define PQXX_H_BASIC_CONNECTION
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include <memory>
#include <string>
#include "pqxx/connection_base"
#ifdef PQXX_QUIET_DESTRUCTORS
#include "pqxx/errorhandler"
#endif
namespace pqxx
{
// TODO: Also mix in thread synchronization policy here!
template<typename CONNECTPOLICY> class basic_connection :
public connection_base
{
public:
basic_connection() :
connection_base(m_policy),
m_options(PGSTD::string()),
m_policy(m_options)
{ init(); }
explicit basic_connection(const PGSTD::string &opt) :
connection_base(m_policy), m_options(opt), m_policy(m_options) {init();}
explicit basic_connection(const char opt[]) :
connection_base(m_policy),
m_options(opt?opt:PGSTD::string()),
m_policy(m_options)
{ init(); }
~basic_connection() throw ()
{
#ifdef PQXX_QUIET_DESTRUCTORS
quiet_errorhandler quiet(*this);
#endif
close();
}
const PGSTD::string &options() const throw () //[t1]
{return m_policy.options();}
private:
PGSTD::string m_options;
CONNECTPOLICY m_policy;
};
} // namespace
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::connection_base
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:151
pqxx::basic_connection::basic_connection
basic_connection()
Definition: basic_connection.hxx:58
pqxx::connection_base::init
void init()
Definition: connection_base.cxx:146
pqxx::quiet_errorhandler
An error handler that suppresses any previously registered error handlers.
Definition: errorhandler.hxx:85
pqxx::basic_connection::basic_connection
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
pqxx::basic_connection::options
const std::string & options() const
Definition: basic_connection.hxx:81
pqxx::connection_base::close
void close()
Definition: connection_base.cxx:977
pqxx::basic_connection::~basic_connection
~basic_connection()
Definition: basic_connection.hxx:73
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::basic_connection::basic_connection
basic_connection(const char opt[])
Definition: basic_connection.hxx:67