From: | Dave Page <dpage(at)vale-housing(dot)co(dot)uk> |
---|---|
To: | "'Hiroshi Inoue'" <Inoue(at)tpf(dot)co(dot)jp>, Zoltan Kovacs <tip(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu> |
Cc: | pgsql-odbc <pgsql-odbc(at)postgresql(dot)org> |
Subject: | RE: Error handling in ODBC |
Date: | 2001-06-14 08:04:38 |
Message-ID: | 8568FC767B4AD311AC33006097BCD3D61A2C3A@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: 14 June 2001 07:27
> To: Zoltan Kovacs
> Cc: pgsql-odbc
> Subject: [ODBC] Error handling in ODBC
>
>
> Hi all,
>
> Recently I found the case that NOTICE causes an error in
> ODBC while examining Kristis' error report.
>
> It seems that NOTICE had never been the cause of SQL_ERROR
> before Zoltan's change about a year ago. Before his change
> *NOTICE* only caused a PGRES_NONFATAL_ERROR and SC_execute()
> returned SQL_SUCCESS_WITH_INFO. However currently *ERROR*
> also causes a PGRES_NONFATAL_ERROR and SC_Execute() returns
> SQL_ERROR. Why was this changed ? I'd like to put it back if
> there's no reason.
Morning,
Actually this is a big problem for me (not what you are proposing, but
NOTICES in general). I'm trying to implement EXPLAIN in pgAdmin. Query Plans
are returned by the backend in a notice, which the ODBC driver happily seems
to log (if logging is switched on) and then do nothing with them (from
connection.c):
case 'N':
SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
qlog("NOTICE
from backend during clear: '%s'\n", cmdbuffer);
break;
...
case 'N': /* NOTICE: */
SOCK_get_string(sock, cmdbuffer,
ERROR_MSG_LENGTH);
res = QR_Constructor();
QR_set_status(res, PGRES_NONFATAL_ERROR);
QR_set_notice(res, cmdbuffer); /* will dup
this string */
mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
qlog("NOTICE from backend during send_query:
'%s'\n", cmdbuffer);
continue;
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.
As I said, this is a real issue for me, obviously NOTICEs probably shouldn't
raise an error that a client app might think is an actual problem, on the
other hand it would be *really* useful to be able to access them somehow.
The only way I could think of that's not completely horrendous would be to
add another info type to SQLGetInfo - say PGLastNotice.
Regards, Dave.
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2001-06-14 10:08:46 | Re: Error handling in ODBC |
Previous Message | Hiroshi Inoue | 2001-06-14 06:51:18 | Re: ODBC Interface version 07_01_0005, problem with C++ exceptions |