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

iODBC loses any diagnostics posted during SQLDriverConnect(W) #82

Open
matthew-wozniczka opened this issue Dec 14, 2022 · 0 comments
Open
Assignees

Comments

@matthew-wozniczka
Copy link

matthew-wozniczka commented Dec 14, 2022

I was looking into a test which was failing in iODBC (3.52.8, .9, and .15), but not in any version of unixODBC.

The issue was that the call to SQLDriverConnectW was returning SQL_SUCCESS_WITH_INFO, but when the application tried to retrieve diagnostics using SQLGetDiagRecordW, there were none (i.e. it returned SQL_NO_DATA even for RecNumber == 1). Looking into the driver logs, the driver was posting a warning during the connect.

I was looking at the source, and I believe the issue (haven't had the time to actually debug it thoroughly) is that after calling into the driver's implementation of SQLDriverConnect(W), iODBC is calling _iodbcdm_dbcdelayset, which ends up calling SQLGetInfo(W) in the driver (& possibly also other functions if the application set any connection attributes before the SQLDriverConnect(W) call), which ends up resetting the diagnostics exposed by the driver (since the ODBC model is that the exposed diagnostics are always for the preceding ODBC API call on the handle), and there's no logic in iODBC to preserve the diagnostics exposed by the driver directly after the SQLDriverConnect(W) call, so they are simply lost.

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

No branches or pull requests

2 participants