Return the settable pointer attributes and SQL_ATTR_CURSOR_SCROLLABLE from SQLGetStmtAttr - #304
Open
fdcastel wants to merge 2 commits into
Open
Return the settable pointer attributes and SQL_ATTR_CURSOR_SCROLLABLE from SQLGetStmtAttr#304fdcastel wants to merge 2 commits into
fdcastel wants to merge 2 commits into
Conversation
… from SQLGetStmtAttr sqlGetStmtAttr had no case for SQL_ATTR_ROWS_FETCHED_PTR, SQL_ATTR_ROW_BIND_OFFSET_PTR, SQL_ATTR_ROW_OPERATION_PTR, SQL_ATTR_PARAMS_PROCESSED_PTR, SQL_ATTR_PARAM_BIND_OFFSET_PTR, SQL_ATTR_PARAM_OPERATION_PTR, SQL_ATTR_PARAM_STATUS_PTR or SQL_ATTR_CURSOR_SCROLLABLE, so reading any of them fell through to the default branch and returned HYC00 although sqlSetStmtAttr had stored the value and the driver was using it. Each new case reads back the same field the setter writes, mirroring the existing SQL_ATTR_ROW_STATUS_PTR case.
…mtAttr One set-then-get case per pointer attribute (a pointer, then NULL), SQL_ATTR_ROW_STATUS_PTR as the control that already passed, and SQL_ATTR_CURSOR_SCROLLABLE with its default, both values, and the cursor type it implies. Eight of the nine fail on master.
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every statement attribute that
SQLSetStmtAttraccepts should come back fromSQLGetStmtAttr. Eight did not: the getter'sswitchhad no case for them, so they fell through todefault:and returnedHYC00"Optional feature not implemented", although the setter had stored the value and the driver was using it.SQL_ATTR_ROWS_FETCHED_PTRSQL_ATTR_ROW_BIND_OFFSET_PTRSQL_ATTR_ROW_OPERATION_PTRSQL_ATTR_PARAMS_PROCESSED_PTRSQL_ATTR_PARAM_BIND_OFFSET_PTRSQL_ATTR_PARAM_OPERATION_PTRSQL_ATTR_PARAM_STATUS_PTRSQL_ATTR_CURSOR_SCROLLABLEcursorScrollableNoticed while working on #303: an application cannot even check which rows-fetched pointer it set. Generic ODBC consumers that save and restore statement attributes hit the error as well.
The fix
One
caseper attribute inOdbcStatement::sqlGetStmtAttr, each mirroring the existingSQL_ATTR_ROW_STATUS_PTRcase: read the same descriptor header field the setter writes.SQL_ATTR_CURSOR_SCROLLABLEreturns what the setter stored (defaultSQL_NONSCROLLABLE).Tests
tests/test_stmt_attrs.cpp: one set-then-get round trip per pointer attribute (a pointer, then NULL),SQL_ATTR_ROW_STATUS_PTRas the control that already passed, and aSQL_ATTR_CURSOR_SCROLLABLEcase checking the default, both values, and thatSQL_SCROLLABLEmovesSQL_ATTR_CURSOR_TYPEoff forward-only. Eight of the nine fail on master; all pass with this branch.Verified on Windows x64 against Firebird 5.0.3 with the Microsoft driver manager. Full suite: 397 ran, 232 passed, 165 skipped, 0 failed.
Independent of #303: the tests set and read without a prepare in between.
Still open
SQL_ATTR_KEYSET_SIZEis also settable without a getter, but the setter stores it in the ARD array size, which is not what that attribute means, so a getter would only document the wrong behaviour. Left alone.