Skip to content

Commit 744d868

Browse files
committed
Extract SQLBindCol implementation
Co-Authored-By: alinalibq <[email protected]>
1 parent 5eaf553 commit 744d868

File tree

3 files changed

+595
-2
lines changed

3 files changed

+595
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,16 @@ SQLRETURN SQLBindCol(SQLHSTMT stmt, SQLUSMALLINT record_number, SQLSMALLINT c_ty
857857
<< ", record_number: " << record_number << ", c_type: " << c_type
858858
<< ", data_ptr: " << data_ptr << ", buffer_length: " << buffer_length
859859
<< ", indicator_ptr: " << static_cast<const void*>(indicator_ptr);
860-
// GH-47716 TODO: Implement SQLBindCol
861-
return SQL_INVALID_HANDLE;
860+
861+
using ODBC::ODBCDescriptor;
862+
using ODBC::ODBCStatement;
863+
return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() {
864+
// GH-47021: implement driver to return indicator value when data pointer is null
865+
ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt);
866+
ODBCDescriptor* ard = statement->GetARD();
867+
ard->BindCol(record_number, c_type, data_ptr, buffer_length, indicator_ptr);
868+
return SQL_SUCCESS;
869+
});
862870
}
863871

864872
SQLRETURN SQLCloseCursor(SQLHSTMT stmt) {

cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ add_arrow_test(flight_sql_odbc_test
3535
odbc_test_suite.cc
3636
odbc_test_suite.h
3737
connection_test.cc
38+
statement_test.cc
3839
# Enable Protobuf cleanup after test execution
3940
# GH-46889: move protobuf_test_util to a more common location
4041
../../../../engine/substrait/protobuf_test_util.cc

0 commit comments

Comments
 (0)