Kea 2.7.6
|
Postgresql connection handle Holder. More...
#include <pgsql_connection.h>
Public Member Functions | |
PgSqlHolder () | |
Constructor. | |
~PgSqlHolder () | |
Destructor. | |
operator bool () const | |
Boolean Operator. | |
operator PGconn * () const | |
Conversion Operator. | |
void | setConnection (PGconn *connection) |
Sets the connection to the value given. | |
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 79 of file pgsql_connection.h.
|
inline |
Constructor.
Sets the Postgresql API connector handle to NULL.
Definition at line 86 of file pgsql_connection.h.
|
inline |
Destructor.
Frees up resources allocated by the connection.
Definition at line 92 of file pgsql_connection.h.
|
inline |
Boolean Operator.
Allows testing the connection for emptiness: "if (holder)"
Definition at line 122 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 115 of file pgsql_connection.h.
|
inline |
Sets the connection to the value given.
connection | - pointer to the Postgresql connection instance |
Definition at line 101 of file pgsql_connection.h.