File tree Expand file tree Collapse file tree
cpp/src/arrow/flight/sql/odbc/odbc_impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
3535
3636#ifdef __linux__
37- # define GET_SQWCHAR_PTR ( wstring_var ) ( ODBC::ToSqlWCharVector(wstring_var).data() )
37+ # define ODBC_INI reinterpret_cast <LPCWSTR>( u" ODBC.INI " )
3838#else
3939// Windows and macOS
40- # define GET_SQWCHAR_PTR ( wstring_var ) (wstring_var.c_str() )
40+ # define ODBC_INI reinterpret_cast <LPCWSTR>( L" ODBC.INI " )
4141#endif
4242
43- #define ODBC_INI reinterpret_cast <LPCWSTR>(GET_SQWCHAR_PTR(std::wstring(L" ODBC.INI" )))
44-
4543namespace ODBC {
4644
4745// Return the number of bytes required for the conversion.
Original file line number Diff line number Diff line change @@ -59,10 +59,10 @@ void PostError(DWORD error_code, LPWSTR error_msg) {
5959
6060void PostArrowUtilError (arrow::Status error_status) {
6161 std::string error_msg = error_status.message ();
62- std::wstring werror_msg = arrow::util::UTF8ToWideString (error_msg).ValueOr (
63- L" Error during utf8 to wide string conversion" );
62+ CONVERT_SQLWCHAR_STR (werror_msg, error_msg);
6463
65- PostError (ODBC_ERROR_GENERAL_ERR, const_cast <LPWSTR>(GET_SQWCHAR_PTR (werror_msg)));
64+ PostError (ODBC_ERROR_GENERAL_ERR,
65+ const_cast <LPWSTR>(reinterpret_cast <LPCWSTR>(werror_msg.c_str ())));
6666}
6767
6868void PostLastInstallerError () {
@@ -94,7 +94,14 @@ void PostLastInstallerError() {
9494 * @return True on success and false on fail.
9595 */
9696bool UnregisterDsn (const std::wstring& dsn) {
97- if (SQLRemoveDSNFromIni (GET_SQWCHAR_PTR (dsn))) {
97+ #ifdef __linux__
98+ auto dsn_vec = ODBC::ToSqlWCharVector (dsn);
99+ const SQLWCHAR* dsn_arr = dsn_vec.data ();
100+ #else
101+ // Windows and macOS
102+ const SQLWCHAR* dsn_arr = dsn.c_str ();
103+ #endif
104+ if (SQLRemoveDSNFromIni (dsn_arr)) {
98105 return true ;
99106 }
100107
You can’t perform that action at this time.
0 commit comments