Re: SQLGetDiagRec should not clear error.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: "pgsql-odbc(at)postgresql(dot)org" <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: SQLGetDiagRec should not clear error.
Date: 2014-04-10 23:43:55
Message-ID: CAB7nPqQbC33CUcGBJYyL-pR2J+gL1pDaDGJXbuyiJVMJpe2JQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On Fri, Apr 11, 2014 at 4:01 AM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> 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.
s/called again:./called again:/g
Thanks,
--
Michael

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Heikki Linnakangas 2014-04-11 12:16:51 UseDeclareFetch bugs, found & fixed
Previous Message Heikki Linnakangas 2014-04-10 19:01:30 SQLGetDiagRec should not clear error.