On 11/14/06, Steve Green <[EMAIL PROTECTED]> wrote:
Robert Hicks wrote:
> 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 $@ has an error.

You should probably avoid eval just because it spawns a separate perl
process each time, so if this is some code that is getting hit a lot,
you could really tax your server.


The PrintError, RaiseError, and HandleError attributes of a DBI handle
provide useful ways of dealing with errors that the database returns.

This is the standard way of detecting errors with DBI.

--  SG

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>





--
~Tyler

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to