Kea
1.9.9-git
|
Postgresql connection handle Holder. More...
#include <pgsql_connection.h>
Public Member Functions | |
PgSqlHolder () | |
Constructor. More... | |
~PgSqlHolder () | |
Destructor. More... | |
operator bool () const | |
Boolean Operator. More... | |
operator PGconn * () const | |
Conversion Operator. More... | |
void | setConnection (PGconn *connection) |
Sets the connection to the value given. More... | |
Postgresql connection handle Holder.
Small RAII object for safer initialization, will close the database connection upon destruction. This means that if an exception is thrown during database initialization, resources allocated to the database are guaranteed to be freed.
It makes no sense to copy an object of this class. After the copy, both objects would contain pointers to the same PgSql context object. The destruction of one would invalid the context in the remaining object. For this reason, the class is declared noncopyable.
Definition at line 181 of file pgsql_connection.h.
|
inline |
Constructor.
Sets the Postgresql API connector handle to NULL.
Definition at line 188 of file pgsql_connection.h.
|
inline |
Destructor.
Frees up resources allocated by the connection.
Definition at line 194 of file pgsql_connection.h.
|
inline |
Boolean Operator.
Allows testing the connection for emptiness: "if (holder)"
Definition at line 224 of file pgsql_connection.h.
|
inline |
Conversion Operator.
Allows the PgSqlHolder object to be passed as the context argument to PQxxxx functions.
Definition at line 217 of file pgsql_connection.h.
|
inline |
Sets the connection to the value given.
connection | - pointer to the Postgresql connection instance |
Definition at line 203 of file pgsql_connection.h.
Referenced by isc::db::PgSqlConnection::openDatabase().