Skip to content

Conversation

@alinaliBQ
Copy link
Contributor

@alinaliBQ alinaliBQ commented Oct 9, 2025

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?

Will be tested in CI when PR is ready for review

Are there any user-facing changes?

No

@alinaliBQ
Copy link
Contributor Author

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

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

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

Copy link
Member

@lidavidm lidavidm left a comment

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
Contributor 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
Contributor 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 48
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
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
Contributor 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 and others added 5 commits October 28, 2025 11:42
Add tests for setting and getting statement attributes

Co-Authored-By: rscales <[email protected]>
- use `platform.h`
- move `connect/disconnect` to `setup/teardown`
- in-progress on subclassing test fixture

Co-authored-by: justing-bq <[email protected]>
Co-authored-by: alinalibq <[email protected]>
- remove `using List = std::list<T>;`
@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
Copy link
Contributor Author

@alinaliBQ alinaliBQ left a comment

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 48
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
Contributor 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
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