summaryrefslogtreecommitdiff
path: root/libpqpp/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/unittests')
-rw-r--r--libpqpp/unittests/testpq.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp
index 476c3a2..cfe7b11 100644
--- a/libpqpp/unittests/testpq.cpp
+++ b/libpqpp/unittests/testpq.cpp
@@ -112,13 +112,18 @@ BOOST_AUTO_TEST_CASE( selectInTx )
{
auto db = DB::MockDatabase::openConnectionTo("PQmock");
- auto select = db->newSelectCommand("SELECT * FROM test");
- while (select->fetch()) { }
- delete select;
+ // Loop to ensure we can create the same statement several times
+ for (int x = 0; x < 2; x++) {
+ auto select = db->select("SELECT * FROM test");
+ // Loop to ensure we can use the same command several times
+ for (int y = 0; y < 2; y++) {
+ while (select->fetch()) { }
+ }
+ }
db->finish();
db->beginTx();
- select = db->newSelectCommand("SELECT * FROM test");
+ auto select = db->newSelectCommand("SELECT * FROM test");
while (select->fetch()) { }
delete select;
db->commitTx();