From 4ab84b086d4af4f824f5f231cf7d97121ca23470 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 24 Aug 2018 10:02:15 +0100 Subject: Don't rely on libdbppcore's columns Also reduce risk of needing to resize at all by getting the octet size --- libodbcpp/unittests/testodbc.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libodbcpp/unittests') 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 #include #include +#include #include #include #include @@ -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()) { + BOOST_CHECK_EQUAL(s.length(), n * 2); + rows += 1; + } + BOOST_REQUIRE_EQUAL(250, rows); +} + BOOST_AUTO_TEST_SUITE_END(); -- cgit v1.2.3