Kea  2.1.7-git
isc::dhcp::MySqlLease6Exchange Class Reference

Exchange MySQL and Lease6 Data. More...

+ Inheritance diagram for isc::dhcp::MySqlLease6Exchange:

Public Member Functions

 MySqlLease6Exchange ()
 Constructor. More...
 
std::vector< MYSQL_BIND > createBindForReceive ()
 Create BIND array to receive data. More...
 
std::vector< MYSQL_BIND > createBindForSend (const Lease6Ptr &lease)
 Create MYSQL_BIND objects for Lease6 Pointer. More...
 
std::string getErrorColumns ()
 Return columns in error. More...
 
Lease6Ptr getLeaseData ()
 Copy Received Data into Lease6 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 Lease6 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::xxx6() calls where it is used.

Definition at line 893 of file mysql_lease_mgr.cc.

Constructor & Destructor Documentation

◆ MySqlLease6Exchange()

isc::dhcp::MySqlLease6Exchange::MySqlLease6Exchange ( )
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 903 of file mysql_lease_mgr.cc.

References isc::db::MLM_FALSE.

Member Function Documentation

◆ createBindForReceive()

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

Create BIND array to receive data.

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

Returns
Vector of MySQL BIND objects passed to the MySQL data retrieval functions.

Definition at line 1204 of file mysql_lease_mgr.cc.

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

◆ createBindForSend()

std::vector<MYSQL_BIND> isc::dhcp::MySqlLease6Exchange::createBindForSend ( const Lease6Ptr lease)
inline

Create MYSQL_BIND objects for Lease6 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.
Returns
Vector of MySQL BIND objects representing the data to be added.

Definition at line 947 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:

◆ getErrorColumns()

std::string isc::dhcp::MySqlLease6Exchange::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 1464 of file mysql_lease_mgr.cc.

References isc::dhcp::ADDRESS6_TEXT_MAX_LEN, isc::dhcp::HOSTNAME_MAX_LEN, and isc::dhcp::USER_CONTEXT_MAX_LEN.

◆ getLeaseData()

Lease6Ptr isc::dhcp::MySqlLease6Exchange::getLeaseData ( )
inline

Copy Received Data into Lease6 Object.

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

Returns
Lease6Ptr Pointer to a Lease6 object holding the relevant data.
Exceptions
isc::BadValueUnable to convert Lease Type value in database

Definition at line 1362 of file mysql_lease_mgr.cc.

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


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