From e21e9fcc7f4f4fdcae52ed03448adab8484f6c52 Mon Sep 17 00:00:00 2001 From: Christian Hofstaedtler Date: Sat, 21 Jan 2017 23:13:57 +0100 Subject: [PATCH] gpgsql: make statement names actually unique --- modules/gpgsqlbackend/spgsql.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/gpgsqlbackend/spgsql.cc b/modules/gpgsqlbackend/spgsql.cc index ed80d4c53b..ca698adcbc 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)); -- 2.47.2