Copilot commented on code in PR #49267:
URL: https://github.com/apache/arrow/pull/49267#discussion_r2922717645


##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/system_dsn.cc:
##########
@@ -55,7 +51,7 @@ void PostLastInstallerError() {
   buf << L"Message: \"" << msg << L"\", Code: " << code;
   std::wstring error_msg = buf.str();
 
-  PostError(code, error_msg.c_str());
+  PostError(code, (LPWSTR)error_msg.c_str());
 }

Review Comment:
   `PostError`/callers cast away constness from `std::wstring::c_str()` to pass 
an `LPWSTR`. If the installer API ever writes into this buffer, that becomes 
undefined behavior. Prefer keeping the parameter `const` (e.g., `LPCWSTR`) when 
possible, or pass a truly mutable, null-terminated buffer (e.g., 
`std::vector<wchar_t>` / `std::wstring` with `data()` in C++17+ and ensuring 
null termination) instead of casting.



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/system_dsn.cc:
##########
@@ -17,23 +17,19 @@
 
 #include "arrow/flight/sql/odbc/odbc_impl/system_dsn.h"
 
-#include "arrow/flight/sql/odbc/odbc_impl/config/configuration.h"
-#include "arrow/flight/sql/odbc/odbc_impl/flight_sql_connection.h"
-#include "arrow/flight/sql/odbc/odbc_impl/ui/dsn_configuration_window.h"
-#include "arrow/flight/sql/odbc/odbc_impl/ui/window.h"
-#include "arrow/flight/sql/odbc/odbc_impl/util.h"
 #include "arrow/result.h"
 #include "arrow/util/utf8.h"
 

Review Comment:
   `system_dsn.cc` uses `boost::iequals` in `RegisterDsn(...)` but the Boost 
predicate header is no longer included after this change, which will break 
compilation. Add the appropriate Boost include (e.g., the predicate header) in 
this file or in a header that guarantees it for all build targets.
   ```suggestion
   
   #include <boost/algorithm/string/predicate.hpp>
   ```



##########
cpp/src/arrow/flight/sql/odbc/tests/type_info_test.cc:
##########
@@ -1757,27 +1761,31 @@ TEST_F(TypeInfoOdbcV2MockTest, 
TestSQLGetTypeInfoTimeODBCVer2) {
                       NULL,   // expected_num_prec_radix
                       NULL);  // expected_interval_prec
 
-  CheckSQLDescribeColODBCVer2(this->stmt);
+  CheckSQLDescribeColODBCVer2(stmt);
 
   // No more data
-  ASSERT_EQ(SQL_NO_DATA, SQLFetch(this->stmt));
+  ASSERT_EQ(SQL_NO_DATA, SQLFetch(stmt));
 }
 
-TEST_F(TypeInfoOdbcV2MockTest, TestSQLGetTypeInfoSQLTypeTimeODBCVer2) {
+TEST_F(TypeInfoOdbcV2MockTest, TestSQLGetTypeInfoSQLTypeTime) {
+#ifdef __APPLE__
+  ASSERT_EQ(SQL_SUCCESS, SQLGetTypeInfo(stmt, SQL_TYPE_DATE));

Review Comment:
   On macOS branch of `TestSQLGetTypeInfoSQLTypeTime`, the test calls 
`SQLGetTypeInfo` with `SQL_TYPE_DATE` instead of `SQL_TYPE_TIME`, so it isn't 
actually exercising the time type and will give misleading coverage/results. 
Update the argument to match the test name/intent.
   ```suggestion
     ASSERT_EQ(SQL_SUCCESS, SQLGetTypeInfo(stmt, SQL_TYPE_TIME));
   ```



-- 
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