Error code
am 21.09.2009 16:56:17 von Gustavo Amarilla Santacruz
--000feaf2043943436c047417b077
Content-Type: text/plain; charset=ISO-8859-1
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.
Thank you, in advance.
-----------------------
Gustavo Amarilla
ISMEB: I am Sorry, My English is Bad.
--000feaf2043943436c047417b077
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello all.
How I can get the postgres error code from PH=
P?. I can get the error text, but I need error code to verbose ( and countr=
y dependient) messages.
Thank you, in advance.
v>
-----------------------=A0
Gus=
tavo Amarilla
ISMEB: I am Sorry, My English is Bad.
--000feaf2043943436c047417b077--
Re: Error code
am 22.09.2009 03:00:45 von dmagick
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/
--
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php
Re: Error code
am 22.09.2009 15:17:21 von Gustavo Amarilla Santacruz
--000fea892bfb4b8e7404742a6ce1
Content-Type: text/plain; charset=ISO-8859-1
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 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
--000fea892bfb4b8e7404742a6ce1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Thank you, Chris.
Now, I need to do this in PHP:
iv>
-------------------- CODE -------------------------------=
--------------------------------
ple-style-span" face=3D"'courier new', monospace">$errorCode = =
pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;
ace">
urier new', monospace">if( $errorCode == UNIQUE_VIOLATION )<=
/div>
=
echo( "message 1" );
-style-span" face=3D"'courier new', monospace">else if( $errorCode =
===A0
-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2p=
x; ">
ace">DATETIME_FIELD_OVERFLOW=A0
e=3D"font-size: small; -webkit-border-horizontal-spacing: 0px; -webkit-bord=
er-vertical-spacing: 0px; ">
ourier new', monospace">)
ace"> echo( "message 2" );
=
-------------------- CODE -------------------------------------------------=
--------------
How I can do it?; how I can compare
t class=3D"Apple-style-span" face=3D"'courier new', monospace">$err=
orCode with a Postgres error name ( as in=A0
stgresql.org/docs/8.1/static/errcodes-appendix.html">http:// www.postgresql.=
org/docs/8.1/static/errcodes-appendix.html=A0).
Thank you, again.
te">On Mon, Sep 21, 2009 at 9:00 PM, Chris
<
"mailto:dmagick@gmail.com" target=3D"_blank">dmagick@gmail.com>
n> wrote:
x #ccc solid;padding-left:1ex">Gustavo Amarilla Santacruz wrote:
x #ccc solid;padding-left:1ex">
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.
d.php" target=3D"_blank">http://www.php.net/manual/en/function.pg-r esult-er=
ror-field.php
seems to be the best fit.
--
Postgresql & php tutorials
http://www.desig=
nmagick.com/
--
Gustavo Amarilla=
--000fea892bfb4b8e7404742a6ce1--
Re: Error code
am 22.09.2009 16:20:11 von Gustavo Amarilla Santacruz
--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:
$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
--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:
=
div>
------------------------ CODE ---------------------=
--------------------------------------
ier new', monospace">include( "PostgresqlErrorList.php" );
ont>
nt class=3D"Apple-style-span" face=3D"'courier new', monospace"> =
font>
=3D"Apple-style-span" face=3D"'courier new', monospace">
pan>
ce">.
=3D"Apple-style-span" face=3D"'courier new', monospace">
pan>
ce">.
=3D"Apple-style-span" face=3D"'courier new', monospace">
pan>
ce">.
=3D"Apple-style-span" face=3D"'courier new', monospace">
pan>
nt class=3D"Apple-style-span" face=3D"'courier new', monospace"> =
font>
monospace">if( $errorCode == $UNIQUE_VIOLATION )
=3D"Apple-style-span" face=3D"'courier new', monospace"> =
span>
ace">echo( "message" );
----=
-------------------- CODE -------------------------------------------------=
----------
Here, "PostgresqlEr=
rorList.php" is a file included in =A0PHP libraries. This file would c=
an contain code such as:
e-span" face=3D"'courier new', monospace"><php?
>
> =A0$UNIQUE_VIOLATION =A0 =A0 = 23505;
ace"> =A0$
12px; border-collapse: collapse; ">
=3D"'courier new', monospace">DATETIME_FIELD_OVERFLOW=A0
an>
e"> = 22008;
ace"> .
9;courier new', monospace"> .
le-style-span" face=3D"'courier new', monospace"> .
iv>
ace">?>
Exists this file =
for in Postgresql-PHP library?
On =
Tue, Sep 22, 2009 at 9:38 AM, Bill Moran
<
ailto:wmoran@potentialtech.com">wmoran@potentialtech.com> wro=
te:
x #ccc solid;padding-left:1ex;">In response to Gustavo Amarilla Santacruz &=
lt;>:
> Thank you, Chris.
> Now, I need to do this in PHP:
>
> -------------------- CODE
> ------------------------------------------------------------ ---
>
> $errorCode =3D pg_result_error_field($res1, PGSQL_DIAG_SQLSTATE) ;
>
> if( $errorCode == UNIQUE_VIOLATION )
if ( $errorCode == '23505' )
--
Bill Moran
http://www.poten=
tialtech.com
">http://people.collaborativefusion.com/~wmoran/
--
Gustavo Amarilla=
ISMEB
--00c09f88d0f31e851d04742b4de1--
Re: Error code
am 22.09.2009 17:08:35 von Bill Moran
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/
--
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php
Re: Error code
am 22.09.2009 17:54:27 von Gustavo Amarilla Santacruz
--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.
=3D"gmail_quote">On Tue, Sep 22, 2009 at 11:08 AM, Bill Moran
ltr"><wmoran@potentialtech.c=
om> wrote:
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>In response to Gustavo Amarilla Santacruz <
gmail.com">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 == $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 = 23505;
> =A0 =A0 $DATETIME_FIELD_OVERFLOW = 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 <
an@potentialtech.com">wmoran@potentialtech.com>wrote:
>
> > In response to Gustavo Amarilla Santacruz <
usamasan@gmail.com">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 == UNIQUE_VIOLATION )
> >
> > if ( $errorCode == '23505' )
> >
> > --
> > Bill Moran
> >
http:/=
/www.potentialtech.com
> >
et=3D"_blank">http://people.collaborativefusion.com/~wmoran/
> >
>
>
>
> --
> Gustavo Amarilla
> ISMEB
--
--
Gustavo Ama=
rilla
ISMEB
--000feae9fe125ce2cb04742c9e74--