Skip to content

SQLExtendedFetch Implementation - #61

Merged
alinaliBQ merged 14 commits into
apache-odbcfrom
sql-extended-fetch
Jul 16, 2025
Merged

SQLExtendedFetch Implementation#61
alinaliBQ merged 14 commits into
apache-odbcfrom
sql-extended-fetch

Conversation

@alinaliBQ

Copy link
Copy Markdown

No description provided.

@alinaliBQ

Copy link
Copy Markdown
Author

Similar as #60 (comment), will switch the target branch to apache-odbc after SQLBindCol has been merged

@alinaliBQ
alinaliBQ force-pushed the sql-extended-fetch branch from 7083425 to 134a7ea Compare July 14, 2025 21:33
@alinaliBQ
alinaliBQ force-pushed the sql-extended-fetch branch from 134a7ea to 3a9a4f4 Compare July 14, 2025 21:34
SQLUSMALLINT* rowStatusArray) {
if (m_hasReachedEndOfResult) {
m_ird->SetRowsProcessed(0);
return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have to update rowCountPtr/rowStatusArray here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is the simplest way I found. I don't know if the original flightsql-odbc code handles rowCountPtr/rowStatusArray from SQLExtendedFetch. The logic in the driver for setting SQL_ATTR_ROWS_FETCHED_PTR and SQL_ATTR_ROW_STATUS_PTR cannot be reused for rowCountPtr and rowStatusArray respectively, since the spec says the rowCountPtr/rowStatusArray buffers are only used by SQLExtendedFetch and not by SQLFetch or SQLFetchScroll.

@jduo jduo Jul 16, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old driver cheated a bit. It temporarily wrote the SQL_ATTR_ROWS_FETCHED_PTR and SQL_ATTR_ROW_STATUS_PTR with the inputs from SQLExtendedFetch then reverted them after the call finished.

Comment thread cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc Outdated
Comment thread cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc Outdated
Base automatically changed from sql-bind-col to apache-odbc July 16, 2025 18:35

@alinaliBQ alinaliBQ left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing comments from James

Comment thread cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc Outdated
Comment thread cpp/src/arrow/flight/sql/odbc/odbcabstraction/odbc_impl/odbc_statement.cc Outdated
SQLUSMALLINT* rowStatusArray) {
if (m_hasReachedEndOfResult) {
m_ird->SetRowsProcessed(0);
return false;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is the simplest way I found. I don't know if the original flightsql-odbc code handles rowCountPtr/rowStatusArray from SQLExtendedFetch. The logic in the driver for setting SQL_ATTR_ROWS_FETCHED_PTR and SQL_ATTR_ROW_STATUS_PTR cannot be reused for rowCountPtr and rowStatusArray respectively, since the spec says the rowCountPtr/rowStatusArray buffers are only used by SQLExtendedFetch and not by SQLFetch or SQLFetchScroll.

@alinaliBQ
alinaliBQ marked this pull request as ready for review July 16, 2025 19:07
@alinaliBQ
alinaliBQ merged commit d7c7128 into apache-odbc Jul 16, 2025
24 checks passed
@alinaliBQ
alinaliBQ deleted the sql-extended-fetch branch July 16, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants