summaryrefslogtreecommitdiff
path: root/libpqpp/pq-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 15:47:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 15:47:33 +0100
commit4076ca685941ac433bc91130e29449cef7858fba (patch)
tree5b219bd316ca89c72a0fa361da849214f312699a /libpqpp/pq-connection.cpp
parentIntroduce select base for different kinds of select (diff)
downloadlibdbpp-postgresql-4076ca685941ac433bc91130e29449cef7858fba.tar.bz2
libdbpp-postgresql-4076ca685941ac433bc91130e29449cef7858fba.tar.xz
libdbpp-postgresql-4076ca685941ac433bc91130e29449cef7858fba.zip
Support bulk selects which don't use cursors, always use of RETURNING
Diffstat (limited to 'libpqpp/pq-connection.cpp')
-rw-r--r--libpqpp/pq-connection.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp
index 49867a4..078272e 100644
--- a/libpqpp/pq-connection.cpp
+++ b/libpqpp/pq-connection.cpp
@@ -1,5 +1,6 @@
#include "pq-connection.h"
#include "pq-error.h"
+#include "pq-bulkselectcommand.h"
#include "pq-cursorselectcommand.h"
#include "pq-modifycommand.h"
#include <unistd.h>
@@ -97,6 +98,10 @@ PQ::Connection::ping() const
DB::SelectCommand *
PQ::Connection::newSelectCommand(const std::string & sql)
{
+ // Yes, this is a hack
+ if (sql.find("libdbpp:no-cursor") != (std::string::size_type)-1) {
+ return new BulkSelectCommand(this, sql, pstmntNo++);
+ }
return new CursorSelectCommand(this, sql, pstmntNo++);
}