Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SQLGetInfo for MS Access #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

staticlibs
Copy link
Contributor

The ODBC client used in MS Access (also known as Microsoft Jet) has specific requirements to the SQLGetInfo driver function. First, it requires SQL_ODBC_API_CONFORMANCE to be supported. Second, it requires the output parameter StringLengthPtr to be set by driver even when the InfoValuePtr is set to non-character (integer) value. Otherwise it fails with Reserved error (-7701); message and disconnects immediately after the successfull connection.

This change adds a new helper StoreWithLength and applies it to all non-character usages in SQLGetInfo and in SQLGetConnectAttr functions. With it MS Access can establish the connection and start running SQL queries. Though, it still fails on schema introspectio (more Jet-specific fixes are needed in driver), so #39 remains open for now.

Testing: length check for non-character data is added to the existing test.

@staticlibs staticlibs changed the title Imrove SQLGetInfo for MS Access Improve SQLGetInfo for MS Access Feb 18, 2025
@staticlibs staticlibs force-pushed the access_sqlgetinfo_len branch from 649fadb to 4839bb4 Compare February 18, 2025 22:33
The ODBC client used in MS Access (also known as Microsoft Jet) has
specific requirements to the `SQLGetInfo` driver function. First, it
requires `SQL_ODBC_API_CONFORMANCE` to be supported. Second, it
requires the output parameter `StringLengthPtr` to be set by driver even
when the `InfoValuePtr` is set to non-character (integer) value.
Otherwise it fails with `Reserved error (-7701);` message and
disconnects immediately after the successfull connection.

This change adds a new helper `StoreWithLength` and applies it to all
non-character usages in `SQLGetInfo` and in `SQLGetConnectAttr`
functions. With it MS Access can establish the connection and start
running SQL queries. Though, it still fails on schema introspectio
(more Jet-specific fixes are needed in driver), so duckdb#39 remains open for
now.

Testing: length check for non-character data is added to the existing
test.
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.

1 participant