]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
fixed unittests
authorRazvan Becheriu <razvan@isc.org>
Thu, 24 Oct 2019 16:05:04 +0000 (19:05 +0300)
committerRazvan Becheriu <razvan@isc.org>
Wed, 6 Nov 2019 17:32:51 +0000 (19:32 +0200)
src/lib/mysql/mysql_connection.cc
src/lib/mysql/mysql_connection.h
src/lib/pgsql/pgsql_connection.cc

index a40aafa75a836728d15acd91cb8a7601227fd4ec..a908508e04a4c3fc61e9832ed2a4be83e6ce20d7 100644 (file)
@@ -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
index 118e388fdf724f5c89f6aee2dcf212308d7d8796..da6eeff71fb5de40be73569fe70cda2e5ce6a7d4 100644 (file)
@@ -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
index b311b366502d31716bc70b34f2ea2a58b8ff0618..a2d7e6c56ed7c51cc736378981f1399446b1cf1c 100644 (file)
@@ -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: "