libpqxx
pqxx::basic_connection< CONNECTPOLICY > Struct Template Reference

Concrete connection type template. More...

#include <basic_connection.hxx>

Inheritance diagram for pqxx::basic_connection< CONNECTPOLICY >:

Public Member Functions

 basic_connection ()=default
 
 basic_connection (const std::string &opt)
 
 basic_connection (const char opt[])
 
 basic_connection (std::nullptr_t)
 
- Public Member Functions inherited from pqxx::basic_connection_base< CONNECTPOLICY >
 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...
 
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...
 
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...
 
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...
 
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...
 
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>
struct pqxx::basic_connection< CONNECTPOLICY >

Concrete connection type template.

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.

Constructor & Destructor Documentation

◆ basic_connection() [1/4]

template<typename CONNECTPOLICY >
pqxx::basic_connection< CONNECTPOLICY >::basic_connection ( )
default

◆ basic_connection() [2/4]

template<typename CONNECTPOLICY >
pqxx::basic_connection< CONNECTPOLICY >::basic_connection ( const std::string &  opt)
explicit

◆ basic_connection() [3/4]

template<typename CONNECTPOLICY >
pqxx::basic_connection< CONNECTPOLICY >::basic_connection ( const char  opt[])
explicit

◆ basic_connection() [4/4]

template<typename CONNECTPOLICY >
pqxx::basic_connection< CONNECTPOLICY >::basic_connection ( std::nullptr_t  )
explicit

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