RE: Error handling in ODBC
От | Dave Page |
---|---|
Тема | RE: Error handling in ODBC |
Дата | |
Msg-id | 8568FC767B4AD311AC33006097BCD3D61A2C3A@woody.vale-housing.co.uk обсуждение исходный текст |
Ответ на | Error handling in ODBC ("Hiroshi Inoue" <Inoue@tpf.co.jp>) |
Список | pgsql-odbc |
> -----Original Message----- > From: Hiroshi Inoue [mailto:Inoue@tpf.co.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.
В списке pgsql-odbc по дате отправления: