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/selectcommand.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libpqpp/selectcommand.cpp') diff --git a/libpqpp/selectcommand.cpp b/libpqpp/selectcommand.cpp index da12331..cc92540 100644 --- a/libpqpp/selectcommand.cpp +++ b/libpqpp/selectcommand.cpp @@ -12,13 +12,12 @@ PQ::SelectCommand::SelectCommand(const Connection * conn, const std::string & sq tuple(0), execRes(NULL) { - c->beginTx(); } PQ::SelectCommand::~SelectCommand() { - c->commitTx(); if (executed) { + c->commitTx(); PQclear(PQexec(c->conn, ("CLOSE " + stmntName).c_str())); if (execRes) { PQclear(execRes); @@ -54,6 +53,7 @@ PQ::SelectCommand::execute() psql += *i; } } + c->beginTx(); c->checkResultFree( PQexecParams(c->conn, psql.c_str(), values.size(), NULL, &values.front(), &lengths.front(), &formats.front(), 0), PGRES_COMMAND_OK); -- cgit v1.2.3