#include <connection.h>
Public Methods | |
Connection (const PGSTD::string &ConnInfo, bool Immediate=true) | |
Constructor. Sets up connection based on PostgreSQL connection string. | |
~Connection () | |
Destructor. Implicitly closes the connection. | |
void | Disconnect () throw () |
Explicitly close connection. | |
bool | IsOpen () const |
Is this connection open? | |
template<typename TRANSACTOR> void | Perform (const TRANSACTOR &, int Attempts=3) |
Perform the transaction defined by a Transactor-based object. | |
NoticeProcessor | SetNoticeProcessor (NoticeProcessor, void *arg) |
Set callback method for postgresql status output. | |
void | ProcessNotice (const char[]) throw () |
Invoke notice processor function. The message should end in newline. | |
void | ProcessNotice (PGSTD::string msg) throw () |
Invoke notice processor function. The message should end in newline. | |
void | Trace (FILE *) |
Enable tracing to a given output stream, or NULL to disable. | |
void | Untrace () |
Disable tracing. OBSOLETE. Use Trace(0). | |
void | GetNotifs () |
Check for pending trigger notifications and take appropriate action. | |
const char * | DbName () const throw () |
Name of database we're connected to, if any. | |
const char * | UserName () const throw () |
Database user ID we're connected under, if any. | |
const char * | HostName () const throw () |
Address of server (NULL for local connections). | |
const char * | Port () const throw () |
Server port number we're connected to. | |
const char * | Options () const throw () |
Full connection string as used to set up this connection. | |
int | BackendPID () const |
Process ID for backend process. | |
Friends | |
class | TransactionItf |
class | Trigger |
This is the first class to look at when you wish to work with a database through libpqxx. It is automatically opened by its constructor, and automatically closed upon destruction, if it hasn't already been closed manually. To query or manipulate the database once connected, use one of the Transaction classes (see pqxx/transactionitf.h) or preferably the Transactor framework (see pqxx/transactor.h).
|
Constructor. Sets up connection based on PostgreSQL connection string.
|
|
Destructor. Implicitly closes the connection.
|
|
Process ID for backend process. Use with care: connections may be lost and automatically re-established without your knowledge, in which case this process ID may no longer be correct. You may, however, assume that this number remains constant and reliable within the span of a successful backend transaction. If the transaction fails, which may be due to a lost connection, then this number will have become invalid at some point within the transaction. |
|
Name of database we're connected to, if any.
|
|
Explicitly close connection.
|
|
Check for pending trigger notifications and take appropriate action.
|
|
Address of server (NULL for local connections).
|
|
Is this connection open?
|
|
Full connection string as used to set up this connection.
|
|
Perform the transaction defined by a Transactor-based object. Invoke a Transactor, making at most Attempts attempts to perform the encapsulated code on the database. If the code throws any exception other than broken_connection, it will be aborted right away. Take care: neither OnAbort() nor OnCommit() will be invoked on the original transactor you pass into the function. It only serves as a prototype for the transaction to be performed. In fact, this function may copy-construct any number of Transactors from the one you passed in, calling either OnCommit() or OnAbort() only on those that actually have their operator() invoked. |
|
Server port number we're connected to.
|
|
Invoke notice processor function. The message should end in newline.
|
|
Invoke notice processor function. The message should end in newline.
|
|
Set callback method for postgresql status output. return value is the previous handler. Passing a NULL callback pointer simply returns the existing callback. The callback must have C linkage. |
|
Enable tracing to a given output stream, or NULL to disable.
|
|
Disable tracing. OBSOLETE. Use Trace(0).
|
|
Database user ID we're connected under, if any.
|
|
|
|
|