On Tue, Aug 14, 2007 at 11:17:26AM +1000, Stuart Cooper wrote:
> > First off, I had no idea it existed until I started going through a dbi
> > tutorial. The idea is you don't have to litter your code with "or
> > die..." statements.

I recommend that everyone who doesn't carefully read the release notes
(ie the Changes file extract I post with each release announcement)
should reread the DBI docs at least every couple of years.

> > Is it good practice to use this or is an explicit "or die..." better
> > because you can "see" there is error trapping?
> 
> I think setting the RaiseError and PrintError attributes on your database
> handle is the best way to do these things.
> 
> $dbh = DBI->connect($DSN, $user, $pass, { RaiseError => 1, PrintError => 0, 
> ...

Yes, ShowErrorStatement just tweaks the behaviour of RaiseError and PrintError.

  $dbh = DBI->connect($DSN, $user, $pass, { RaiseError => 1, PrintError => 0, 
ShowErrorStatement => 1, ...

Tim.

Reply via email to