]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
gpgsql: make statement names actually unique
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Sat, 21 Jan 2017 22:13:57 +0000 (23:13 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 7 Nov 2017 20:25:06 +0000 (21:25 +0100)
(cherry picked from commit e21e9fcc7f4f4fdcae52ed03448adab8484f6c52)

modules/gpgsqlbackend/spgsql.cc

index 96eda6c5db669083288ff00c455a39a6efdc6476..856a365a0859607ecf8107a94aa0b961dcc92815 100644 (file)
@@ -218,11 +218,9 @@ private:
   }
 
   void prepareStatement() {
-    struct timeval tv;
     if (d_prepared) return;
-    // prepare a statement
-    gettimeofday(&tv,NULL);
-    this->d_stmt = string("stmt") + std::to_string(tv.tv_sec) + std::to_string(tv.tv_usec);
+    // prepare a statement; name must be unique per session.
+    this->d_stmt = string("stmt") + std::to_string((uintptr_t)this);
     PGresult* res = PQprepare(d_db(), d_stmt.c_str(), d_query.c_str(), d_nparams, NULL);
     ExecStatusType status = PQresultStatus(res);
     string errmsg(PQresultErrorMessage(res));