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

Function SqlWcharToString

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

\brief Convert buffer of SqlWchar to standard string \param[in] wchar_msg SqlWchar to convert \param[in] msg_len Number of characters in wchar_msg \return wchar_msg in std::string format

Source from the content-addressed store, hash-verified

95/// \param[in] msg_len Number of characters in wchar_msg
96/// \return wchar_msg in std::string format
97inline std::string SqlWcharToString(SQLWCHAR* wchar_msg, SQLINTEGER msg_len = SQL_NTS) {
98 if (msg_len == 0 || !wchar_msg || wchar_msg[0] == 0) {
99 return std::string();
100 }
101
102 thread_local std::vector<uint8_t> utf8_str;
103
104 if (msg_len == SQL_NTS) {
105 arrow::flight::sql::odbc::WcsToUtf8((void*)wchar_msg, &utf8_str);
106 } else {
107 arrow::flight::sql::odbc::WcsToUtf8((void*)wchar_msg, msg_len, &utf8_str);
108 }
109
110 return std::string(utf8_str.begin(), utf8_str.end());
111}
112
113/// \brief Convert vector of SqlWchar to standard string
114/// \param[in] wchar_vec SqlWchar vector to convert

Callers 15

SQLDriverConnectFunction · 0.85
SQLConnectFunction · 0.85
SQLExecDirectFunction · 0.85
SQLPrepareFunction · 0.85
SQLTablesFunction · 0.85
SQLColumnsFunction · 0.85
SQLNativeSqlFunction · 0.85
CheckSQLColAttributeFunction · 0.85
CheckSQLColAttributesFunction · 0.85
VerifyOdbcErrorStateFunction · 0.85
GetOdbcErrorMessageFunction · 0.85
TYPED_TESTFunction · 0.85

Calls 5

WcsToUtf8Function · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45

Tested by 8

CheckSQLColAttributeFunction · 0.68
CheckSQLColAttributesFunction · 0.68
VerifyOdbcErrorStateFunction · 0.68
GetOdbcErrorMessageFunction · 0.68
TYPED_TESTFunction · 0.68
TYPED_TESTFunction · 0.68
TYPED_TESTFunction · 0.68
TEST_FFunction · 0.68