Kea  1.9.9-git
isc::dhcp::MySqlLease4Exchange Class Reference

Exchange MySQL and Lease4 Data. More...

+ Inheritance diagram for isc::dhcp::MySqlLease4Exchange:

Public Member Functions

 MySqlLease4Exchange ()
 Constructor. More...
 
std::vector< MYSQL_BIND > createBindForReceive ()
 Create BIND array to receive data. More...
 
std::vector< MYSQL_BIND > createBindForSend (const Lease4Ptr &lease)
 Create MYSQL_BIND objects for Lease4 Pointer. More...
 
std::string getErrorColumns ()
 Return columns in error. More...
 
Lease4Ptr getLeaseData ()
 Copy Received Data into Lease4 Object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from isc::dhcp::MySqlLeaseExchange
static std::string getColumnsInError (my_bool *error, std::string *names, size_t count)
 Return columns in error. More...
 
static void setErrorIndicators (MYSQL_BIND *bind, my_bool *error, size_t count)
 Set error indicators. More...
 

Detailed Description

Exchange MySQL and Lease4 Data.

On any MySQL operation, arrays of MYSQL_BIND structures must be built to describe the parameters in the prepared statements. Where information is inserted or retrieved - INSERT, UPDATE, SELECT - a large amount of that structure is identical. This class handles the creation of that array.

Owing to the MySQL API, the process requires some intermediate variables to hold things like data length etc. This object holds those variables.

Note
There are no unit tests for this class. It is tested indirectly in all MySqlLeaseMgr::xxx4() calls where it is used.

Definition at line 414 of file mysql_lease_mgr.cc.

Constructor & Destructor Documentation

isc::dhcp::MySqlLease4Exchange::MySqlLease4Exchange ( )
inline

Constructor.

The initialization of the variables here is only to satisfy cppcheck - all variables are initialized/set in the methods before they are used.

Definition at line 424 of file mysql_lease_mgr.cc.

References isc::db::MLM_FALSE.

Member Function Documentation

std::vector<MYSQL_BIND> isc::dhcp::MySqlLease4Exchange::createBindForReceive ( )
inline

Create BIND array to receive data.

Creates a MYSQL_BIND array to receive Lease4 data from the database. After data is successfully received, getLeaseData() can be used to copy it to a Lease6 object.

Definition at line 650 of file mysql_lease_mgr.cc.

References isc::db::MLM_FALSE, and isc::db::MLM_TRUE.

std::vector<MYSQL_BIND> isc::dhcp::MySqlLease4Exchange::createBindForSend ( const Lease4Ptr lease)
inline

Create MYSQL_BIND objects for Lease4 Pointer.

Fills in the MYSQL_BIND array for sending data in the Lease4 object to the database.

Parameters
leaseLease object to be added to the database. None of the fields in the lease are modified - the lease data is only read.
Returns
Vector of MySQL BIND objects representing the data to be added.

Definition at line 460 of file mysql_lease_mgr.cc.

References isc_throw, isc::db::MLM_TRUE, isc::dhcp::USER_CONTEXT_MAX_LEN, and isc::Exception::what().

+ Here is the call graph for this function:

std::string isc::dhcp::MySqlLease4Exchange::getErrorColumns ( )
inline

Return columns in error.

If an error is returned from a fetch (in particular, a truncated status), this method can be called to get the names of the fields in error. It returns a string comprising the names of the fields separated by commas. In the case of there being no error indicators set, it returns the string "(None)".

Returns
Comma-separated list of columns in error, or the string "(None)".

Definition at line 838 of file mysql_lease_mgr.cc.

Lease4Ptr isc::dhcp::MySqlLease4Exchange::getLeaseData ( )
inline

Copy Received Data into Lease4 Object.

Called after the MYSQL_BIND array created by createBindForReceive() has been used, this copies data from the internal member variables into a Lease4 object.

Returns
Lease4Ptr Pointer to a Lease6 object holding the relevant data.

Definition at line 767 of file mysql_lease_mgr.cc.

References isc::dhcp::HTYPE_ETHER, isc_throw, isc::db::MLM_FALSE, and isc::db::MLM_TRUE.


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