summaryrefslogtreecommitdiff
path: root/libpqpp/pq-selectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-01-10 17:53:38 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-01-10 17:53:38 +0000
commitc6e4e34be7d09c39357e25dc0ac7e6ffd2e4d9e5 (patch)
tree24c7e9372e5e371a2a4be304f10f4008749f927f /libpqpp/pq-selectcommand.cpp
parentOnly open select transactions when the connection doesn't already have one (diff)
downloadlibdbpp-postgresql-c6e4e34be7d09c39357e25dc0ac7e6ffd2e4d9e5.tar.bz2
libdbpp-postgresql-c6e4e34be7d09c39357e25dc0ac7e6ffd2e4d9e5.tar.xz
libdbpp-postgresql-c6e4e34be7d09c39357e25dc0ac7e6ffd2e4d9e5.zip
Close select tx after close cursor, add error checkinglibdbpp-postgresql-1.0.2
Diffstat (limited to 'libpqpp/pq-selectcommand.cpp')
-rw-r--r--libpqpp/pq-selectcommand.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/libpqpp/pq-selectcommand.cpp b/libpqpp/pq-selectcommand.cpp
index 6c02fc4..55dc02c 100644
--- a/libpqpp/pq-selectcommand.cpp
+++ b/libpqpp/pq-selectcommand.cpp
@@ -21,15 +21,12 @@ PQ::SelectCommand::SelectCommand(Connection * conn, const std::string & sql, uns
PQ::SelectCommand::~SelectCommand()
{
+ if (executed) {
+ c->checkResultFree((PQexec(c->conn, s_close.c_str())), PGRES_COMMAND_OK);
+ }
if (txOpened) {
c->commitTx();
}
- if (executed) {
- PQclear(PQexec(c->conn, s_close.c_str()));
- if (execRes) {
- PQclear(execRes);
- }
- }
}
std::string