From a725c0b29f56bd25c5c0b836858604c3a002d6cb Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 2 May 2015 02:43:59 +0100 Subject: Assert the row in the init script --- project2/sql/unittests/testpq.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/project2/sql/unittests/testpq.cpp b/project2/sql/unittests/testpq.cpp index 03ae252..9d2367e 100644 --- a/project2/sql/unittests/testpq.cpp +++ b/project2/sql/unittests/testpq.cpp @@ -89,5 +89,27 @@ BOOST_AUTO_TEST_CASE( bindAndSelect ) ds->close(); } +BOOST_AUTO_TEST_CASE( bindAndSelectOther ) +{ + RdbmsDataSource * ds = CommonObjects::dataSource("pqmock"); + auto ro = ds->getReadonly(); + + auto select = ro->newSelectCommand("SELECT * FROM test WHERE id != ?"); + select->bindParamI(0, testInt); + select->execute(); + int rows = 0; + while (select->fetch()) { + assertColumnValueHelper(*select, 0, 4); + assertColumnValueHelper(*select, 1, 123.45); + assertColumnValueHelper(*select, 2, std::string("some text")); + assertColumnValueHelper(*select, 3, boost::posix_time::ptime_from_tm({ 3, 6, 23, 27, 3, 115, 0, 0, 0, 0, 0})); + assertColumnValueHelper(*select, 4, boost::posix_time::time_duration(38, 13, 12)); + rows += 1; + } + delete select; + BOOST_REQUIRE_EQUAL(1, rows); + ds->close(); +} + BOOST_AUTO_TEST_SUITE_END(); -- cgit v1.2.3