From: Christian Hofstaedtler Date: Sat, 21 Jan 2017 22:13:57 +0000 (+0100) Subject: gpgsql: make statement names actually unique X-Git-Tag: auth-4.0.5~1^2~28^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bd82a1f0f5f050a824007937f5bc50eea4c4823;p=thirdparty%2Fpdns.git gpgsql: make statement names actually unique (cherry picked from commit e21e9fcc7f4f4fdcae52ed03448adab8484f6c52) --- diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index 96eda6c5db..856a365a08 100644 --- a/modules/gpgsqlbackend/spgsql.cc +++ b/modules/gpgsqlbackend/spgsql.cc @@ -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));