diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-24 10:02:15 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-08-24 10:02:15 +0100 |
commit | 4ab84b086d4af4f824f5f231cf7d97121ca23470 (patch) | |
tree | 0a33d1dd146a910448a02330ea0f1923ddf9d57d /libodbcpp/unittests | |
parent | Fix uninitialised memory warning and assert (diff) | |
download | libdbpp-odbc-4ab84b086d4af4f824f5f231cf7d97121ca23470.tar.bz2 libdbpp-odbc-4ab84b086d4af4f824f5f231cf7d97121ca23470.tar.xz libdbpp-odbc-4ab84b086d4af4f824f5f231cf7d97121ca23470.zip |
Don't rely on libdbppcore's columns
Also reduce risk of needing to resize at all by getting the octet size
Diffstat (limited to 'libodbcpp/unittests')
-rw-r--r-- | libodbcpp/unittests/testodbc.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libodbcpp/unittests/testodbc.cpp b/libodbcpp/unittests/testodbc.cpp index bb6fd97..9a810c7 100644 --- a/libodbcpp/unittests/testodbc.cpp +++ b/libodbcpp/unittests/testodbc.cpp @@ -4,6 +4,7 @@ #include <definedDirs.h> #include <modifycommand.h> #include <selectcommand.h> +#include <selectcommandUtil.impl.h> #include <column.h> #include <error.h> #include <odbc-mock.h> @@ -90,5 +91,19 @@ BOOST_AUTO_TEST_CASE( bindAndSelectOther ) BOOST_REQUIRE_EQUAL(1, rows); } +BOOST_AUTO_TEST_CASE( multibyte ) +{ + auto ro = DB::MockDatabase::openConnectionTo("odbcmock"); + + auto select = ro->select("SELECT LPAD('', n, '£'), n FROM GENERATE_SERIES(1, 50000, 200) n"); + select->execute(); + int rows = 0; + for (const auto [s, n] : select->as<std::string, int64_t>()) { + BOOST_CHECK_EQUAL(s.length(), n * 2); + rows += 1; + } + BOOST_REQUIRE_EQUAL(250, rows); +} + BOOST_AUTO_TEST_SUITE_END(); |