From: Francis Dupont Date: Tue, 3 Dec 2019 10:00:47 +0000 (+0100) Subject: [#1008] Updated pgsql_host_data_source.cc X-Git-Tag: tmark-perf-12-12-2019~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc89967b43751d79a2d7dc70d48bc4aec9669282;p=thirdparty%2Fkea.git [#1008] Updated pgsql_host_data_source.cc --- diff --git a/src/lib/dhcpsrv/pgsql_host_data_source.cc b/src/lib/dhcpsrv/pgsql_host_data_source.cc index 7ea6f61e6b..d23516927d 100644 --- a/src/lib/dhcpsrv/pgsql_host_data_source.cc +++ b/src/lib/dhcpsrv/pgsql_host_data_source.cc @@ -1442,7 +1442,7 @@ public: /// has failed. std::pair 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 host_exchange_; @@ -1464,6 +1464,9 @@ public: /// or dhcp6_options table. boost::shared_ptr host_option_exchange_; + /// @brief The parameters + PgSqlConnection::ParameterMap parameters_; + /// @brief PgSQL connection PgSqlConnection conn_; @@ -1913,12 +1916,10 @@ PgSqlHostDataSourceImpl(const PgSqlConnection::ParameterMap& parameters) DHCP4_AND_DHCP6)), host_ipv6_reservation_exchange_(new PgSqlIPv6ReservationExchange()), host_option_exchange_(new PgSqlOptionExchange()), + parameters_(parameters), conn_(parameters), is_readonly_(false) { - // Open the database. - conn_.openDatabase(); - // Validate the schema version first. std::pair code_version(PG_SCHEMA_VERSION_MAJOR, PG_SCHEMA_VERSION_MINOR); @@ -1931,6 +1932,9 @@ PgSqlHostDataSourceImpl(const PgSqlConnection::ParameterMap& parameters) << db_version.second); } + // Open the database. + conn_.openDatabase(); + // Now prepare the SQL statements. conn_.prepareStatements(tagged_statements.begin(), tagged_statements.begin() + WRITE_STMTS_BEGIN);