From: Christian Hofstaedtler Date: Sat, 21 Jan 2017 22:13:57 +0000 (+0100) Subject: gpgsql: make statement names actually unique X-Git-Tag: rec-4.1.0-alpha1~218^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e21e9fcc7f4f4fdcae52ed03448adab8484f6c52;p=pdns gpgsql: make statement names actually unique --- diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index ed80d4c53..ca698adcb 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -214,11 +214,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));