Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

www.xxxcon, which comes first ob_start or session, wwwxxx/58/2010, xxxxdup, xxxxdup, mailx informatii, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, mysql feiertage, bash netcat eof, 192.168.1.41:8000

Links

XODOX
Impressum

#1: capturing errors

Posted on 2010-01-29 17:06:03 by Jaime Casanova

--0015174c0c38e7b01a047e4fd00b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

I'm trying to capture the error from php to show an informative
message to the user but i haven't managed to get it...

i'm using pg_result_error_field() but when i print it i get nothing,
is there something i have to configure or what i'm doing bad.
attached a little php script for testing and here is the schema the
script is using (obviously the error i'm trying to catch here is
unique violation)
"""
create table t1_fk1(col1 integer primary key);
insert into t1_fk1 values(1);
"""
--=20
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

--0015174c0c38e7b01a047e4fd00b
Content-Type: application/x-php; name="prueba.php"
Content-Disposition: attachment; filename="prueba.php"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_g51639nj0

PD9waHAKCSRkYmNvbm4gPSBwZ19jb25uZWN0KCJkYm5hbWU9cHJ1ZWJhcyBo
b3N0PWxvY2FsaG9zdCB1c2VyPXBvc3RncmVzIHBhc3N3b3JkPXBvc3RncmVz
Iik7CgoJJHJlc3VsdCA9IEBwZ19xdWVyeSgkZGJjb25uLCAiaW5zZXJ0IGlu
dG8gdDFfZmsxIHZhbHVlcyAoMSkiKTsKIAkkc3FsX3N0YXRlID0gcGdfcmVz
dWx0X2Vycm9yX2ZpZWxkKCRyZXN1bHQsIFBHU1FMX0RJQUdfU1FMU1RBVEUp
OwoJZWNobyAkc3FsX3N0YXRlOwoJaWYgKCEkcmVzdWx0KSB7CgkJJHJlczEg
PSBwZ19nZXRfcmVzdWx0KCRkYmNvbm4pOwoJCWV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19TT1VSQ0VfRlVOQ1RJT04pOyAKCX0KPz4K

--0015174c0c38e7b01a047e4fd00b
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


--=20
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php

--0015174c0c38e7b01a047e4fd00b--

Report this message

#2: Re: capturing errors

Posted on 2010-01-29 17:11:01 by Jaime Casanova

On Fri, Jan 29, 2010 at 11:06 AM, Jaime Casanova
<jcasanov@systemguards.com.ec> wrote:
> Hi,
>
> I'm trying to capture the error from php to show an informative
> message to the user but i haven't managed to get it...
>

i failed to say that i'm using pg 8.4.2 and php5


--=20
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

--=20
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php

Report this message

#3: Re: capturing errors

Posted on 2010-01-29 18:01:32 by Jaime Casanova

On Fri, Jan 29, 2010 at 11:06 AM, Jaime Casanova
<jcasanov@systemguards.com.ec> wrote:
>
> i'm using pg_result_error_field() but when i print it i get nothing,
> is there something i have to configure or what i'm doing bad.
> attached a little php script for testing and here is the schema the
> script is using (obviously the error i'm trying to catch here is
> unique violation)

seems like i have to use pg_send_query() for the
pg_result_error_field() function to be used, but the problem is that
this is asynchronous could be a problem if i use transactions?

--=20
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

--=20
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php

Report this message