On Sun, 14 Nov 2004 00:22:35 +0300 Илья Кантор <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] || [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php