2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-05 00:15:17 +00:00

[5629] MySQL Lease back end now validates schema after connecting

src/lib/dhcpsrv/mysql_lease_mgr.*
    MySqlLeaseMgr::MySqlLeaseMgr() - now validates schema
    after connecting

    MySqlLeaseMgr::getVersion()  - no longer relies on
    pre-prepared statement or formal statement execution
    error handling

src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
    LeaseMgrDbLostCallbackTest::testDbLostCallback() - replaced
    use of getVersion() with getLease4() for testing DB usability
This commit is contained in:
Thomas Markwalder
2018-05-31 09:41:46 -04:00
parent 1d0a651363
commit 7614eb8d2b
3 changed files with 58 additions and 22 deletions

View File

@@ -53,7 +53,8 @@ public:
/// concerned with the database.
///
/// @throw isc::dhcp::NoDatabaseName Mandatory database name not given
/// @throw isc::dhcp::DbOpenError Error opening the database
/// @throw isc::dhcp::DbOpenError Error opening the database or the schema
/// version is incorrect.
/// @throw isc::dhcp::DbOperationError An operation on the open database has
/// failed.
MySqlLeaseMgr(const DatabaseConnection::ParameterMap& parameters);
@@ -472,6 +473,11 @@ public:
/// @brief Returns backend version.
///
/// The method is called by the constructor after opening the database
/// but prior to preparing SQL statements, to verify that the schema version
/// is correct. Thus it does not rely on a pre-prepared statement or
/// formal statement execution error checking.
///
/// @return Version number as a pair of unsigned integers. "first" is the
/// major version number, "second" the minor number.
///
@@ -517,7 +523,6 @@ public:
GET_LEASE6_DUID_IAID_SUBID, // Get lease6 by DUID, IAID and subnet ID
GET_LEASE6_SUBID, // Get IPv6 leases by subnet ID
GET_LEASE6_EXPIRE, // Get lease6 by expiration.
GET_VERSION, // Obtain version number
INSERT_LEASE4, // Add entry to lease4 table
INSERT_LEASE6, // Add entry to lease6 table
UPDATE_LEASE4, // Update a Lease4 entry