Skip to content

Commit be30a90

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

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,29 +106,10 @@ SQLRETURN SQL_API SQLSetEnvAttr(SQLHENV env, SQLINTEGER attr, SQLPOINTER value_p
106106
SQLRETURN SQL_API SQLGetConnectAttr(SQLHDBC conn, SQLINTEGER attribute,
107107
SQLPOINTER value_ptr, SQLINTEGER buffer_length,
108108
SQLINTEGER* string_length_ptr) {
109-
ARROW_LOG(DEBUG)
110-
<< "-AL- Alina test msg in entry_points.cc: SQLGetConnectAttr called with conn: "
111-
<< conn; //-AL- refactor later.
112109
return arrow::flight::sql::odbc::SQLGetConnectAttr(conn, attribute, value_ptr,
113110
buffer_length, string_length_ptr);
114111
}
115112

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-
132113
SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC conn, SQLINTEGER attr, SQLPOINTER value,
133114
SQLINTEGER value_len) {
134115
return arrow::flight::sql::odbc::SQLSetConnectAttr(conn, attr, value, value_len);

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,6 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC conn, SQLINTEGER attribute, SQLPOINTER value
780780
<< ", attribute: " << attribute << ", value_ptr: " << value_ptr
781781
<< ", buffer_length: " << buffer_length << ", string_length_ptr: "
782782
<< static_cast<const void*>(string_length_ptr);
783-
ARROW_LOG(DEBUG)
784-
<< "-AL- Alina test msg in odbc_api.cc: SQLGetConnectAttr called with conn: "
785-
<< conn; //-AL- refactor later.
786783
using ODBC::ODBCConnection;
787784

788785
return ODBCConnection::ExecuteWithDiagnostics(conn, SQL_ERROR, [=]() {

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)