Re: Error code

Поиск
Список
Период
Сортировка
От Gustavo Amarilla Santacruz
Тема Re: Error code
Дата
Msg-id e4ea2d810909220617s63921795nedc17fa61b7d49f9@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Error code  (Chris <dmagick@gmail.com>)
Ответы Re: Error code  (Bill Moran <wmoran@potentialtech.com>)
Список pgsql-php
Thank you, Chris.

Now, I need to do this in PHP:

-------------------- CODE ---------------------------------------------------------------

$errorCode = pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;

if( $errorCode == UNIQUE_VIOLATION )
   echo( "message 1" );
else if( $errorCode == DATETIME_FIELD_OVERFLOW )
   echo( "message 2" );

-------------------- CODE ---------------------------------------------------------------


How I can do it?; how I can compare $errorCode with a Postgres error name ( as in http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html ).

Thank you, again.

On Mon, Sep 21, 2009 at 9:00 PM, Chris <dmagick@gmail.com> wrote:
Gustavo Amarilla Santacruz wrote:
Hello all.

How I can get the postgres error code from PHP?. I can get the error text, but I need error code to verbose ( and country dependient) messages.

http://www.php.net/manual/en/function.pg-result-error-field.php

seems to be the best fit.

--
Postgresql & php tutorials
http://www.designmagick.com/




--
Gustavo Amarilla

В списке pgsql-php по дате отправления:

Предыдущее
От: Chris
Дата:
Сообщение: Re: Error code
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Error code