pqxx::basic_connection_base< CONNECTPOLICY > Class Template Reference

Base-class template for all libpqxx connection types. More...

`#include <basic_connection.hxx>`

Inheritance diagram for pqxx::basic_connection_base< CONNECTPOLICY >:
[legend]

## Public Member Functions

| basic_connection_base ()
| basic_connection_base (const std::string &opt)
| basic_connection_base (const char opt[])
| See: `basic_connection(const std::string &opt)` More...
| basic_connection_base (std::nullptr_t)
| ~basic_connection_base () noexcept
const std::string & | options () const noexcept
Public Member Functions inherited from pqxx::connection_base
void | disconnect () noexcept
| Explicitly close connection. More...
bool PQXX_PURE | is_open () const noexcept
| Is this connection open at the moment? More...
template<typename TRANSACTOR >
void | perform (const TRANSACTOR &T, int Attempts)
template<typename TRANSACTOR >
void | perform (const TRANSACTOR &T)
std::string | adorn_name (const std::string &)
| Suffix unique number to name to make it unique within session context. More...
std::string | esc (const char str[])
| Escape string for use as SQL string literal on this connection. More...
std::string | esc (const char str[], size_t maxlen)
| Escape string for use as SQL string literal on this connection. More...
std::string | esc (const std::string &str)
| Escape string for use as SQL string literal on this connection. More...
std::string | esc_raw (const unsigned char str[], size_t len)
| Escape binary string for use as SQL string literal on this connection. More...
std::string | unesc_raw (const std::string &text)
| Unescape binary data, e.g. from a table field or notification payload. More...
std::string | unesc_raw (const char *text)
| Unescape binary data, e.g. from a table field or notification payload. More...
std::string | quote_raw (const unsigned char str[], size_t len)
| Escape and quote a string of binary data. More...
std::string | quote_name (const std::string &identifier)
| Escape and quote an SQL identifier for use in a query. More...
template<typename T >
std::string | quote (const T &t)
| Represent object as SQL string, including quoting & escaping. More...
std::string | quote (const binarystring &)
std::string | esc_like (const std::string &str, char escape_char='\\') const
| Escape string for literal LIKE match. More...
void | cancel_query ()
| Attempt to cancel the ongoing query, if any. More...
void | set_verbosity (error_verbosity verbosity) noexcept
| Set session verbosity. More...
error_verbosity | get_verbosity () const noexcept
| Retrieve current error verbosity. More...
std::vector< errorhandler * > | get_errorhandlers () const
| Return pointers to the active errorhandlers. More...
void | activate ()
void | deactivate ()
void | inhibit_reactivation (bool inhibit)
void | simulate_failure ()
| Make the connection fail. More...
void | process_notice (const char[]) noexcept
| Invoke notice processor function. The message should end in newline. More...
void | process_notice (const std::string &) noexcept
| Invoke notice processor function. Newline at end is recommended. More...
void | trace (std::FILE *) noexcept
| Enable tracing to a given output stream, or nullptr to disable. More...
const char * | dbname ()
| Name of database we're connected to, if any. More...
const char * | username ()
| Database user ID we're connected under, if any. More...
const char * | hostname ()
| Address of server, or nullptr if none specified (i.e. default or local) More...
const char * | port ()
| Server port number we're connected to. More...
int PQXX_PURE | backendpid () const noexcept
| Process ID for backend process. More...
int PQXX_PURE | sock () const noexcept
| Socket currently used for connection, or -1 for none. Use with care! More...
std::string | get_client_encoding () const
| Get client-side character encoding, by name. More...
void | set_client_encoding (const std::string &encoding)
| Set client-side character encoding, by name. More...
void | set_client_encoding (const char encoding[])
| Set client-side character encoding, by name. More...
int | encoding_id () const
| Get the connection's encoding, as a PostgreSQL-defined code. More...
void | set_variable (const std::string &Var, const std::string &Value)
| Set session variable. More...
std::string | get_variable (const std::string &)
| Read session variable. More...
int | get_notifs ()
| Check for pending notifications and take appropriate action. More...
int | await_notification ()
| Wait for a notification to come in. More...
int | await_notification (long seconds, long microseconds)
| Wait for a notification to come in, or for given timeout to pass. More...
void | prepare (const std::string &name, const std::string &definition)
| Define a prepared statement. More...
void | prepare (const std::string &definition)
| Define a nameless prepared statement. More...
void | unprepare (const std::string &name)
| Drop prepared statement. More...
void | prepare_now (const std::string &name)
| Request that prepared statement be registered with the server. More...
bool | supports (capability c) const noexcept
| Does this connection seem to support the given capability? More...
int PQXX_PURE | protocol_version () const noexcept
| What version of the PostgreSQL protocol is this connection using? More...
int PQXX_PURE | server_version () const noexcept
| What version of the PostgreSQL server are we connected to? More...

## Additional Inherited Members

Public Types inherited from pqxx::connection_base
enum | error_verbosity { terse =0, normal =1, verbose =2 }
| Error verbosity levels. More...
enum | capability { cap_end }
| Session capabilities. More...
Protected Member Functions inherited from pqxx::connection_base
| connection_base (connectionpolicy &pol)
void | init ()
void | close () noexcept
void | wait_read () const
void | wait_read (long seconds, long microseconds) const
void | wait_write () const

## Detailed Description

### template<typename CONNECTPOLICY>
class pqxx::basic_connection_base< CONNECTPOLICY >

Base-class template for all libpqxx connection types.

Deprecated:
  In libpqxx 7, all built-in connection types will be implemented as a single class. You'll specify the connection policy as an optional constructor argument.

Combines connection_base (the highly complex class implementing essentially all connection-related functionality) with a connection policy (a simpler helper class determining the rules that govern the process of setting up the underlying connection to the backend).

The pattern used to combine these classes is the same as for basic_transaction. Through use of the template mechanism, the policy object is embedded in the basic_connection object so that it does not need to be allocated separately. This also avoids the need for virtual functions in this class.

## Constructor & Destructor Documentation

## basic_connection_base() [1/4]

template<typename CONNECTPOLICY >

pqxx::basic_connection_base< CONNECTPOLICY >::basic_connection_base | ( |  | ) |

## basic_connection_base() [2/4]

template<typename CONNECTPOLICY >

pqxx::basic_connection_base< CONNECTPOLICY >::basic_connection_base | ( | const std::string & | opt | ) |

explicit

The parsing of options is the same as libpq's PQconnect. See: https://www.postgresql.org/docs/10/static/libpq-connect.html

References pqxx::connection_base::init().

## basic_connection_base() [3/4]

template<typename CONNECTPOLICY >

pqxx::basic_connection_base< CONNECTPOLICY >::basic_connection_base | ( | const char | opt[] | ) |

explicit

See: `basic_connection(const std::string &opt)`

## basic_connection_base() [4/4]

template<typename CONNECTPOLICY >

pqxx::basic_connection_base< CONNECTPOLICY >::basic_connection_base | ( | std::nullptr_t |  | ) |

explicit

## ~basic_connection_base()

template<typename CONNECTPOLICY >

pqxx::basic_connection_base< CONNECTPOLICY >::~basic_connection_base | ( |  | ) |

noexcept

References pqxx::connection_base::close().

## Member Function Documentation

## options()

template<typename CONNECTPOLICY >

const std::string& pqxx::basic_connection_base< CONNECTPOLICY >::options | ( |  | ) | const

noexcept

The documentation for this class was generated from the following file:

- basic_connection.hxx