summaryrefslogtreecommitdiff
path: root/libpqpp/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/connection.cpp')
-rw-r--r--libpqpp/connection.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpqpp/connection.cpp b/libpqpp/connection.cpp
index e47d846..57531e3 100644
--- a/libpqpp/connection.cpp
+++ b/libpqpp/connection.cpp
@@ -26,7 +26,9 @@ PQ::Connection::Connection(const std::string & info) :
rolledback(false)
{
if (PQstatus(conn) != CONNECTION_OK) {
- throw ConnectionError(conn);
+ ConnectionError ce(conn);
+ PQfinish(conn);
+ throw ce;
}
PQsetNoticeProcessor(conn, noNoticeProcessor, NULL);
}