summaryrefslogtreecommitdiff
path: root/libpqpp/pq-cursorselectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-01 13:52:39 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-01 13:52:39 +0100
commit55b8c97ae06dd7902d3dc47eece04890ecaf30bc (patch)
tree0b978c58516dfe1ca74c0ac12807267728b93b85 /libpqpp/pq-cursorselectcommand.cpp
parentAdd a test case for a genuine large binary object (the memmapped test binary) (diff)
downloadlibdbpp-postgresql-55b8c97ae06dd7902d3dc47eece04890ecaf30bc.tar.bz2
libdbpp-postgresql-55b8c97ae06dd7902d3dc47eece04890ecaf30bc.tar.xz
libdbpp-postgresql-55b8c97ae06dd7902d3dc47eece04890ecaf30bc.zip
Transactionless cursor selects
Remove the need to open a transaction for a cursor select by specifying them as WITH HOLD. Also add NO SCROLL as it's a feature we don't actually use. Updates tests with loops to ensure we haven't broken the ability to re-use / re-create statements.
Diffstat (limited to 'libpqpp/pq-cursorselectcommand.cpp')
-rw-r--r--libpqpp/pq-cursorselectcommand.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp
index 2b639c8..53d951a 100644
--- a/libpqpp/pq-cursorselectcommand.cpp
+++ b/libpqpp/pq-cursorselectcommand.cpp
@@ -3,7 +3,7 @@
#include "pq-error.h"
#include <compileTimeFormatter.h>
-AdHocFormatter(PQCursorSelectDeclare, "DECLARE %? CURSOR FOR ");
+AdHocFormatter(PQCursorSelectDeclare, "DECLARE %? NO SCROLL CURSOR WITH HOLD FOR ");
AdHocFormatter(PQCursorSelectFetch, "FETCH %? IN %?");
AdHocFormatter(PQCursorSelectClose, "CLOSE %?");
@@ -12,7 +12,6 @@ PQ::CursorSelectCommand::CursorSelectCommand(Connection * conn, const std::strin
PQ::SelectBase(sql, pqco),
PQ::Command(conn, sql, opts),
executed(false),
- txOpened(false),
fTuples(pqco ? pqco->fetchTuples : 35),
s_fetch(PQCursorSelectFetch::get(fTuples, stmntName)),
s_close(PQCursorSelectClose::get(stmntName))
@@ -24,9 +23,6 @@ PQ::CursorSelectCommand::~CursorSelectCommand()
if (executed && PQtransactionStatus(c->conn) != PQTRANS_INERROR) {
c->checkResultFree((PQexec(c->conn, s_close.c_str())), PGRES_COMMAND_OK);
}
- if (txOpened) {
- c->commitTx();
- }
}
std::string
@@ -42,10 +38,6 @@ void
PQ::CursorSelectCommand::execute()
{
if (!executed) {
- if (!c->inTx()) {
- c->beginTx();
- txOpened = true;
- }
if (s_declare.empty()) {
s_declare = mkdeclare();
}