MCPcopy Create free account
hub / github.com/apache/arrow / ToSqlWCharVector

Function ToSqlWCharVector

cpp/src/arrow/flight/sql/odbc/odbc_impl/encoding_utils.h:150–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150inline 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

Callers 1

UnregisterDsnFunction · 0.85

Calls 5

GetSqlWCharSizeFunction · 0.85
DriverExceptionClass · 0.85
to_stringFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected