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

MySQL Handle Holder. More...

#include <mysql_connection.h>

+ Inheritance diagram for isc::db::MySqlHolder:

Public Member Functions

 MySqlHolder ()
 Constructor. More...
 ~MySqlHolder ()
 Destructor. More...
 operator MYSQL * () const
 Conversion Operator. More...

Detailed Description

MySQL 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 MySql 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 132 of file mysql_connection.h.

Constructor & Destructor Documentation

isc::db::MySqlHolder::MySqlHolder ( )


Initialize MySql and store the associated context object.

DbOpenErrorUnable to initialize MySql handle.

Definition at line 140 of file mysql_connection.h.

References isc_throw.

isc::db::MySqlHolder::~MySqlHolder ( )


Frees up resources allocated by the initialization of MySql.

Definition at line 149 of file mysql_connection.h.

Member Function Documentation

isc::db::MySqlHolder::operator MYSQL * ( ) const

Conversion Operator.

Allows the MySqlHolder object to be passed as the context argument to mysql_xxx functions.

Definition at line 159 of file mysql_connection.h.

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