summaryrefslogtreecommitdiff
path: root/libpqpp/pq-selectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-02-19 21:25:02 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2016-02-19 21:25:02 +0000
commit0bf706059f8a6df882cac3d6e7e976f4432b4271 (patch)
tree69d6641af24d31227ed616bf9c0c9ee1f27ea167 /libpqpp/pq-selectcommand.cpp
parentBuild most things by default (diff)
downloadlibdbpp-postgresql-0bf706059f8a6df882cac3d6e7e976f4432b4271.tar.bz2
libdbpp-postgresql-0bf706059f8a6df882cac3d6e7e976f4432b4271.tar.xz
libdbpp-postgresql-0bf706059f8a6df882cac3d6e7e976f4432b4271.zip
Refactor to use std::string as buffer and increase test coverage
Diffstat (limited to 'libpqpp/pq-selectcommand.cpp')
-rw-r--r--libpqpp/pq-selectcommand.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpqpp/pq-selectcommand.cpp b/libpqpp/pq-selectcommand.cpp
index 55dc02c..f8f44fd 100644
--- a/libpqpp/pq-selectcommand.cpp
+++ b/libpqpp/pq-selectcommand.cpp
@@ -21,6 +21,9 @@ PQ::SelectCommand::SelectCommand(Connection * conn, const std::string & sql, uns
PQ::SelectCommand::~SelectCommand()
{
+ if (execRes) {
+ PQclear(execRes);
+ }
if (executed) {
c->checkResultFree((PQexec(c->conn, s_close.c_str())), PGRES_COMMAND_OK);
}
@@ -66,7 +69,7 @@ PQ::SelectCommand::execute()
txOpened = true;
}
execRes = c->checkResult(
- PQexecParams(c->conn, s_declare.c_str(), values.size(), NULL, &values.front(), &lengths.front(), &formats.front(), 0),
+ PQexecParams(c->conn, s_declare.c_str(), values.size(), NULL, &values.front(), &lengths.front(), NULL, 0),
PGRES_COMMAND_OK);
fetchTuples();
unsigned int nFields = PQnfields(execRes);