From: Thomas Markwalder Date: Mon, 25 Apr 2016 14:35:30 +0000 (-0400) Subject: [4239] Addressed review comments X-Git-Tag: trac4106_update_base~38^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f11622185959ee69fef152b60ef12aa0c6fadd31;p=thirdparty%2Fkea.git [4239] Addressed review comments src/lib/dhcpsrv/pgsql_lease_mgr.cc Amended commentary for getColumnValue() variants Added decription of Uiaid union Changed std::system to ::system src/lib/dhcpsrv/testutils/mysql_schema.cc Changed std::system to ::system src/lib/dhcpsrv/testutils/mysql_schema.h Fixed typo src/lib/dhcpsrv/testutils/pgsql_schema.cc Removed extraneous include Changed std::system to ::system --- diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index 2691a619d3..40695e5446 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -417,7 +417,7 @@ public: return (value); } - /// @brief Converts a column in a row in a result set to a boolean. + /// @brief Fetches boolean text ('t' or 'f') as a bool. /// /// @param r the result set containing the query results /// @param row the row number within the result set @@ -440,7 +440,7 @@ public: } } - /// @brief Converts a column in a row in a result set to a uint32_t. + /// @brief Fetches an integer text column as a uint32_t. /// /// @param r the result set containing the query results /// @param row the row number within the result set @@ -461,7 +461,7 @@ public: } } - /// @brief Converts a column in a row in a result set to a int32_t. + /// @brief Fetches an integer text column as a int32_t. /// /// @param r the result set containing the query results /// @param row the row number within the result set @@ -482,7 +482,7 @@ public: } } - /// @brief Converts a column in a row in a result set to a uint8_t. + /// @brief Fetches an integer text column as a uint8_t. /// /// @param r the result set containing the query results /// @param row the row number within the result set @@ -505,7 +505,7 @@ public: } } - /// @brief Converts a column in a row in a result set to a Lease6::Type + /// @brief Fetches an integer text column as a Lease6::Type /// /// @param r the result set containing the query results /// @param row the row number within the result set @@ -1014,6 +1014,12 @@ private: vector duid_; uint8_t duid_buffer_[DUID::MAX_DUID_LEN]; + /// @brief Union for marshalling IAID into and out of the database + /// IAID is defined in the RFC as 4 octets, which Kea code handles as + /// a uint32_t. Postgresql however, offers only signed integer types + /// of sizes 2, 4, and 8 bytes (SMALLINT, INT, and BIGINT respectively). + /// IAID is used in several indexes so rather than use the BIGINT, we + /// use this union to safely move the value into and out of an INT column. union Uiaid { Uiaid(uint32_t val) : uval_(val){}; Uiaid(int32_t val) : ival_(val){}; diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc index 4fd78815a8..8620df3543 100644 --- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014-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 diff --git a/src/lib/dhcpsrv/testutils/mysql_schema.cc b/src/lib/dhcpsrv/testutils/mysql_schema.cc index dc2e15ad0b..a216e4f49e 100644 --- a/src/lib/dhcpsrv/testutils/mysql_schema.cc +++ b/src/lib/dhcpsrv/testutils/mysql_schema.cc @@ -52,7 +52,7 @@ void runMySQLScript(const std::string& path, const std::string& script_name, cmd << script_name; - int retval = std::system(cmd.str().c_str()); + int retval = ::system(cmd.str().c_str()); ASSERT_EQ(0, retval) << "runMySQLSchema failed:" << cmd.str(); } diff --git a/src/lib/dhcpsrv/testutils/mysql_schema.h b/src/lib/dhcpsrv/testutils/mysql_schema.h index cb95fe2bc9..d0665eb46a 100644 --- a/src/lib/dhcpsrv/testutils/mysql_schema.h +++ b/src/lib/dhcpsrv/testutils/mysql_schema.h @@ -48,7 +48,7 @@ void destroyMySQLSchema(bool show_err = false); /// @param show_err flag which governs whether or not stderr is suppressed. void createMySQLSchema(bool show_err = false); -/// @brief Run a MySQL SQL script against the Postgresql unit test database +/// @brief Run a MySQL SQL script against the MySQL unit test database /// /// Submits the given SQL script to MySQL via mysql CLI. The output of /// stderr is suppressed unless the parameter, show_err is true. The is done diff --git a/src/lib/dhcpsrv/testutils/pgsql_schema.cc b/src/lib/dhcpsrv/testutils/pgsql_schema.cc index 9d959515ae..beb80deef0 100644 --- a/src/lib/dhcpsrv/testutils/pgsql_schema.cc +++ b/src/lib/dhcpsrv/testutils/pgsql_schema.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -56,7 +55,7 @@ void runPgSQLScript(const std::string& path, const std::string& script_name, cmd << " 2>/dev/null "; } - int retval = std::system(cmd.str().c_str()); + int retval = ::system(cmd.str().c_str()); ASSERT_EQ(0, retval) << "runPgSQLSchema failed:" << cmd.str(); } diff --git a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql index 6ddd373ee5..a849710b24 100644 --- a/src/share/database/scripts/pgsql/dhcpdb_create.pgsql +++ b/src/share/database/scripts/pgsql/dhcpdb_create.pgsql @@ -1,4 +1,4 @@ --- Copyright (C) 2012-2015 Internet Systems Consortium. +-- Copyright (C) 2012-2016 Internet Systems Consortium. -- 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