pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gustavo Amarilla Santacruz <gusamasan@gmail.com>
To: Bill Moran <wmoran@potentialtech.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Error code
Date: Tue, 22 Sep 2009 10:20:11 -0400
Message-ID: <e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com> (raw)
In-Reply-To: <20090922093815.7b8ae05f.wmoran@potentialtech.com>
References: <e4ea2d810909210756s547417d6x7ecfb1d8300623e8@mail.gmail.com>
	<4AB821BD.6070508@gmail.com>
	<e4ea2d810909220617s63921795nedc17fa61b7d49f9@mail.gmail.com>
	<20090922093815.7b8ae05f.wmoran@potentialtech.com>

Thank you, Bill.
I can not use the numeric error code such as 23505 ( by coding convention );
I need to do this:


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

include( "PostgresqlErrorList.php" );
 .
 .
 .
 if( $errorCode == $UNIQUE_VIOLATION )
 echo( "message" );




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


Here, "PostgresqlErrorList.php" is a file included in  PHP libraries. This
file would can contain code such as:



<php?
    $UNIQUE_VIOLATION      = 23505;
    $DATETIME_FIELD_OVERFLOW  = 22008;
   .
   .
   .
?>


Exists this file for in Postgresql-PHP library?

On Tue, Sep 22, 2009 at 9:38 AM, Bill Moran <wmoran@potentialtech.com>wrote:

> In response to Gustavo Amarilla Santacruz <gusamasan@gmail.com>:
>
> > 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 )
>
> if ( $errorCode == '23505' )
>
> --
> Bill Moran
> http://www.potentialtech.com
> http://people.collaborativefusion.com/~wmoran/
>



-- 
Gustavo Amarilla
ISMEB

view thread (7+ messages)  latest in thread

Message-ID: <e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com>
Permalink:  ../e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com/
Also on:    postgresql.org/message-id/e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: gusamasan@gmail.com, wmoran@potentialtech.com
  Subject: Re: Error code
  In-Reply-To: <e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com>
  References: <e4ea2d810909210756s547417d6x7ecfb1d8300623e8@mail.gmail.com> <4AB821BD.6070508@gmail.com> <e4ea2d810909220617s63921795nedc17fa61b7d49f9@mail.gmail.com> <20090922093815.7b8ae05f.wmoran@potentialtech.com> <e4ea2d810909220720i38860764sd5366878325cd4f2@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox