Skip to content

impl(bq_driver): Add impl for SQL_ATTR_ANSI_APP attribute - #1637

Open
NeerajDwivedii wants to merge 2 commits into
mainfrom
add_sql_attr_ansi_impl
Open

impl(bq_driver): Add impl for SQL_ATTR_ANSI_APP attribute#1637
NeerajDwivedii wants to merge 2 commits into
mainfrom
add_sql_attr_ansi_impl

Conversation

@NeerajDwivedii

@NeerajDwivedii NeerajDwivedii commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

This PR implements support for the SQL_ATTR_ANSI_APP attribute in the BQ driver. The attribute will be set before creating the connection.

Note that on Windows, explicitly setting this attribute is not supported. The Driver Manager directly returns an HY092 (option value out of range) error.

** Observation:
The internal BigQuery ODBC driver and the existing Simba BigQuery ODBC driver both support setting SQL_ATTR_ANSI_APP after connection creation.

The attribute allows the Driver Manager to inform the driver whether the application is using ANSI APIs (SQL_AA_TRUE) or Unicode APIs (SQL_AA_FALSE), so that the driver can provide different behavior depending on the application type. as mention in official [documentation ]( If the driver returns SQL_SUCCESS, the Driver Manager will separate ANSI and Unicode connections when Connection Pooling is used.)

{SQL_ATTR_LOGIN_TIMEOUT,
{"SQL_ATTR_LOGIN_TIMEOUT", ConnectionValidation::kBefore,
SupportedAttribute::kBoth, (SQLPOINTER)0}},
{SQL_ATTR_ANSI_APP,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please see how to write test case for this

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.

existing test cases will be utilsied

ToSqlPointer(timeout), 0);
CheckError(status, "SQLSetConnectAttr", conn, use_ansi);
#ifndef WIN32
status = SQLSetConnectAttrA(conn->hdbc, SQL_ATTR_ANSI_APP,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's verify if driver manager is allowed to dynamically change the bahaviour by setting SQL_ATTR_ANSI_APP to true/false.

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.

Added attribute value change after connection creation, driver has same behavior as Simba BQ driver and also same same behavior as official doc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't see where we are setting the attribute after making the connection. SetAttributes function is called before.

@sachinpro

sachinpro commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

We need to verify the behaviour through unixODBC. There should be no change for windows.

@NeerajDwivedii
NeerajDwivedii force-pushed the add_sql_attr_ansi_impl branch from ed02db1 to 5fc0b2b Compare August 25, 2026 07:51
@NeerajDwivedii
NeerajDwivedii force-pushed the add_sql_attr_ansi_impl branch from 5fc0b2b to 7bb446a Compare August 25, 2026 08:18
@sachinpro
sachinpro marked this pull request as ready for review August 26, 2026 09:32
@sachinpro
sachinpro requested a review from a team as a code owner August 26, 2026 09:32
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