justing-bq commented on code in PR #49668:
URL: https://github.com/apache/arrow/pull/49668#discussion_r3127366495


##########
cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.h:
##########
@@ -38,6 +38,23 @@
 // For DSN registration
 #include "arrow/flight/sql/odbc/odbc_impl/system_dsn.h"
 
+#ifdef __linux__
+#  define ASSIGN_SQLWCHAR_ARR(name, wstring_literal)                           
\
+    auto name##_vec = ODBC::ToSqlWCharVector(std::wstring(wstring_literal));   
\
+    if (name##_vec.empty() || name##_vec.back() != static_cast<SQLWCHAR>(0)) { 
\
+      name##_vec.push_back(static_cast<SQLWCHAR>(0));                          
\
+    }                                                                          
\
+    SQLWCHAR* name = name##_vec.data();
+#  define ASSIGN_SQLWCHAR_ARR_AND_LEN(name, wstring_literal) \
+    ASSIGN_SQLWCHAR_ARR(name, wstring_literal)               \
+    SQLSMALLINT name##_len = static_cast<SQLSMALLINT>(name##_vec.size() - 1);
+#else  // Windows & Mac
+#  define ASSIGN_SQLWCHAR_ARR(name, wstring_literal) SQLWCHAR name[] = 
wstring_literal;
+#  define ASSIGN_SQLWCHAR_ARR_AND_LEN(name, wstring_literal) \
+    ASSIGN_SQLWCHAR_ARR(name, wstring_literal)               \
+    SQLSMALLINT name##_len = static_cast<SQLSMALLINT>(std::wcslen(name));

Review Comment:
   `SQLSMALLINT` was used here deliberately. If we use `SQLINTEGER` instead 
then we get more build errors complaining about possible loss of data as we 
pass these `SQLINTEGER` variables into functions expecting `SQLSMALLINT`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to