From: | Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com> |
---|---|
To: | Bill Moran <wmoran(at)potentialtech(dot)com> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: Error code |
Date: | 2009-09-22 15:54:27 |
Message-ID: | e4ea2d810909220854s791fdb7cpe1333f5a20e802fa@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Thank you, all.
I will have all proposals in mind.
On Tue, Sep 22, 2009 at 11:08 AM, Bill Moran <wmoran(at)potentialtech(dot)com>wrote:
> In response to Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)com>:
>
> > 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:
> >
> >
> >
> > <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(at)potentialtech(dot)com
> >wrote:
> >
> > > In response to Gustavo Amarilla Santacruz <gusamasan(at)gmail(dot)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/<http://people.collaborativefusion.com/%7Ewmoran/>
> > >
> >
> >
> >
> > --
> > Gustavo Amarilla
> > ISMEB
>
>
> --
> Bill Moran
> http://www.potentialtech.com
> http://people.collaborativefusion.com/~wmoran/<http://people.collaborativefusion.com/%7Ewmoran/>
>
--
Gustavo Amarilla
ISMEB
From | Date | Subject | |
---|---|---|---|
Next Message | Marco Dieckhoff | 2009-10-05 21:34:32 | checking select query syntax and semantics via php without executing |
Previous Message | Bill Moran | 2009-09-22 15:08:35 | Re: Error code |