2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[4489] Added support for read only mode in MySQL HR backend.

This commit is contained in:
Marcin Siodelski
2016-07-28 12:56:58 +02:00
parent 8a5601acbf
commit 65d3817db8
8 changed files with 179 additions and 64 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -13,6 +13,7 @@
#include <dhcpsrv/mysql_lease_mgr.h>
#include <dhcpsrv/mysql_connection.h>
#include <boost/array.hpp>
#include <boost/static_assert.hpp>
#include <mysqld_error.h>
@@ -82,7 +83,8 @@ const size_t HOSTNAME_MAX_LEN = 255;
/// colon separators.
const size_t ADDRESS6_TEXT_MAX_LEN = 39;
TaggedStatement tagged_statements[] = {
boost::array<TaggedStatement, MySqlLeaseMgr::NUM_STATEMENTS>
tagged_statements = { {
{MySqlLeaseMgr::DELETE_LEASE4,
"DELETE FROM lease4 WHERE address = ?"},
{MySqlLeaseMgr::DELETE_LEASE4_STATE_EXPIRED,
@@ -204,9 +206,8 @@ TaggedStatement tagged_statements[] = {
"prefix_len = ?, fqdn_fwd = ?, fqdn_rev = ?, "
"hostname = ?, hwaddr = ?, hwtype = ?, hwaddr_source = ?, "
"state = ? "
"WHERE address = ?"},
// End of list sentinel
{MySqlLeaseMgr::NUM_STATEMENTS, NULL}
"WHERE address = ?"}
}
};
};
@@ -1236,7 +1237,8 @@ MySqlLeaseMgr::MySqlLeaseMgr(const MySqlConnection::ParameterMap& parameters)
}
// Prepare all statements likely to be used.
conn_.prepareStatements(tagged_statements, MySqlLeaseMgr::NUM_STATEMENTS);
conn_.prepareStatements(tagged_statements.begin(), tagged_statements.end(),
tagged_statements.size());
// Create the exchange objects for use in exchanging data between the
// program and the database.