Kea 2.5.8
isc::db::MySqlHolder Class Reference

MySQL Handle Holder. More...

#include <mysql_connection.h>

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

Public Member Functions

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

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

◆ MySqlHolder()

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

Constructor.

Initialize MySql and store the associated context object.

Exceptions
DbOpenErrorUnable to initialize MySql handle.

Definition at line 140 of file mysql_connection.h.

References isc_throw.

◆ ~MySqlHolder()

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

Destructor.

Frees up resources allocated by the initialization of MySql.

Definition at line 149 of file mysql_connection.h.

Member Function Documentation

◆ operator MYSQL *()

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

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: