Skip to content

Commit 578457e

Browse files
committed
Disable SQLGetConnectOption on macOS
1 parent 15de37b commit 578457e

2 files changed

Lines changed: 6 additions & 16 deletions

File tree

cpp/src/arrow/flight/sql/odbc/entry_points.cc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,6 @@ SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC conn, SQLINTEGER attribute,
113113
buffer_length, string_length_ptr);
114114
}
115115

116-
// -AL- not sure if needed on macOS, check again after implementing SQLError.
117-
SQLRETURN SQL_API SQLGetConnectOption(SQLHDBC conn, SQLUSMALLINT attribute,
118-
SQLPOINTER value_ptr) {
119-
ARROW_LOG(DEBUG) << "SQLGetConnectOption called with conn: " << conn
120-
<< ", attribute: " << attribute
121-
<< ", value_ptr: " << static_cast<const void*>(value_ptr);
122-
123-
// cast `SQLUSMALLINT` attribute to a `SQLINTEGER` type which works for
124-
// SQLGetConnectAttr buffer_length, string_length_ptr should be set to 0
125-
SQLINTEGER buffer_length = 0;
126-
SQLINTEGER string_length = 0;
127-
SQLINTEGER attribute_int = static_cast<SQLINTEGER>(attribute);
128-
return arrow::flight::sql::odbc::SQLGetConnectAttr(conn, attribute_int, value_ptr,
129-
buffer_length, &string_length);
130-
}
131-
132116
SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC conn, SQLINTEGER attr, SQLPOINTER value,
133117
SQLINTEGER value_len) {
134118
return arrow::flight::sql::odbc::SQLSetConnectAttr(conn, attr, value, value_len);

cpp/src/arrow/flight/sql/odbc/tests/errors_test.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,17 @@ TYPED_TEST(ErrorsOdbcV2Test, TestSQLErrorEnvErrorFromDriverManager) {
472472
EXPECT_TRUE(!std::wstring(message).empty());
473473
}
474474

475+
#ifndef __APPLE__
475476
TYPED_TEST(ErrorsOdbcV2Test, TestSQLErrorConnError) {
476477
// Test ODBC 2.0 API SQLError with ODBC ver 2.
477478
// Known Windows Driver Manager (DM) behavior:
478479
// When application passes buffer length greater than SQL_MAX_MESSAGE_LENGTH (512),
479480
// DM passes 512 as buffer length to SQLError.
480481

482+
// Known macOS Driver Manager (DM) behavior:
483+
// Attempts to call SQLGetConnectOption without redirecting the API call to SQLGetConnectAttr.
484+
// SQLGetConnectOption is not implemented as it is not required by macOS Excel.
485+
481486
// Attempt to set unsupported attribute
482487
ASSERT_EQ(SQL_ERROR, SQLGetConnectAttr(this->conn, SQL_ATTR_TXN_ISOLATION, 0, 0, 0));
483488

@@ -497,6 +502,7 @@ TYPED_TEST(ErrorsOdbcV2Test, TestSQLErrorConnError) {
497502

498503
EXPECT_TRUE(!std::wstring(message).empty());
499504
}
505+
#endif // __APPLE__
500506

501507
TYPED_TEST(ErrorsOdbcV2Test, TestSQLErrorStmtError) {
502508
// Test ODBC 2.0 API SQLError with ODBC ver 2.

0 commit comments

Comments
 (0)