Kea 2.5.8
isc::dhcp::MySqlLease6Exchange Class Reference

Exchange MySQL and Lease6 Data. More...

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

Public Member Functions

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

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

Definition at line 1195 of file

Constructor & Destructor Documentation

◆ MySqlLease6Exchange()

isc::dhcp::MySqlLease6Exchange::MySqlLease6Exchange ( )


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

References isc::db::MLM_FALSE.

Member Function Documentation

◆ createBindForReceive()

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

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.

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

Definition at line 1528 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::MySqlLease6Exchange::createBindForSend ( const Lease6Ptr lease)

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

Definition at line 1274 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::MySqlLease6Exchange::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 1796 of file

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

+ Here is the call graph for this function:

◆ getLeaseData()

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

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.

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

Definition at line 1690 of file

References isc::db::MySqlConnection::convertFromDatabaseTime(), isc::asiolink::IOAddress::fromBytes(), isc::data::Element::fromJSON(), isc::dhcp::Lease::INFINITY_LFT, isc_throw, isc::data::Element::map, isc::db::MLM_FALSE, isc::asiolink::IOAddress::toText(), isc::dhcp::Lease::TYPE_NA, isc::dhcp::Lease::TYPE_PD, and isc::dhcp::Lease::TYPE_TA.

+ Here is the call graph for this function:

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