pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SQLGetDiagRec should not clear error.
2+ messages / 2 participants
[nested] [flat]

* SQLGetDiagRec should not clear error.
@ 2014-04-10 19:01  Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Heikki Linnakangas @ 2014-04-10 19:01 UTC (permalink / raw)
  To: 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


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: SQLGetDiagRec should not clear error.
@ 2014-04-10 23:43  Michael Paquier <michael.paquier@gmail.com>
  parent: Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2014-04-10 23:43 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: pgsql-odbc

On Fri, Apr 11, 2014 at 4:01 AM, Heikki Linnakangas
<hlinnakangas@vmware.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


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-04-10 23:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-10 19:01 SQLGetDiagRec should not clear error. Heikki Linnakangas <hlinnakangas@vmware.com>
2014-04-10 23:43 ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox