Re: [PATCH] pg_result_error_field

From: Date: Sun, 14 Nov 2004 13:15:07 +0000
Subject: Re: [PATCH] pg_result_error_field
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-13833@lists.php.net to get a copy of this message
On Sun, 14 Nov 2004 00:22:35 +0300 Илья Кантор <ilia@obnovlenie.ru> wrote: > > In many situations one needs to know what caused the error > And probably receive additional information about it > (e.g which foreign key constraint failed). > > I attach tiny patches giving access to > PQresultErrorField function. > > Error messages may need adjustment. > > Tested on PHP 5.0.2 > > Example of usage: (from DB class) > > pg_send_query($this->link, 'INSERT INTO b VALUES(5)'); > $res = pg_get_result($this->link); > echo pg_result_error_field($res, PGSQL_DIAG_MESSAGE_DETAIL)); This patch doesn't compile for me with Postgres 7.4, because PGSQL_DIAG_* macros first appeared in 8.0 beta1, as far as I can see. So, please, add appropriate ifdefs and checks to config.m4 to make it compile with older versions. Btw, I think it would be reasonable to wait for stable realease of 8.0, as PG developers could change this macros and/or they behaviour. -- Wbr, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com

« previous php.internals (#13833) next »