mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 563 forks source link

Get the diagnostics messages more often #1245

Closed keitherskine closed 9 months ago

keitherskine commented 1 year ago

Diagnostic messages (e.g. SQL error messages) are retrieved after executing a SQL query. However, the diagnostic messages were being retrieved only for a return value of SQL_SUCCESS_WITH_INFO. This should be extended for other return values.

Function GetDiagRecs has been changed to add diagnostic messages to the "messages" cursor attribute rather than replace the attribute. Deciding when to clear the "messages" attribute should happen outside GetDiagRecs.

Fixes #1238 .

Note, Github Actions no longer supports Python 2.7.

Ref: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/return-codes-odbc https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlexecdirect-function?view=sql-server-ver16#returns https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlmoreresults-function?view=sql-server-ver16#returns

mkleehammer commented 7 months ago

This is being referenced in #1238. I really don't remember this, but it is closed. Is this something that I need to reimplement? @keitherskine