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

Function ToSqlWCharVector

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

Source from the content-addressed store, hash-verified

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