-
Notifications
You must be signed in to change notification settings - Fork 10
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
SQLGetDiagRec is unable to return the error message on Windows #56
Comments
The
The problem lies in the SQLGetDiagRec function, its current impl does not follow the spec, this bit is not implemented:
Because of this the number of characters is not returned and Windows ODBC Driver manager keeps calling I am working on a fix. |
According to ODBC spec: > If `MessageText` is `NULL`, `TextLengthPtr` will still return the > total number of characters (excluding the null-termination character > for character data) available to return in the buffer pointed to by > `MessageText`. Such length-only calls are actually used by the Windows ODBC Driver Manager. Currently messages are returned in garbled form on Windows. This change adds the logic to set the `TextLengthPtr` to the actual message length when the `MessageText` is specified as `NULL`. Note: the impl still can be improved to handle partial message reads better (cover existing TODO there). Testing: existing test is extended to cover this scenario. Fixes: duckdb#56
According to ODBC spec: > If `MessageText` is `NULL`, `TextLengthPtr` will still return the > total number of characters (excluding the null-termination character > for character data) available to return in the buffer pointed to by > `MessageText`. Such length-only calls are actually used by the Windows ODBC Driver Manager. Currently messages are returned in garbled form on Windows. This change adds the logic to set the `TextLengthPtr` to the actual message length when the `MessageText` is specified as `NULL`. Note: the impl still can be improved to handle partial message reads better (cover existing TODO there). Testing: existing test is extended to cover this scenario. Fixes: duckdb#56
This problem was discovered while testing the fix to #29 (see details there in comments).
With the latest nightly the following works correctly:
But the following fails:
The text was updated successfully, but these errors were encountered: