RE: Error handling in ODBC

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Hiroshi Inoue'" <Inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-odbc <pgsql-odbc(at)postgresql(dot)org>
Subject: RE: Error handling in ODBC
Date: 2001-06-18 12:21:10
Message-ID: 8568FC767B4AD311AC33006097BCD3D61A2C60@woody.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue(at)tpf(dot)co(dot)jp]
> Sent: 18 June 2001 07:06
> To: Dave Page
> Cc: pgsql-odbc
> Subject: Re: [ODBC] Error handling in ODBC
>
>
> Dave Page wrote:
> >
> > > -----Original Message-----
> > > From: Hiroshi Inoue [mailto:Inoue(at)tpf(dot)co(dot)jp]
> > > Sent: 14 June 2001 11:09
> > > To: Dave Page
> > > Cc: Zoltan Kovacs; pgsql-odbc
> > > Subject: Re: [ODBC] Error handling in ODBC
> > >
> > >
> > > Dave Page wrote:
> > > >
> > >
> > > [snip]
> > >
> > > >
> > > > As far as I can tell, it is then not possible to access
> the notice
> > > > from a client app (cetainly SQLError won't return it in my
> > > test prog,
> > > > yet I can quite happily get a real error from an
> invalid query for
> > > > example.
> > > >
> > >
> > > Hmm it may be possible that SQLERROR returns a notice
> message in an
> > > appropriate condition(?????) though I'm not sure.
> >
> > Unfortunately I'm not really familiar enough with either C
> or the guts
> > of the driver to know or be able to figure out in a
> reasonable amount
> > of time (though I have spent hours staring at the code :-)) what
> > exactly it is/is trying to do. I do know it's not doing
> what I need it
> > to :-(, and - I suspect - what it should be doing (though these are
> > not necessarily one and the same).
> >
>
> IMHO *ERROR* messages should return SQL_ERROR with the
> SQLSTATE <> "00000". As for NOTICEs we seem to be able to
> change the driver to return SQL_SUCCESS_WITH_INFO and let the
> succeeding SQLError() to return the NOTICE message.

Yes. That (in theory) should do exactly what I need, and sounds like it's
how it should work anyway (as I understand ODBC anyway).

> However
> I've not recognized the circumstances why both ERRORs and
> (some) NOTICEs return SQL_ERROR with the SQLSTATE = '00000' now.

I noticed that in connection.c, CC_send_query loops waiting waiting for a
message from the backend. If it is 'N' then the notice is raised as a
PGRES_NONFATAL_ERROR, but, if it is a 'C', then another loop is entered
processing messages until an 'I' is received. If an 'N' is received in this
loop then is basically gets ignored as far as I can tell.

Does this help at all or have I missed the point completely? :-)

Regards, Dave.

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Rangachari Anand 2001-06-18 12:21:21 Escaping calls to procedures
Previous Message Dariusz Pietrzak 2001-06-18 09:25:26 Re: Feature request -> autoreconnect.