summaryrefslogtreecommitdiff
path: root/libpqpp/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/unittests')
-rw-r--r--libpqpp/unittests/Jamfile.jam5
-rw-r--r--libpqpp/unittests/testpq.cpp16
2 files changed, 19 insertions, 2 deletions
diff --git a/libpqpp/unittests/Jamfile.jam b/libpqpp/unittests/Jamfile.jam
index 4e6cc23..7865882 100644
--- a/libpqpp/unittests/Jamfile.jam
+++ b/libpqpp/unittests/Jamfile.jam
@@ -15,9 +15,10 @@ run
<define>ROOT=\"$(me)\"
<define>BOOST_TEST_DYN_LINK
<library>..//dbpp-postgresql
- <library>dbpptestcore
+ <local-dbppcore>yes:<library>../../..//dbpptestcore
+ <local-dbppcore>no:<library>dbpptestcore
<library>adhocutil
- <library>../..//pq
+ <library>..//pq
<library>boost_utf
<library>stdc++fs
;
diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp
index e78a079..67ce07a 100644
--- a/libpqpp/unittests/testpq.cpp
+++ b/libpqpp/unittests/testpq.cpp
@@ -441,6 +441,22 @@ BOOST_AUTO_TEST_CASE( largeBlob )
}
}
+BOOST_AUTO_TEST_CASE( bulkPerfTest )
+{
+ auto ro = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("PQmock"));
+ auto sel = ro->select(R"SQL(select s a, cast(s as numeric(7,1)) b, cast(s as text) c,
+ make_interval(secs => s) d, make_timestamp(2019,1,1,1,1,1) + make_interval(mins=>s) e,
+ s % 2 = 0 f
+ from generate_series(1, 1000) s)SQL");
+
+ int64_t tot = 0;
+ for (const auto & [a,b,c,d,e,f] : sel->as<int64_t, double, std::string_view,
+ boost::posix_time::time_duration, boost::posix_time::ptime, bool>()) {
+ tot += a + b + c.length() + d.hours() + e.time_of_day().hours() + f;
+ }
+ BOOST_REQUIRE_EQUAL(tot, 1013265);
+}
+
BOOST_AUTO_TEST_SUITE_END();
BOOST_AUTO_TEST_CASE( connfail )