Parcourir la source

[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
Thomas Markwalder il y a 9 ans
Parent
commit
f116221859

+ 11 - 5
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<uint8_t> 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){};

+ 1 - 1
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

+ 1 - 1
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();
 }
 

+ 1 - 1
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

+ 1 - 2
src/lib/dhcpsrv/testutils/pgsql_schema.cc

@@ -6,7 +6,6 @@
 
 #include <config.h>
 #include <string>
-#include <mysql.h>
 #include <dhcpsrv/testutils/pgsql_schema.h>
 
 #include <gtest/gtest.h>
@@ -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();
 }
 

+ 1 - 0
src/share/database/scripts/pgsql/dhcpdb_create.pgsql

@@ -1,4 +1,4 @@
+-- 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