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

Fetch and Release MySQL Results. More...

#include <mysql_connection.h>

Public Member Functions

 MySqlFreeResult (MYSQL_STMT *statement)
 Constructor. More...
 
 ~MySqlFreeResult ()
 Destructor. More...
 

Detailed Description

Fetch and Release MySQL Results.

When a MySQL statement is expected, to fetch the results the function mysql_stmt_fetch() must be called. As well as getting data, this allocates internal state. Subsequent calls to mysql_stmt_fetch can be made, but when all the data is retrieved, mysql_stmt_free_result must be called to free up the resources allocated.

Created prior to the first fetch, this class's destructor calls mysql_stmt_free_result, so eliminating the need for an explicit release in the method calling mysql_stmt_free_result. In this way, it guarantees that the resources are released even if the MySqlLeaseMgr method concerned exits via an exception.

Definition at line 43 of file mysql_connection.h.

Constructor & Destructor Documentation

isc::db::MySqlFreeResult::MySqlFreeResult ( MYSQL_STMT *  statement)
inline

Constructor.

Store the pointer to the statement for which data is being fetched.

Note that according to the MySQL documentation, mysql_stmt_free_result only releases resources if a cursor has been allocated for the statement. This implies that it is a no-op if none have been. Either way, any error from mysql_stmt_free_result is ignored. (Generating an exception is not much help, as it will only confuse things if the method calling mysql_stmt_fetch is exiting via an exception.)

Definition at line 56 of file mysql_connection.h.

isc::db::MySqlFreeResult::~MySqlFreeResult ( )
inline

Destructor.

Frees up fetch context if a fetch has been successfully executed.

Definition at line 62 of file mysql_connection.h.


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