Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3F7BC632FF8 for ; Tue, 22 Sep 2009 12:55:03 -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 60235-06 for ; Tue, 22 Sep 2009 15:54:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qy0-f204.google.com (mail-qy0-f204.google.com [209.85.221.204]) by mail.postgresql.org (Postfix) with ESMTP id 9A33A6308AD for ; Tue, 22 Sep 2009 12:54:52 -0300 (ADT) Received: by qyk42 with SMTP id 42so3078905qyk.28 for ; Tue, 22 Sep 2009 08:54:51 -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=p+uOo7LhqbhZSxGTLxZ/DjjiOTIRZ7ls50J7SRI7fsY=; b=C8nmY7hz05os9/IS4yoklGMWbT9eHt3xS1BDSMqL09tZbcsJaE87ELe4J2zY/Lpf/+ gkwltdRR9TF1qODsG75DXCJUiXlexf3VsPDyZWHqDqWx5b/G5O8BsFVILCSthvLvRQOd E87dMMf2GVEKgjqgODyWbEfE2K05IzQzQUJB8= 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=aKtjl0HHmtMEqt+y77bzHvCc2e1EdbIOhMjgBlxjnuHL3br7pSpqK3s7ukc8F56ERj awHxD34JkubmdPo3pKDdc4Pt3B6OzDzzAXDO9yRApBdu7B8iCDUdeB6YijVBuCUrBcrG gVaIgS4IsBF0CTGnHjp7TcAffZxX13yCFWfrY= MIME-Version: 1.0 Received: by 10.224.94.198 with SMTP id a6mr841057qan.251.1253634891112; Tue, 22 Sep 2009 08:54:51 -0700 (PDT) In-Reply-To: <20090922110835.a8c5b2b4.wmoran@potentialtech.com> References: <4AB821BD.6070508@gmail.com> <20090922093815.7b8ae05f.wmoran@potentialtech.com> <20090922110835.a8c5b2b4.wmoran@potentialtech.com> From: Gustavo Amarilla Santacruz Date: Tue, 22 Sep 2009 11:54:27 -0400 Message-ID: Subject: Re: Error code To: Bill Moran Cc: pgsql-php@postgresql.org Content-Type: multipart/alternative; boundary=000feae9fe125ce2cb04742c9e74 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200909/21 X-Sequence-Number: 4079 --000feae9fe125ce2cb04742c9e74 Content-Type: text/plain; charset=ISO-8859-1 Thank you, all. I will have all proposals in mind. On Tue, Sep 22, 2009 at 11:08 AM, Bill Moran wrote: > In response to Gustavo Amarilla Santacruz : > > > Thank you, Bill. > > I can not use the numeric error code such as 23505 ( by coding convention > ); > > I need to do this: > > That's fine. Note, however, that those codes are not numeric. > Also, you'll be better served putting them in constants, to avoid > bugs where the values are accidentally changed. > > > > > > > ------------------------ 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: > > > > > > > > > $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 >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 > > > -- > Bill Moran > http://www.potentialtech.com > http://people.collaborativefusion.com/~wmoran/ > -- Gustavo Amarilla ISMEB --000feae9fe125ce2cb04742c9e74 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you, all.

I will have all proposals in mind.

On Tue, Sep 22, 2009 at 11:08 AM, Bill Moran <wmoran@potentialtech.c= om> wrote:
In response to Gustavo Amarilla Santacruz <gusamasan@gmail.com>:

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

That's fine. =A0Note, however, that those codes are not numeric.<= br> Also, you'll be better served putting them in constants, to avoid
bugs where the values are accidentally changed.

>
>
> ------------------------ CODE
> -----------------------------------------------------------
>
> include( "PostgresqlErrorList.php" );
> =A0.
> =A0.
> =A0.
> =A0if( $errorCode =3D=3D $UNIQUE_VIOLATION )
> =A0echo( "message" );
>
>
>
>
> ------------------------ CODE
> -----------------------------------------------------------
>
>
> Here, "PostgresqlErrorList.php" is a file included in =A0PHP= libraries. This
> file would can contain code such as:
>
>
>
> <php?
> =A0 =A0 $UNIQUE_VIOLATION =A0 =A0 =A0=3D 23505;
> =A0 =A0 $DATETIME_FIELD_OVERFLOW =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>wrote:
>
> > In response to Gustavo Amarilla Santacruz <gusamasan@gmail.com>:
> >
> > > Thank you, Chris.
> > > Now, I need to do this in PHP:
> > >
> > > -------------------- CODE
> > > ------------------------------------------------------------= ---
> > >
> > > $errorCode =3D pg_result_error_field($res1, PGSQL_DIAG_SQLST= ATE) ;
> > >
> > > if( $errorCode =3D=3D UNIQUE_VIOLATION )
> >
> > if ( $errorCode =3D=3D '23505' )
> >
> > --
> > Bill Moran
> > http:/= /www.potentialtech.com
> > http://people.collaborativefusion.com/~wmoran/
> >
>
>
>
> --
> Gustavo Amarilla
> ISMEB


--



--
Gustavo Ama= rilla
ISMEB
--000feae9fe125ce2cb04742c9e74--