-
Notifications
You must be signed in to change notification settings - Fork 57
Description
I've been working on cleaning up our SDK's implementation of SQLEndTran, and had some confusion when it came to the case where it's called on an environment handle, specifically about diagnostics, see the following for details: lurcher/unixODBC#224 (I'm also interested in any of your thoughts on how exactly diagnostics should work in this scenario)
As part of that, I was looking at how iODBC & UnixODBC implemented it, and I noticed that neither of them are following what's specified on MSDN: https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlendtran-function?view=sql-server-ver17
Specifically,
For an ODBC 3.x driver, if HandleType is SQL_HANDLE_ENV and Handle is a valid environment handle, then the Driver Manager will call SQLEndTran in each driver associated with the environment. The Handle argument for the call to a driver will be the driver's environment handle.
In iODBC, I've followed the logic to see that SQLEndTran(SQL_HANDLE_ENV, ...) ends up being handled here:
Line 1272 in ca979a8
| retcode |= _iodbcdm_transact (pdbc, fType); |
I have verified that the Windows DM (on Windows 11, at least) does call SQLEndTran(SQL_HANDLE_ENV, ...) into the driver itself