Added
Link Here
|
1 |
--- thirdparty/nanodbc/nanodbc/nanodbc.cpp.orig 2024-10-11 09:03:05 UTC |
2 |
+++ thirdparty/nanodbc/nanodbc/nanodbc.cpp |
3 |
@@ -255,10 +255,19 @@ constexpr std::size_t size(const T (&array)[N]) noexce |
4 |
} |
5 |
#endif |
6 |
|
7 |
+inline std::size_t length(NANODBC_SQLCHAR const* s) |
8 |
+{ |
9 |
+ std::size_t len = 0; |
10 |
+ for (; *s != 0; ++s) |
11 |
+ ++len; |
12 |
+ return len; |
13 |
+ |
14 |
+} |
15 |
+ |
16 |
template <std::size_t N> |
17 |
inline std::size_t size(NANODBC_SQLCHAR const (&array)[N]) noexcept |
18 |
{ |
19 |
- auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array); |
20 |
+ auto const n = length(array); |
21 |
NANODBC_ASSERT(n < N); |
22 |
return n < N ? n : N - 1; |
23 |
} |
24 |
@@ -3589,9 +3598,9 @@ std::list<datasource> list_datasources() |
25 |
"incompatible SQLCHAR and string::value_type"); |
26 |
|
27 |
datasource dsn; |
28 |
- dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]); |
29 |
+ dsn.name = string(&name[0], &name[length(name)]); |
30 |
dsn.driver = |
31 |
- string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]); |
32 |
+ string(&driver[0], &driver[length(driver)]); |
33 |
|
34 |
dsns.push_back(std::move(dsn)); |
35 |
direction = SQL_FETCH_NEXT; |
36 |
@@ -3642,7 +3651,7 @@ std::list<driver> list_drivers() |
37 |
"incompatible SQLCHAR and string::value_type"); |
38 |
|
39 |
driver drv; |
40 |
- drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::length(descr)]); |
41 |
+ drv.name = string(&descr[0], &descr[length(descr)]); |
42 |
|
43 |
// Split "Key1=Value1\0Key2=Value2\0\0" into list of key-value pairs |
44 |
auto beg = &attrs[0]; |