| 148 | } |
| 149 | |
| 150 | inline std::vector<SQLWCHAR> ToSqlWCharVector(const std::wstring& ws) { |
| 151 | switch (arrow::flight::sql::odbc::GetSqlWCharSize()) { |
| 152 | case sizeof(wchar_t): { |
| 153 | return std::vector<SQLWCHAR>(ws.begin(), ws.end()); |
| 154 | } |
| 155 | #ifdef __linux__ |
| 156 | case sizeof(char16_t): { |
| 157 | // Linux ODBC driver manager uses char16_t as SQLWCHAR |
| 158 | CONVERT_UTF8_STR(const std::string utf8s, ws); |
| 159 | CONVERT_UTF16_STR(const std::u16string utf16s, utf8s); |
| 160 | return std::vector<SQLWCHAR>(utf16s.begin(), utf16s.end()); |
| 161 | } |
| 162 | #endif // __linux__ |
| 163 | default: { |
| 164 | assert(false); |
| 165 | throw arrow::flight::sql::odbc::DriverException( |
| 166 | "Encoding is unsupported, SQLWCHAR size: " + |
| 167 | std::to_string(arrow::flight::sql::odbc::GetSqlWCharSize())); |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | } // namespace ODBC |
no test coverage detected