Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions cpp/src/arrow/flight/sql/odbc/odbc_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,38 @@ SQLRETURN SQLGetStmtAttr(SQLHSTMT stmt, SQLINTEGER attribute, SQLPOINTER value_p
<< ", attribute: " << attribute << ", value_ptr: " << value_ptr
<< ", buffer_length: " << buffer_length << ", string_length_ptr: "
<< static_cast<const void*>(string_length_ptr);
// GH-47710 TODO: Implement SQLGetStmtAttr
return SQL_INVALID_HANDLE;

using ODBC::ODBCStatement;

return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() {
ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt);

bool is_unicode = true;

statement->GetStmtAttr(attribute, value_ptr, buffer_length, string_length_ptr,
is_unicode);

return SQL_SUCCESS;
});
}

SQLRETURN SQLSetStmtAttr(SQLHSTMT stmt, SQLINTEGER attribute, SQLPOINTER value_ptr,
SQLINTEGER string_length) {
ARROW_LOG(DEBUG) << "SQLSetStmtAttrW called with stmt: " << stmt
<< ", attribute: " << attribute << ", value_ptr: " << value_ptr
<< ", string_length: " << string_length;
// GH-47710 TODO: Implement SQLSetStmtAttr
return SQL_INVALID_HANDLE;

using ODBC::ODBCStatement;

return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() {
ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt);

bool is_unicode = true;

statement->SetStmtAttr(attribute, value_ptr, string_length, is_unicode);

return SQL_SUCCESS;
});
}

SQLRETURN SQLExecDirect(SQLHSTMT stmt, SQLWCHAR* query_text, SQLINTEGER text_length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ void ODBCStatement::SetStmtAttr(SQLINTEGER statement_attribute, SQLPOINTER value
CheckIfAttributeIsSetToOnlyValidValue(value, static_cast<SQLULEN>(SQL_UB_OFF));
return;
case SQL_ATTR_RETRIEVE_DATA:
CheckIfAttributeIsSetToOnlyValidValue(value, static_cast<SQLULEN>(SQL_TRUE));
CheckIfAttributeIsSetToOnlyValidValue(value, static_cast<SQLULEN>(SQL_RD_ON));
return;
case SQL_ROWSET_SIZE:
SetAttribute(value, rowset_size_);
Expand Down
Loading
Loading