Re: [PATCH] pg_result_error_field
| From: | Marcus Boerger | Date: | Sun, 14 Nov 2004 15:21:16 +0000 |
| Subject: | Re: [PATCH] pg_result_error_field | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-13834@lists.php.net to get a copy of this message | ||
Hello Antony,
Sunday, November 14, 2004, 2:15:07 PM, you wrote:
> 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.
Also please no patches for 5.0 or even 4. New functionality can only
be done for HEAD.
--
Best regards,
Marcus mailto:helly@php.net