Commit 0636627e authored by Francis Dupont's avatar Francis Dupont

[#1008] Changed getVersion for the host (vs lease) code

parent 4dedcad7
......@@ -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_;
......
// 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));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment