Kea 2.6.0
isc::dhcp::MySqlLease4Exchange Class Reference

Exchange MySQL and Lease4 Data. More...

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

Public Member Functions

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

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.
static void setErrorIndicators (MYSQL_BIND *bind, my_bool *error, size_t count)
 Set error indicators.

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.

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

Definition at line 596 of file

Constructor & Destructor Documentation

◆ MySqlLease4Exchange()

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


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 625 of file

References isc::db::MLM_FALSE.

Member Function Documentation

◆ createBindForReceive()

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

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 897 of file

References isc::db::MLM_FALSE, isc::db::MLM_TRUE, and isc::dhcp::MySqlLeaseExchange::setErrorIndicators().

+ Here is the call graph for this function:

◆ createBindForSend()

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

Create MYSQL_BIND objects for Lease4 Pointer.

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

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

Definition at line 668 of file

References isc::db::MySqlConnection::convertToDatabaseTime(), isc::dhcp::Lease::INFINITY_LFT, isc_throw, isc::db::MLM_TRUE, isc::dhcp::MySqlLeaseExchange::setErrorIndicators(), and isc::dhcp::USER_CONTEXT_MAX_LEN.

+ Here is the call graph for this function:

◆ getErrorColumns()

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

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)".

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

Definition at line 1124 of file

References isc::dhcp::MySqlLeaseExchange::getColumnsInError().

+ Here is the call graph for this function:

◆ getLeaseData()

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

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.

Lease4Ptr Pointer to a Lease6 object holding the relevant data.

Definition at line 1037 of file

References isc::db::MySqlConnection::convertFromDatabaseTime(), isc::data::Element::fromJSON(), isc::dhcp::HTYPE_ETHER, isc::dhcp::Lease::INFINITY_LFT, isc_throw, isc::data::Element::map, isc::db::MLM_FALSE, and isc::db::MLM_TRUE.

+ Here is the call graph for this function:

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