summaryrefslogtreecommitdiff
path: root/libpqpp/selectcommand.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-01-27 00:02:16 +0000
committerrandomdan <randomdan@localhost>2013-01-27 00:02:16 +0000
commit67cd4ca02d2581e8498c44bb640ea923a4ddc553 (patch)
tree0ee2e936d58e2064ff9b795ec96612212d0676cf /libpqpp/selectcommand.cpp
parentDefault to string binding instead of throwing an error (diff)
downloadlibdbpp-postgresql-67cd4ca02d2581e8498c44bb640ea923a4ddc553.tar.bz2
libdbpp-postgresql-67cd4ca02d2581e8498c44bb640ea923a4ddc553.tar.xz
libdbpp-postgresql-67cd4ca02d2581e8498c44bb640ea923a4ddc553.zip
Fix issues with PQ connection errors not being handled correctly
Diffstat (limited to 'libpqpp/selectcommand.cpp')
-rw-r--r--libpqpp/selectcommand.cpp4
1 files changed, 2 insertions, 2 deletions
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);