Kea  1.9.9-git
isc::db::PgSqlHolder Class Reference

Postgresql connection handle Holder. More...

#include <pgsql_connection.h>

+ Inheritance diagram for isc::db::PgSqlHolder:

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...

Detailed Description

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.

Constructor & Destructor Documentation

isc::db::PgSqlHolder::PgSqlHolder ( )


Sets the Postgresql API connector handle to NULL.

Definition at line 188 of file pgsql_connection.h.

isc::db::PgSqlHolder::~PgSqlHolder ( )


Frees up resources allocated by the connection.

Definition at line 194 of file pgsql_connection.h.

Member Function Documentation

isc::db::PgSqlHolder::operator bool ( ) const

Boolean Operator.

Allows testing the connection for emptiness: "if (holder)"

Definition at line 224 of file pgsql_connection.h.

isc::db::PgSqlHolder::operator PGconn * ( ) const

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.

void isc::db::PgSqlHolder::setConnection ( PGconn *  connection)

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().

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