basic_connection.hxx
#ifndef PQXX_H_BASIC_CONNECTION
#define PQXX_H_BASIC_CONNECTION
#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"
#include <cstddef>
#include <memory>
#include <string>
#include "pqxx/connection_base.hxx"
namespace pqxx
{
template<typename CONNECTPOLICY> class basic_connection_base :
public connection_base
{
public:
basic_connection_base() :
connection_base(m_policy),
m_options(std::string{}),
m_policy(m_options)
{ init(); }
explicit basic_connection_base(const std::string &opt) :
connection_base(m_policy),
m_options(opt),
m_policy(m_options)
{init();}
explicit basic_connection_base(const char opt[]) :
basic_connection_base(opt ? std::string{opt} : std::string{}) {}
explicit basic_connection_base(std::nullptr_t) : basic_connection_base() {}
~basic_connection_base() noexcept
{ close(); }
const std::string &options() const noexcept //[t01]
{return m_policy.options();}
private:
std::string m_options;
CONNECTPOLICY m_policy;
};
template<typename CONNECTPOLICY> struct basic_connection :
basic_connection_base<CONNECTPOLICY>
{
PQXX_DEPRECATED basic_connection() =default;
PQXX_DEPRECATED explicit basic_connection(const std::string &opt) :
basic_connection(opt) {}
PQXX_DEPRECATED explicit basic_connection(const char opt[]) :
basic_connection(opt) {}
PQXX_DEPRECATED explicit basic_connection(std::nullptr_t) :
basic_connection() {}
using basic_connection_base<CONNECTPOLICY>::options;
};
} // namespace
#include "pqxx/compiler-internal-post.hxx"
#endif
pqxx::basic_connection
Concrete connection type template.
Definition: basic_connection.hxx:88
pqxx::basic_connection::basic_connection
basic_connection(const std::string &opt)
Definition: basic_connection.hxx:92
pqxx::basic_connection_base
Base-class template for all libpqxx connection types.
Definition: basic_connection.hxx:45
pqxx::connection_base::close
void close() noexcept
Definition: connection_base.cxx:902
pqxx::basic_connection_base::basic_connection_base
basic_connection_base(std::nullptr_t)
Definition: basic_connection.hxx:67
pqxx::basic_connection_base::options
const std::string & options() const noexcept
Definition: basic_connection.hxx:72
pqxx::basic_connection::basic_connection
basic_connection(std::nullptr_t)
Definition: basic_connection.hxx:97
pqxx::connection_base::init
void init()
Definition: connection_base.cxx:99
pqxx::basic_connection::basic_connection
basic_connection()=default
pqxx::basic_connection_base::basic_connection_base
basic_connection_base(const std::string &opt)
Definition: basic_connection.hxx:57
pqxx::basic_connection_base::basic_connection_base
basic_connection_base(const char opt[])
See: basic_connection(const std::string &opt)
Definition: basic_connection.hxx:64
pqxx::basic_connection_base::~basic_connection_base
~basic_connection_base() noexcept
Definition: basic_connection.hxx:69
pqxx::basic_connection::basic_connection
basic_connection(const char opt[])
Definition: basic_connection.hxx:94
pqxx::connection_base
connection_base abstract base class; represents a connection to a database.
Definition: connection_base.hxx:139
pqxx::basic_connection_base::basic_connection_base
basic_connection_base()
Definition: basic_connection.hxx:49
pqxx
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:25