Merge branch 'fix-rowset-nvarchar'

Fix using rowset API with nvarchar columns.

See #1259.

Closes #1258.
This commit is contained in:
Vadim Zeitlin
2025-05-25 21:17:49 +02:00
2 changed files with 10 additions and 3 deletions

View File

@@ -267,6 +267,7 @@ public:
{
switch (dbt)
{
case db_wstring:
case db_string: return dt_string;
case db_date: return dt_date;
case db_double: return dt_double;
@@ -280,9 +281,6 @@ public:
case db_uint64: return dt_unsigned_long_long;
case db_blob: return dt_blob;
case db_xml: return dt_xml;
case db_wstring:
throw soci_error("unable to convert value to data_type");
}
// unreachable

View File

@@ -102,6 +102,15 @@ TEST_CASE("MS SQL wide string", "[odbc][mssql][wstring]")
sql << "select wide_text from soci_test", into(str_out);
CHECK(str_out == str_in);
soci::rowset<soci::row> rs = (sql.prepare << "select wide_text from soci_test");
auto it = rs.begin();
REQUIRE( it != rs.end() );
CHECK( it->get<std::wstring>(0) == str_in );
++it;
CHECK( it == rs.end() );
}
TEST_CASE("MS SQL wide string vector", "[odbc][mssql][vector][wstring]")