summaryrefslogtreecommitdiff
path: root/libpqpp/pq-connection.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-04 17:54:29 +0000
committerDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-01-04 17:54:29 +0000
commitd6e8b1c5a787641dc63fc50c9b35cc7427a33b65 (patch)
tree55e450e83034a97d685a93779c939573f1c2b41c /libpqpp/pq-connection.cpp
parentUse bulk select not cursor select for getId, far fewer operations (diff)
downloadlibdbpp-postgresql-d6e8b1c5a787641dc63fc50c9b35cc7427a33b65.tar.bz2
libdbpp-postgresql-d6e8b1c5a787641dc63fc50c9b35cc7427a33b65.tar.xz
libdbpp-postgresql-d6e8b1c5a787641dc63fc50c9b35cc7427a33b65.zip
Add PQ specific command options to control page size and the use of bulk -v- cursor selects
Diffstat (limited to 'libpqpp/pq-connection.cpp')
-rw-r--r--libpqpp/pq-connection.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp
index 1fadde3..5b560a9 100644
--- a/libpqpp/pq-connection.cpp
+++ b/libpqpp/pq-connection.cpp
@@ -99,11 +99,11 @@ PQ::Connection::ping() const
DB::SelectCommand *
PQ::Connection::newSelectCommand(const std::string & sql, const DB::CommandOptions * opts)
{
- // Yes, this is a hack
- if (sql.find("libdbpp:no-cursor") != (std::string::size_type)-1) {
+ auto pqco = dynamic_cast<const CommandOptions *>(opts);
+ if (pqco && !pqco->useCursor) {
return new BulkSelectCommand(this, sql, pstmntNo++, opts);
}
- return new CursorSelectCommand(this, sql, pstmntNo++);
+ return new CursorSelectCommand(this, sql, pstmntNo++, pqco);
}
DB::ModifyCommand *