]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1008] Changed getVersion for the host (vs lease) code
authorFrancis Dupont <fdupont@isc.org>
Tue, 3 Dec 2019 22:19:17 +0000 (23:19 +0100)
committerFrancis Dupont <fdupont@isc.org>
Wed, 4 Dec 2019 13:33:09 +0000 (14:33 +0100)
src/lib/dhcpsrv/pgsql_host_data_source.cc
src/lib/pgsql/pgsql_connection.cc

index 1bbc741daaea0fd34dd65700f58967a9ca643a60..692d71ce3d246d072c314e9de69d98c2cea7cfdd 100644 (file)
@@ -1442,7 +1442,7 @@ public:
     ///        has failed.
     std::pair<uint32_t, uint32_t> getVersion() const;
 
-    /// @Brief Pointer to the object representing an exchange which
+    /// @brief Pointer to the object representing an exchange which
     /// can be used to retrieve hosts and DHCPv4 options.
     boost::shared_ptr<PgSqlHostWithOptionsExchange> host_exchange_;
 
index 99dd0f080848e0d42f5bb5cc048070bfa22b04c7..7391ae098e2561c2c86c3ada53a8f2ab6c6786eb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 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
@@ -8,6 +8,7 @@
 
 #include <database/db_log.h>
 #include <pgsql/pgsql_connection.h>
+#include <pgsql/pgsql_exchange.h>
 
 // PostgreSQL errors should be tested based on the SQL state code.  Each state
 // code is 5 decimal, ASCII, digits, the first two define the category of
@@ -144,16 +145,11 @@ PgSqlConnection::getVersion(const ParameterMap& parameters) {
                   << version_sql << ", reason: " << PQerrorMessage(conn.conn_));
     }
 
-    istringstream tmp;
     uint32_t version;
-    tmp.str(PQgetvalue(r, 0, 0));
-    tmp >> version;
-    tmp.str("");
-    tmp.clear();
+    PgSqlExchange::getColumnValue(r, 0, 0, version);
 
     uint32_t minor;
-    tmp.str(PQgetvalue(r, 0, 1));
-    tmp >> minor;
+    PgSqlExchange::getColumnValue(r, 0, 1, minor);
 
     return (make_pair(version, minor));
 }