DBI in a web context

I have a couple forms for an in-house application. The user fills out
the fields and then submits which update a back end Oracle database.

I have looked for examples but can't really find anything.

How is it best to catch errors when doing DBI stuff in web applications?
Wrap the insert "code" in an eval statement? Croak or die statements? I
am thinking eval because I can set autocommit to "off" and then do
rollbacks if $ [at] has an error.

Suggestions and comments welcome?

Robert
sigzero [ Fr, 10 November 2006 21:40 ] [ ID #1531609 ]

RE: DBI in a web context

I would definitely wrap the entire transaction in an eval {}. But, I'm
not sure if I would croak/die when a failure occurs vs. report the error
and go back.

rr

-----Original Message-----
From: Robert Hicks [mailto:sigzero [at] gmail.com]
Sent: Friday, November 10, 2006 1:40 PM
To: dbi-users [at] perl.org
Subject: DBI in a web context

I have a couple forms for an in-house application. The user fills out
the fields and then submits which update a back end Oracle database.

I have looked for examples but can't really find anything.

How is it best to catch errors when doing DBI stuff in web applications?

Wrap the insert "code" in an eval statement? Croak or die statements? I
am thinking eval because I can set autocommit to "off" and then do
rollbacks if $ [at] has an error.

Suggestions and comments welcome?

Robert

This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended
to be for the use of the individual or entity named above. If you are =
not the
intended recipient, please be aware that any disclosure, copying, =
distribution
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.
Ron.Reidy [ Fr, 10 November 2006 22:14 ] [ ID #1531611 ]

Re: DBI in a web context

In my case I would probably report and return. Easy enough to do for
what I am dong.

Robert

Reidy, Ron wrote:
> I would definitely wrap the entire transaction in an eval {}. But, I'm
> not sure if I would croak/die when a failure occurs vs. report the error
> and go back.
>
> rr
>
> -----Original Message-----
> From: Robert Hicks [mailto:sigzero [at] gmail.com]
> Sent: Friday, November 10, 2006 1:40 PM
> To: dbi-users [at] perl.org
> Subject: DBI in a web context
>
> I have a couple forms for an in-house application. The user fills out
> the fields and then submits which update a back end Oracle database.
>
> I have looked for examples but can't really find anything.
>
> How is it best to catch errors when doing DBI stuff in web applications?
>
> Wrap the insert "code" in an eval statement? Croak or die statements? I
> am thinking eval because I can set autocommit to "off" and then do
> rollbacks if $ [at] has an error.
>
> Suggestions and comments welcome?
>
> Robert
>
> This electronic message transmission is a PRIVATE communication which contains
> information which may be confidential or privileged. The information is intended
> to be for the use of the individual or entity named above. If you are not the
> intended recipient, please be aware that any disclosure, copying, distribution
> or use of the contents of this information is prohibited. Please notify the
> sender of the delivery error by replying to this message, or notify us by
> telephone (877-633-2436, ext. 0), and then delete it from your system.
>
sigzero [ Fr, 10 November 2006 22:22 ] [ ID #1531612 ]

Re: DBI in a web context

Read up on how to connect in the first place - you can pass
a switch that tells it to return errors to you, instead of killing
your whole script.

Look here:-
http://search.cpan.org/~pythian/DBD-Oracle-1.19/Oracle.pm#pl sql_errstr
and search for "RaiseError"

"Robert Hicks" <sigzero [at] gmail.com> wrote in message
news:20061110204022.18141.qmail [at] lists.develooper.com...
>I have a couple forms for an in-house application. The user fills out the
>fields and then submits which update a back end Oracle database.
>
> I have looked for examples but can't really find anything.
>
> How is it best to catch errors when doing DBI stuff in web applications?
> Wrap the insert "code" in an eval statement? Croak or die statements? I am
> thinking eval because I can set autocommit to "off" and then do rollbacks
> if $ [at] has an error.
>
> Suggestions and comments welcome?
>
> Robert
dispo41 [ Do, 16 November 2006 12:53 ] [ ID #1538616 ]
Perl » perl.dbi.users » DBI in a web context

Vorheriges Thema: How should I connect via DBD::Oracle to efficiently obtain 2000+ simultaneous connections?
Nächstes Thema: Possible Problem with bind_param