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

[#1073] minor changes

This commit is contained in:
Razvan Becheriu
2020-01-21 11:40:38 +02:00
parent f5403c7f51
commit 84dd2039ff
2 changed files with 24 additions and 21 deletions

View File

@@ -1990,17 +1990,17 @@ public:
GET_HOST_SUBID_ADDR, // Gets host by IPv4 SubnetID and IPv4 address GET_HOST_SUBID_ADDR, // Gets host by IPv4 SubnetID and IPv4 address
GET_HOST_PREFIX, // Gets host by IPv6 prefix GET_HOST_PREFIX, // Gets host by IPv6 prefix
GET_HOST_SUBID6_ADDR, // Gets host by IPv6 SubnetID and IPv6 prefix GET_HOST_SUBID6_ADDR, // Gets host by IPv6 SubnetID and IPv6 prefix
GET_HOST_SUBID4, // Get hosts by IPv4 SubnetID GET_HOST_SUBID4, // Gets hosts by IPv4 SubnetID
GET_HOST_SUBID6, // Get hosts by IPv6 SubnetID GET_HOST_SUBID6, // Gets hosts by IPv6 SubnetID
GET_HOST_HOSTNAME, // Get host by hostname GET_HOST_HOSTNAME, // Gets hosts by hostname
GET_HOST_HOSTNAME_SUBID4, // Get host by hostname and IPv4 SubnetID GET_HOST_HOSTNAME_SUBID4, // Gets hosts by hostname and IPv4 SubnetID
GET_HOST_HOSTNAME_SUBID6, // Get host by hostname and IPv6 SubnetID GET_HOST_HOSTNAME_SUBID6, // Gets hosts by hostname and IPv6 SubnetID
GET_HOST_SUBID4_PAGE, // Get hosts by IPv4 SubnetID beginning by HID GET_HOST_SUBID4_PAGE, // Gets hosts by IPv4 SubnetID beginning by HID
GET_HOST_SUBID6_PAGE, // Get hosts by IPv6 SubnetID beginning by HID GET_HOST_SUBID6_PAGE, // Gets hosts by IPv6 SubnetID beginning by HID
INSERT_HOST, // Insert new host to collection INSERT_HOST, // Insert new host to collection
INSERT_V6_RESRV, // Insert v6 reservation INSERT_V6_RESRV, // Insert v6 reservation
INSERT_V4_OPTION, // Insert DHCPv4 option INSERT_V4_HOST_OPTION, // Insert DHCPv4 option
INSERT_V6_OPTION, // Insert DHCPv6 option INSERT_V6_HOST_OPTION, // Insert DHCPv6 option
DEL_HOST_ADDR4, // Delete v4 host (subnet-id, addr4) DEL_HOST_ADDR4, // Delete v4 host (subnet-id, addr4)
DEL_HOST_SUBID4_ID, // Delete v4 host (subnet-id, ident.type, identifier) DEL_HOST_SUBID4_ID, // Delete v4 host (subnet-id, ident.type, identifier)
DEL_HOST_SUBID6_ID, // Delete v6 host (subnet-id, ident.type, identifier) DEL_HOST_SUBID6_ID, // Delete v6 host (subnet-id, ident.type, identifier)
@@ -2332,7 +2332,7 @@ TaggedStatementArray tagged_statements = { {
"ORDER BY h.host_id, o.option_id, r.reservation_id"}, "ORDER BY h.host_id, o.option_id, r.reservation_id"},
// Retrieves host information, IPv6 reservations and DHCPv6 options // Retrieves host information, IPv6 reservations and DHCPv6 options
// associated with a host using subnet id and prefix. This query // associated with a host using IPv6 subnet id and prefix. This query
// returns host information for a single host. However, multiple rows // returns host information for a single host. However, multiple rows
// are returned due to left joining IPv6 reservations and DHCPv6 options. // are returned due to left joining IPv6 reservations and DHCPv6 options.
// The number of rows returned is multiplication of number of existing // The number of rows returned is multiplication of number of existing
@@ -2526,14 +2526,14 @@ TaggedStatementArray tagged_statements = { {
// Inserts a single DHCPv4 option into 'dhcp4_options' table. // Inserts a single DHCPv4 option into 'dhcp4_options' table.
// Using fixed scope_id = 3, which associates an option with host. // Using fixed scope_id = 3, which associates an option with host.
{MySqlHostDataSourceImpl::INSERT_V4_OPTION, {MySqlHostDataSourceImpl::INSERT_V4_HOST_OPTION,
"INSERT INTO dhcp4_options(option_id, code, value, formatted_value, space, " "INSERT INTO dhcp4_options(option_id, code, value, formatted_value, space, "
"persistent, user_context, dhcp_client_class, dhcp4_subnet_id, host_id, scope_id) " "persistent, user_context, dhcp_client_class, dhcp4_subnet_id, host_id, scope_id) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"}, "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"},
// Inserts a single DHCPv6 option into 'dhcp6_options' table. // Inserts a single DHCPv6 option into 'dhcp6_options' table.
// Using fixed scope_id = 3, which associates an option with host. // Using fixed scope_id = 3, which associates an option with host.
{MySqlHostDataSourceImpl::INSERT_V6_OPTION, {MySqlHostDataSourceImpl::INSERT_V6_HOST_OPTION,
"INSERT INTO dhcp6_options(option_id, code, value, formatted_value, space, " "INSERT INTO dhcp6_options(option_id, code, value, formatted_value, space, "
"persistent, user_context, dhcp_client_class, dhcp6_subnet_id, host_id, scope_id) " "persistent, user_context, dhcp_client_class, dhcp6_subnet_id, host_id, scope_id) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"}, "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"},
@@ -2596,15 +2596,16 @@ MySqlHostDataSource::MySqlHostContextAlloc::~MySqlHostContextAlloc() {
MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const MySqlConnection::ParameterMap& parameters) MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const MySqlConnection::ParameterMap& parameters)
: parameters_(parameters) { : parameters_(parameters) {
// Test schema version first. // Validate the schema version first.
std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR, std::pair<uint32_t, uint32_t> code_version(MYSQL_SCHEMA_VERSION_MAJOR,
MYSQL_SCHEMA_VERSION_MINOR); MYSQL_SCHEMA_VERSION_MINOR);
std::pair<uint32_t, uint32_t> db_version = getVersion(); std::pair<uint32_t, uint32_t> db_version = getVersion();
if (code_version != db_version) { if (code_version != db_version) {
isc_throw(DbOpenError, "MySQL schema version mismatch: need version: " isc_throw(DbOpenError,
<< code_version.first << "." << code_version.second "MySQL schema version mismatch: need version: "
<< " found version: " << db_version.first << "." << code_version.first << "." << code_version.second
<< db_version.second); << " found version: " << db_version.first << "."
<< db_version.second);
} }
// Create an initial context. // Create an initial context.
@@ -2920,14 +2921,14 @@ MySqlHostDataSource::add(const HostPtr& host) {
// Insert DHCPv4 options. // Insert DHCPv4 options.
ConstCfgOptionPtr cfg_option4 = host->getCfgOption4(); ConstCfgOptionPtr cfg_option4 = host->getCfgOption4();
if (cfg_option4) { if (cfg_option4) {
impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V4_OPTION, impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V4_HOST_OPTION,
cfg_option4, host_id); cfg_option4, host_id);
} }
// Insert DHCPv6 options. // Insert DHCPv6 options.
ConstCfgOptionPtr cfg_option6 = host->getCfgOption6(); ConstCfgOptionPtr cfg_option6 = host->getCfgOption6();
if (cfg_option6) { if (cfg_option6) {
impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V6_OPTION, impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V6_HOST_OPTION,
cfg_option6, host_id); cfg_option6, host_id);
} }

View File

@@ -2690,7 +2690,8 @@ MySqlLeaseMgr::getExpiredLeasesCommon(LeaseCollection& expired_leases,
template <typename LeasePtr> template <typename LeasePtr>
void void
MySqlLeaseMgr::updateLeaseCommon(MySqlLeaseContextPtr& ctx, MySqlLeaseMgr::updateLeaseCommon(MySqlLeaseContextPtr& ctx,
StatementIndex stindex, MYSQL_BIND* bind, StatementIndex stindex,
MYSQL_BIND* bind,
const LeasePtr& lease) { const LeasePtr& lease) {
// Bind the parameters to the statement // Bind the parameters to the statement
@@ -2816,7 +2817,8 @@ MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
// handles the common processing. // handles the common processing.
uint64_t uint64_t
MySqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind) { MySqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex,
MYSQL_BIND* bind) {
// Get a context // Get a context
MySqlLeaseContextAlloc get_context(*this); MySqlLeaseContextAlloc get_context(*this);