From: Razvan Becheriu Date: Thu, 24 Oct 2019 16:05:04 +0000 (+0300) Subject: fixed unittests X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a7a6321211c84fcb6aefcefeb769fb984e916a8;p=thirdparty%2Fkea.git fixed unittests --- diff --git a/src/lib/mysql/mysql_connection.cc b/src/lib/mysql/mysql_connection.cc index a40aafa75a..a908508e04 100644 --- a/src/lib/mysql/mysql_connection.cc +++ b/src/lib/mysql/mysql_connection.cc @@ -25,6 +25,10 @@ namespace db { bool MySqlHolder::atexit_ = []{atexit([]{mysql_library_end();});return true;}; +void +MySqlHolder::doNothing() { +} + void MySqlHolder::setConnection(MYSQL* connection) { // clear prepared statements associated to current connection diff --git a/src/lib/mysql/mysql_connection.h b/src/lib/mysql/mysql_connection.h index 118e388fdf..da6eeff71f 100644 --- a/src/lib/mysql/mysql_connection.h +++ b/src/lib/mysql/mysql_connection.h @@ -98,6 +98,7 @@ public: /// Sets the MySql API connector handle to NULL. /// Push a call to mysql_library_end() at exit time. MySqlHolder() : connected_(false), prepared_(false), mysql_(NULL) { + doNothing(); } /// @brief Destructor diff --git a/src/lib/pgsql/pgsql_connection.cc b/src/lib/pgsql/pgsql_connection.cc index b311b36650..a2d7e6c56e 100644 --- a/src/lib/pgsql/pgsql_connection.cc +++ b/src/lib/pgsql/pgsql_connection.cc @@ -38,7 +38,6 @@ const int PGSQL_DEFAULT_CONNECTION_TIMEOUT = 5; // seconds const char PgSqlConnection::DUPLICATE_KEY[] = ERRCODE_UNIQUE_VIOLATION; void -<<<<<<< HEAD PgSqlHolder::setConnection(PGconn* connection) { // clear prepared statements associated to current connection clearPrepared(); @@ -57,10 +56,6 @@ PgSqlHolder::setConnection(PGconn* connection) { void PgSqlHolder::clearPrepared() { if (pgsql_ != NULL) { -======= -PgSqlHolder::clearPrepared() { - if (pgconn_ != NULL) { ->>>>>>> support reconfigure // Deallocate the prepared queries. if (PQstatus(pgsql_) == CONNECTION_OK) { PgSqlResult r(PQexec(pgsql_, "DEALLOCATE all")); @@ -73,17 +68,6 @@ PgSqlHolder::clearPrepared() { } } -void -PgSqlHolder::setConnection(PGconn* connection) { - clearPrepared(); - if (pgconn_ != NULL) { - PQfinish(pgconn_); - } - pgconn_ = connection; - connected_ = false; - prepared_ = false; -} - void PgSqlHolder::openDatabase(PgSqlConnection& connection) { // return if holder has already called openDatabase @@ -114,11 +98,7 @@ PgSqlHolder::prepareStatements(PgSqlConnection& connection) { // Prepare all statements queries with all known fields datatype for (auto it = connection.statements_.begin(); it != connection.statements_.end(); ++it) { -<<<<<<< HEAD PgSqlResult r(PQprepare(pgsql_, (*it)->name, (*it)->text, -======= - PgSqlResult r(PQprepare(pgconn_, (*it)->name, (*it)->text, ->>>>>>> support reconfigure (*it)->nbparams, (*it)->types)); if (PQresultStatus(r) != PGRES_COMMAND_OK) { isc_throw(DbOperationError, "unable to prepare PostgreSQL statement: "