From 84dd2039ff21582e50cb0adf59f099c9bbc7130a Mon Sep 17 00:00:00 2001 From: Razvan Becheriu Date: Tue, 21 Jan 2020 11:40:38 +0200 Subject: [PATCH] [#1073] minor changes --- src/lib/dhcpsrv/mysql_host_data_source.cc | 39 ++++++++++++----------- src/lib/dhcpsrv/mysql_lease_mgr.cc | 6 ++-- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/lib/dhcpsrv/mysql_host_data_source.cc b/src/lib/dhcpsrv/mysql_host_data_source.cc index 2eae76e92a..3206f7b07f 100644 --- a/src/lib/dhcpsrv/mysql_host_data_source.cc +++ b/src/lib/dhcpsrv/mysql_host_data_source.cc @@ -1990,17 +1990,17 @@ public: GET_HOST_SUBID_ADDR, // Gets host by IPv4 SubnetID and IPv4 address GET_HOST_PREFIX, // Gets host by IPv6 prefix GET_HOST_SUBID6_ADDR, // Gets host by IPv6 SubnetID and IPv6 prefix - GET_HOST_SUBID4, // Get hosts by IPv4 SubnetID - GET_HOST_SUBID6, // Get hosts by IPv6 SubnetID - GET_HOST_HOSTNAME, // Get host by hostname - GET_HOST_HOSTNAME_SUBID4, // Get host by hostname and IPv4 SubnetID - GET_HOST_HOSTNAME_SUBID6, // Get host by hostname and IPv6 SubnetID - GET_HOST_SUBID4_PAGE, // Get hosts by IPv4 SubnetID beginning by HID - GET_HOST_SUBID6_PAGE, // Get hosts by IPv6 SubnetID beginning by HID + GET_HOST_SUBID4, // Gets hosts by IPv4 SubnetID + GET_HOST_SUBID6, // Gets hosts by IPv6 SubnetID + GET_HOST_HOSTNAME, // Gets hosts by hostname + GET_HOST_HOSTNAME_SUBID4, // Gets hosts by hostname and IPv4 SubnetID + GET_HOST_HOSTNAME_SUBID6, // Gets hosts by hostname and IPv6 SubnetID + GET_HOST_SUBID4_PAGE, // Gets hosts by IPv4 SubnetID beginning by HID + GET_HOST_SUBID6_PAGE, // Gets hosts by IPv6 SubnetID beginning by HID INSERT_HOST, // Insert new host to collection INSERT_V6_RESRV, // Insert v6 reservation - INSERT_V4_OPTION, // Insert DHCPv4 option - INSERT_V6_OPTION, // Insert DHCPv6 option + INSERT_V4_HOST_OPTION, // Insert DHCPv4 option + INSERT_V6_HOST_OPTION, // Insert DHCPv6 option DEL_HOST_ADDR4, // Delete v4 host (subnet-id, addr4) DEL_HOST_SUBID4_ID, // Delete v4 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"}, // 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 // are returned due to left joining IPv6 reservations and DHCPv6 options. // 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. // 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, " "persistent, user_context, dhcp_client_class, dhcp4_subnet_id, host_id, scope_id) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"}, // Inserts a single DHCPv6 option into 'dhcp6_options' table. // 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, " "persistent, user_context, dhcp_client_class, dhcp6_subnet_id, host_id, scope_id) " "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 3)"}, @@ -2596,15 +2596,16 @@ MySqlHostDataSource::MySqlHostContextAlloc::~MySqlHostContextAlloc() { MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const MySqlConnection::ParameterMap& parameters) : parameters_(parameters) { - // Test schema version first. + // Validate the schema version first. std::pair code_version(MYSQL_SCHEMA_VERSION_MAJOR, MYSQL_SCHEMA_VERSION_MINOR); std::pair db_version = getVersion(); if (code_version != db_version) { - isc_throw(DbOpenError, "MySQL schema version mismatch: need version: " - << code_version.first << "." << code_version.second - << " found version: " << db_version.first << "." - << db_version.second); + isc_throw(DbOpenError, + "MySQL schema version mismatch: need version: " + << code_version.first << "." << code_version.second + << " found version: " << db_version.first << "." + << db_version.second); } // Create an initial context. @@ -2920,14 +2921,14 @@ MySqlHostDataSource::add(const HostPtr& host) { // Insert DHCPv4 options. ConstCfgOptionPtr cfg_option4 = host->getCfgOption4(); if (cfg_option4) { - impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V4_OPTION, + impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V4_HOST_OPTION, cfg_option4, host_id); } // Insert DHCPv6 options. ConstCfgOptionPtr cfg_option6 = host->getCfgOption6(); if (cfg_option6) { - impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V6_OPTION, + impl_->addOptions(ctx, MySqlHostDataSourceImpl::INSERT_V6_HOST_OPTION, cfg_option6, host_id); } diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 4b2f5cc127..df0b7ec77d 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -2690,7 +2690,8 @@ MySqlLeaseMgr::getExpiredLeasesCommon(LeaseCollection& expired_leases, template void MySqlLeaseMgr::updateLeaseCommon(MySqlLeaseContextPtr& ctx, - StatementIndex stindex, MYSQL_BIND* bind, + StatementIndex stindex, + MYSQL_BIND* bind, const LeasePtr& lease) { // Bind the parameters to the statement @@ -2816,7 +2817,8 @@ MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) { // handles the common processing. uint64_t -MySqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex, MYSQL_BIND* bind) { +MySqlLeaseMgr::deleteLeaseCommon(StatementIndex stindex, + MYSQL_BIND* bind) { // Get a context MySqlLeaseContextAlloc get_context(*this);