alinaliBQ commented on code in PR #48577:
URL: https://github.com/apache/arrow/pull/48577#discussion_r2641506591


##########
cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt:
##########
@@ -17,8 +17,11 @@
 
 add_custom_target(tests)
 
-find_package(ODBC REQUIRED)
-include_directories(${ODBC_INCLUDE_DIRS})
+if(WIN32)
+  include_directories(${ODBC_INCLUDE_DIRS})
+else()
+  include_directories(${ODBC_INCLUDE_DIR})
+endif()

Review Comment:
   Replaced it with `target_include_directories`. Regarding `DIRS/DIR`, it has 
to do with 
[FindODBC.cmake](https://cmake.org/cmake/help/latest/module/FindODBC.html#cache-variables),
 on Windows, `ODBC_INCLUDE_DIRS` is set, and on unix systems `ODBC_INCLUDE_DIR` 
is set. `ODBC_INCLUDE_DIR` can be empty on Windows. I added a comment to 
indicate this.



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_handle.h:
##########
@@ -46,7 +46,18 @@ class ODBCHandle {
     try {
       GetDiagnostics().Clear();
       rc = function();
-    } catch (const arrow::flight::sql::odbc::DriverException& ex) {
+    } catch (const arrow::flight::sql::odbc::AuthenticationException& ex) {
+      GetDiagnostics().AddError(arrow::flight::sql::odbc::DriverException(
+          ex.GetMessageText(), ex.GetSqlState(), ex.GetNativeError()));
+    } catch (const arrow::flight::sql::odbc::NullWithoutIndicatorException& 
ex) {
+      GetDiagnostics().AddError(arrow::flight::sql::odbc::DriverException(
+          ex.GetMessageText(), ex.GetSqlState(), ex.GetNativeError()));
+    }
+    // on mac, DriverException doesn't catch the subclass exceptions hence we 
added
+    // the following above.
+    // GH-48278 TODO investigate if there is a way to catch all the subclass 
exceptions
+    // under DriverException
+    catch (const arrow::flight::sql::odbc::DriverException& ex) {

Review Comment:
   Yes this is odd, it does seem like undefined behavior. clang being more 
strict is a possibility. 
   Without this change, on mac `std::exception` is caught instead of 
`DriverException`, so the exception is still caught but not under 
`DriverException` which we want



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