diff options
Diffstat (limited to 'libpqpp/connection.cpp')
-rw-r--r-- | libpqpp/connection.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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(); + } + } } |