From: Remi Gacogne Date: Tue, 10 Apr 2018 12:42:33 +0000 (+0200) Subject: auth: Allocate new statements after reconnecting to PostgreSQL X-Git-Tag: dnsdist-1.3.1~164^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6464%2Fhead;p=thirdparty%2Fpdns.git auth: Allocate new statements after reconnecting to PostgreSQL --- diff --git a/modules/gpgsqlbackend/gpgsqlbackend.cc b/modules/gpgsqlbackend/gpgsqlbackend.cc index 5396878b9f..3bd73a95ae 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.cc +++ b/modules/gpgsqlbackend/gpgsqlbackend.cc @@ -60,6 +60,8 @@ void gPgSQLBackend::reconnect() if (d_db) { d_db->reconnect(); + + allocateStatements(); } } diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index cd591076f0..4540a4773b 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -52,6 +52,13 @@ public: d_db=db; if (d_db) { d_db->setLog(::arg().mustDo("query-logging")); + allocateStatements(); + } + } + + void allocateStatements() + { + if (d_db) { d_NoIdQuery_stmt = d_db->prepare(d_NoIdQuery, 2); d_IdQuery_stmt = d_db->prepare(d_IdQuery, 3); d_ANYNoIdQuery_stmt = d_db->prepare(d_ANYNoIdQuery, 1);