--- thirdparty/nanodbc/nanodbc/nanodbc.cpp.orig 2023-04-13 20:27:39 UTC +++ thirdparty/nanodbc/nanodbc/nanodbc.cpp @@ -255,10 +255,19 @@ constexpr std::size_t size(const T (&array)[N]) noexce } #endif +inline std::size_t length(NANODBC_SQLCHAR const* s) +{ + std::size_t len = 0; + for (; *s != 0; ++s) + ++len; + return len; + +} + template inline std::size_t size(NANODBC_SQLCHAR const (&array)[N]) noexcept { - auto const n = std::char_traits::length(array); + auto const n = length(array); NANODBC_ASSERT(n < N); return n < N ? n : N - 1; } @@ -3573,9 +3582,9 @@ std::list list_datasources() "incompatible SQLCHAR and string::value_type"); datasource dsn; - dsn.name = string(&name[0], &name[std::char_traits::length(name)]); + dsn.name = string(&name[0], &name[length(name)]); dsn.driver = - string(&driver[0], &driver[std::char_traits::length(driver)]); + string(&driver[0], &driver[length(driver)]); dsns.push_back(std::move(dsn)); direction = SQL_FETCH_NEXT; @@ -3626,7 +3635,7 @@ std::list list_drivers() "incompatible SQLCHAR and string::value_type"); driver drv; - drv.name = string(&descr[0], &descr[std::char_traits::length(descr)]); + drv.name = string(&descr[0], &descr[length(descr)]); // Split "Key1=Value1\0Key2=Value2\0\0" into list of key-value pairs auto beg = &attrs[0];