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
commit6340b06110c35b92bfcc780e85537ca5a752a58c (patch)
tree90e66849ef16ee7fac3ae0d00900ae684996002c /libpqpp/pq-connection.cpp
parentIntroduce select base for different kinds of select (diff)
downloadlibdbpp-postgresql-6340b06110c35b92bfcc780e85537ca5a752a58c.tar.bz2
libdbpp-postgresql-6340b06110c35b92bfcc780e85537ca5a752a58c.tar.xz
libdbpp-postgresql-6340b06110c35b92bfcc780e85537ca5a752a58c.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++);
}