diff options
author | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-01-04 17:54:29 +0000 |
---|---|---|
committer | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-01-04 17:54:29 +0000 |
commit | 78c885ff3bcbb9c7e16f3fce29f1d0052aba3086 (patch) | |
tree | f67125295122714c8a0ad14e2f5a277e130dfd2a /libpqpp/unittests | |
parent | Use bulk select not cursor select for getId, far fewer operations (diff) | |
download | libdbpp-postgresql-78c885ff3bcbb9c7e16f3fce29f1d0052aba3086.tar.bz2 libdbpp-postgresql-78c885ff3bcbb9c7e16f3fce29f1d0052aba3086.tar.xz libdbpp-postgresql-78c885ff3bcbb9c7e16f3fce29f1d0052aba3086.zip |
Add PQ specific command options to control page size and the use of bulk -v- cursor selects
Diffstat (limited to 'libpqpp/unittests')
-rw-r--r-- | libpqpp/unittests/testpq.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp index 15ea022..f7c327f 100644 --- a/libpqpp/unittests/testpq.cpp +++ b/libpqpp/unittests/testpq.cpp @@ -11,6 +11,7 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <pq-error.h> #include <pq-connection.h> +#include <pq-command.h> #include <selectcommandUtil.impl.h> class StandardMockDatabase : public PQ::Mock { @@ -291,7 +292,8 @@ BOOST_AUTO_TEST_CASE( statementReuse ) BOOST_AUTO_TEST_CASE( bulkSelect ) { auto ro = DB::MockDatabase::openConnectionTo("PQmock"); - auto sel = ro->newSelectCommand("SELECT * FROM test WHERE id > ? --libdbpp:no-cursor"); + PQ::CommandOptions co(0, 35, false); + auto sel = ro->newSelectCommand("SELECT * FROM test WHERE id > ?", &co); sel->bindParamI(0, 1); int totalInt = 0, count = 0; sel->forEachRow<int64_t>([&totalInt, &count](auto i) { @@ -307,7 +309,8 @@ BOOST_AUTO_TEST_CASE( bulkSelect ) BOOST_AUTO_TEST_CASE( insertReturning ) { auto ro = DB::MockDatabase::openConnectionTo("PQmock"); - auto sel = ro->newSelectCommand("INSERT INTO test(id, fl) VALUES(1, 3) RETURNING id + fl --libdbpp:no-cursor"); + PQ::CommandOptions co(0, 35, false); + auto sel = ro->newSelectCommand("INSERT INTO test(id, fl) VALUES(1, 3) RETURNING id + fl", &co); int totalInt = 0, count = 0; sel->forEachRow<int64_t>([&totalInt, &count](auto i) { totalInt += i; |