Skip to content

GH-47710: [C++][FlightRPC] Statement attribute Support in ODBC#47773

Merged
lidavidm merged 7 commits into
apache:mainfrom
Bit-Quill:gh-47710-sql-stmt-attr
Nov 28, 2025
Merged

GH-47710: [C++][FlightRPC] Statement attribute Support in ODBC#47773
lidavidm merged 7 commits into
apache:mainfrom
Bit-Quill:gh-47710-sql-stmt-attr

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

Rationale for this change

Support for getting and setting statement attributes in ODBC is added.

What changes are included in this PR?

  • Implementation of SQLGetStmtAttr and SQLSetStmtAttr to get and set statement attributes.
  • Tests

Are these changes tested?

Tested on local MSVC

Are there any user-facing changes?

No

@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

@lidavidm @kou Please review this draft ODBC API PR, thanks. The testing folder structure will be in a separate PR

@github-actions

github-actions Bot commented Oct 9, 2025

Copy link
Copy Markdown

⚠️ GitHub issue #47710 has been automatically assigned in GitHub to PR creator.

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same general comments as the other PRs.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Oct 10, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47710-sql-stmt-attr branch from 42f4f14 to 1e025c7 Compare October 21, 2025 22:30
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 21, 2025
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

we worked on:

  • replace EXPECT_ with ASSERT_ where applicable
  • use platform.h
  • still in-progress on subclassing test fixture and moving connect/disconnect to setup/teardown

@alinaliBQ alinaliBQ force-pushed the gh-47710-sql-stmt-attr branch from 1e025c7 to be51a05 Compare October 22, 2025 23:07
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

Rebased on top of master branch. Wrapped up subclassing test fixture and moving connect/disconnect to setup/teardown.

@alinaliBQ alinaliBQ requested a review from lidavidm October 22, 2025 23:08
Comment on lines +39 to +52
namespace {
// Helper Functions

// Validate SQLULEN return value
void ValidateGetStmtAttr(SQLHSTMT statement, SQLINTEGER attribute,
SQLULEN expected_value) {
SQLULEN value = 0;
SQLINTEGER string_length = 0;

ASSERT_EQ(SQL_SUCCESS,
SQLGetStmtAttr(statement, attribute, &value, sizeof(value), &string_length));

EXPECT_EQ(expected_value, value);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of having variants for each type of comparison (equal, greater than, etc.) wouldn't it be better to just have a getter for each type, and keep the assertion in the tests themselves? (It could throw on failure, for instance, to keep the signature simple.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yea that makes sense. I added getters, please let me know what you think

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 23, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47710-sql-stmt-attr branch from be51a05 to aebac29 Compare October 28, 2025 21:55
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 28, 2025

@alinaliBQ alinaliBQ left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

worked on comment

Comment on lines +39 to +52
namespace {
// Helper Functions

// Validate SQLULEN return value
void ValidateGetStmtAttr(SQLHSTMT statement, SQLINTEGER attribute,
SQLULEN expected_value) {
SQLULEN value = 0;
SQLINTEGER string_length = 0;

ASSERT_EQ(SQL_SUCCESS,
SQLGetStmtAttr(statement, attribute, &value, sizeof(value), &string_length));

EXPECT_EQ(expected_value, value);
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yea that makes sense. I added getters, please let me know what you think

@alinaliBQ alinaliBQ requested a review from lidavidm October 28, 2025 21:56
@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 31, 2025
@alinaliBQ alinaliBQ force-pushed the gh-47710-sql-stmt-attr branch from 0675c21 to bafe934 Compare November 14, 2025 23:06
@alinaliBQ alinaliBQ marked this pull request as ready for review November 14, 2025 23:06
alinaliBQ and others added 7 commits November 20, 2025 13:47
Co-Authored-By: rscales <robscales@icloud.com>
Add tests for setting and getting statement attributes

Co-Authored-By: rscales <robscales@icloud.com>
- use `platform.h`
- move `connect/disconnect` to `setup/teardown`
- in-progress on subclassing test fixture

Co-authored-by: justing-bq <justin.gossett@improving.com>
Co-authored-by: alinalibq <alina.li@improving.com>
- remove `using List = std::list<T>;`
@alinaliBQ alinaliBQ force-pushed the gh-47710-sql-stmt-attr branch from bafe934 to 501eab7 Compare November 20, 2025 22:04
@lidavidm lidavidm merged commit 430d4b1 into apache:main Nov 28, 2025
43 of 46 checks passed
@lidavidm lidavidm removed the awaiting merge Awaiting merge label Nov 28, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 430d4b1.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 3 possible false positives for unstable benchmarks that are known to sometimes produce them.

Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…pache#47773)

### Rationale for this change
Support for getting and setting statement attributes in ODBC is added. 

### What changes are included in this PR?
- Implementation of `SQLGetStmtAttr` and  `SQLSetStmtAttr` to get and set statement attributes. 
- Tests

### Are these changes tested?
Tested on local MSVC

### Are there any user-facing changes?
No
* GitHub Issue: apache#47710

Lead-authored-by: Alina (Xi) Li <alina.li@improving.com>
Co-authored-by: alinalibq <alina.li@improving.com>
Co-authored-by: justing-bq <justin.gossett@improving.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants