Skip to content

Commit a73b6c4

Browse files
committed
Fix comments and use ARROW_UNUSED
1 parent cae7c0c commit a73b6c4

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ SQLRETURN SQLFetch(SQLHSTMT stmt) {
830830
SQLRETURN SQLExtendedFetch(SQLHSTMT stmt, SQLUSMALLINT fetch_orientation,
831831
SQLLEN fetch_offset, SQLULEN* row_count_ptr,
832832
SQLUSMALLINT* row_status_array) {
833-
// GH-47110: SQLExtendedFetch should return SQL_SUCCESS_WITH_INFO for certain diag
833+
// GH-47110 TODO: SQLExtendedFetch should return SQL_SUCCESS_WITH_INFO for certain diag
834834
// states
835835
ARROW_LOG(DEBUG) << "SQLExtendedFetch called with stmt: " << stmt
836836
<< ", fetch_orientation: " << fetch_orientation
@@ -842,15 +842,18 @@ SQLRETURN SQLExtendedFetch(SQLHSTMT stmt, SQLUSMALLINT fetch_orientation,
842842
using ODBC::ODBCDescriptor;
843843
using ODBC::ODBCStatement;
844844
return ODBCStatement::ExecuteWithDiagnostics(stmt, SQL_ERROR, [=]() {
845+
// Only SQL_FETCH_NEXT forward-only fetching orientation is supported,
846+
// meaning the behavior of SQLExtendedFetch is same as SQLFetch.
845847
if (fetch_orientation != SQL_FETCH_NEXT) {
846848
throw DriverException("Optional feature not supported.", "HYC00");
847849
}
848-
// fetch_offset is ignored as only SQL_FETCH_NEXT is supported
850+
// Ignore fetch_offset as it's not applicable to SQL_FETCH_NEXT
851+
ARROW_UNUSED(fetch_offset);
849852

850853
ODBCStatement* statement = reinterpret_cast<ODBCStatement*>(stmt);
851854

852855
// The SQL_ROWSET_SIZE statement attribute specifies the number of rows in the
853-
// rowset.
856+
// rowset. Retrieve it from GetRowsetSize.
854857
SQLULEN row_set_size = statement->GetRowsetSize();
855858
ARROW_LOG(DEBUG) << "SQL_ROWSET_SIZE value for SQLExtendedFetch: " << row_set_size;
856859

cpp/src/arrow/flight/sql/odbc/odbc_impl/odbc_statement.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ class ODBCStatement : public ODBCHandle<ODBCStatement> {
5858
void ExecutePrepared();
5959
void ExecuteDirect(const std::string& query);
6060

61-
/**
62-
* @brief Returns true if the number of rows fetch was greater than zero.
63-
* row_count_ptr and row_status_array are optional arguments, they are only needed for
64-
* SQLExtendedFetch
65-
*/
61+
/// \brief Return true if the number of rows fetch was greater than zero.
62+
///
63+
/// row_count_ptr and row_status_array are optional arguments, they are only needed for
64+
/// SQLExtendedFetch
6665
bool Fetch(size_t rows, SQLULEN* row_count_ptr = 0, SQLUSMALLINT* row_status_array = 0);
6766
bool IsPrepared() const;
6867

0 commit comments

Comments
 (0)