From 67cd4ca02d2581e8498c44bb640ea923a4ddc553 Mon Sep 17 00:00:00 2001 From: randomdan Date: Sun, 27 Jan 2013 00:02:16 +0000 Subject: Fix issues with PQ connection errors not being handled correctly --- libpqpp/connection.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libpqpp/connection.cpp') diff --git a/libpqpp/connection.cpp b/libpqpp/connection.cpp index d07b9d2..7c26ecb 100644 --- a/libpqpp/connection.cpp +++ b/libpqpp/connection.cpp @@ -89,6 +89,15 @@ PQ::Connection::bulkUpdateStyle() const void PQ::Connection::ping() const { + if (PQstatus(conn) != CONNECTION_OK) { + if (inTx()) { + throw ConnectionError(); + } + PQreset(conn); + if (PQstatus(conn) != CONNECTION_OK) { + throw ConnectionError(); + } + } } -- cgit v1.2.3