]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1008] Updated pgsql_host_data_source.cc (2)
authorFrancis Dupont <fdupont@isc.org>
Tue, 3 Dec 2019 10:05:22 +0000 (11:05 +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

index d23516927d31c2254bcb0e1fdd58fba6e1f50c8f..1bbc741daaea0fd34dd65700f58967a9ca643a60 100644 (file)
@@ -2123,20 +2123,7 @@ getHost(const SubnetID& subnet_id,
 std::pair<uint32_t, uint32_t> PgSqlHostDataSourceImpl::getVersion() const {
     LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL,
               DHCPSRV_PGSQL_HOST_DB_GET_VERSION);
-    const char* version_sql =  "SELECT version, minor FROM schema_version;";
-    PgSqlResult r(PQexec(conn_, version_sql));
-    if(PQresultStatus(r) != PGRES_TUPLES_OK) {
-        isc_throw(DbOperationError, "unable to execute PostgreSQL statement <"
-                  << version_sql << ">, reason: " << PQerrorMessage(conn_));
-    }
-
-    uint32_t version;
-    PgSqlExchange::getColumnValue(r, 0, 0, version);
-
-    uint32_t minor;
-    PgSqlExchange::getColumnValue(r, 0, 1, minor);
-
-    return (std::make_pair(version, minor));
+    return (PgSqlConnection::getVersion(parameters_));
 }
 
 void