Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2D6A162E7C6 for ; Tue, 22 Sep 2009 11:20:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48805-05 for ; Tue, 22 Sep 2009 14:20:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mail.postgresql.org (Postfix) with ESMTP id CEA39633E8A for ; Tue, 22 Sep 2009 11:20:34 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 9so1018894qwb.61 for ; Tue, 22 Sep 2009 07:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=ghUkvvB7/BRIphClb9Sb+RRtblicaCPleha5aZKGbZk=; b=BizQbcQtX7oJ/hAz8YkkFiX7p4U/arluZsD/y3bf1TrqadaUYsbKjsjHFQ/Poc5bqA LHa59gqhRj53jNXsurSk8CQuEJkIV92+YwcppMJHbsRojc5v8qvE+UQD2QJ1FVYaf4fO Fdo5n3A6DujaBjfDgREMF5+1hv7628xsHyXeg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=I6H+yAZISqmbS1LHuchiqmWWugEQUffahOjMHprAFC51Up9GEyGsl4pUlB/iR/R4Xj znrx0mMdPc2eoK0Evr1sRiL4aDb0EEml0wf+7OTevVBO8VB7ttNCUHNHDWexhWvFKeP8 JMJ7qkpr1BB74e5sw7hM/hCom3a+QOPkWPo3k= MIME-Version: 1.0 Received: by 10.224.36.91 with SMTP id s27mr719162qad.136.1253629233103; Tue, 22 Sep 2009 07:20:33 -0700 (PDT) In-Reply-To: <20090922093815.7b8ae05f.wmoran@potentialtech.com> References: <4AB821BD.6070508@gmail.com> <20090922093815.7b8ae05f.wmoran@potentialtech.com> From: Gustavo Amarilla Santacruz Date: Tue, 22 Sep 2009 10:20:11 -0400 Message-ID: Subject: Re: Error code To: Bill Moran Cc: pgsql-php@postgresql.org Content-Type: multipart/alternative; boundary=00c09f88d0f31e851d04742b4de1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.714 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_FONT_FACE_BAD=0.884, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200909/19 X-Sequence-Number: 4077 --00c09f88d0f31e851d04742b4de1 Content-Type: text/plain; charset=ISO-8859-1 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: Exists this file for in Postgresql-PHP library? On Tue, Sep 22, 2009 at 9:38 AM, Bill Moran wrote: > In response to Gustavo Amarilla Santacruz : > > > 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 --00c09f88d0f31e851d04742b4de1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you, Bill.

I can not use the numeric error code su= ch as=A023505 ( by coding convention ); I need to do this:


------------------------ CODE ---------------------= --------------------------------------

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




----= -------------------- CODE -------------------------------------------------= ----------


Here, "PostgresqlEr= rorList.php" is a file included in =A0PHP libraries. This file would c= an contain code such as:



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


Exists this file = for in Postgresql-PHP library?

On = Tue, Sep 22, 2009 at 9:38 AM, Bill Moran <wmoran@potentialtech.com> wro= te:
In response to Gustavo Amarilla Santacruz &= lt;gusamasan@gmail.com>:

> Thank you, Chris.
> Now, I need to do this in PHP:
>
> -------------------- CODE
> ---------------------------------------------------------------
>
> $errorCode =3D pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;
>
> if( $errorCode =3D=3D UNIQUE_VIOLATION )

if ( $errorCode =3D=3D '23505' )

--
Bill Moran
http://www.poten= tialtech.com
http://people.collaborativefusion.com/~wmoran/



--
Gustavo Amarilla=
ISMEB

--00c09f88d0f31e851d04742b4de1--