SQLGetDiagRec should not clear error. - Mailing list pgsql-odbc

From Heikki Linnakangas
Subject SQLGetDiagRec should not clear error.
Date
Msg-id 5346EA8A.5080902@vmware.com
Whole thread Raw
Responses Re: SQLGetDiagRec should not clear error.  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-odbc
A colleague of mine pointed out that calling SQLGetDiagRec on a
connection, after the connection has failed, clears the current error.
The consequence is that if you call SQLGetDiagRec twice, and the first
call returns an error, the second call might return no error. According
to the ODBC spec:

> Calls to SQLGetDiagRec are nondestructive to the header and record
> fields. The application can call SQLGetDiagRec again at a later time to
> retrieve a field from a record as long as no other function, except
> SQLGetDiagRec, SQLGetDiagField, or SQLError, has been called in the interim.

Digging into the commit log, the code line that clears the error message
in CC_get_error has been there since the very first commit.

I pushed a patch to fix that, removing the line in CC_get_error that
clears the error number. I also added a regression test that
demonstrates the issue.

- Heikki


pgsql-odbc by date:

Previous
From: Barry Bell
Date:
Subject: Re: FW: ODBC 9.3.0210 not commiting, Discard ALL
Next
From: Michael Paquier
Date:
Subject: Re: SQLGetDiagRec should not clear error.