summaryrefslogtreecommitdiff
path: root/libpqpp/unittests/testpq.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-17 22:11:44 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-17 22:11:44 +0100
commit576e4b9894157341815ca48cb8317b71499f82df (patch)
tree3f3959304b6172116006779cccb3c1d02b111dc2 /libpqpp/unittests/testpq.cpp
parentAdd override attributes (diff)
downloadlibdbpp-postgresql-576e4b9894157341815ca48cb8317b71499f82df.tar.bz2
libdbpp-postgresql-576e4b9894157341815ca48cb8317b71499f82df.tar.xz
libdbpp-postgresql-576e4b9894157341815ca48cb8317b71499f82df.zip
Add support for getting last insert value
Diffstat (limited to 'libpqpp/unittests/testpq.cpp')
-rw-r--r--libpqpp/unittests/testpq.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp
index 3942cfd..cf366cb 100644
--- a/libpqpp/unittests/testpq.cpp
+++ b/libpqpp/unittests/testpq.cpp
@@ -155,5 +155,17 @@ BOOST_AUTO_TEST_CASE( bigIterate )
delete ro;
}
+BOOST_AUTO_TEST_CASE( insertId )
+{
+ auto ro = DB::MockDatabase::openConnectionTo("pqmock");
+ auto ins = ro->newModifyCommand("INSERT INTO idtest(foo) VALUES(1)");
+ for (int x = 1; x < 4; x++) {
+ ins->execute();
+ BOOST_REQUIRE_EQUAL(x, ro->insertId());
+ }
+ delete ins;
+ delete ro;
+}
+
BOOST_AUTO_TEST_SUITE_END();