in reply to Re: DBI dots
in thread DBI dots

I find setting RaiseError should be nearly mandatory for DBI. Either during connect:
$dhb = DBI->connect($dbi, $user, $pass, { RaiseError => 1 });
Or after the fact with the magic tied hash interface:
$dbh->{RaiseError} = 1;
Then you get an automatic die for each error return from DBI. Very cool.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Re: DBI dots
by jptxs (Curate) on Oct 23, 2000 at 20:38 UTC

    well...

    I do a bunch of stuff that is not really needed to succeed interms of what success is for the whole program. I don't know if I want every whine from the database to kill me off - especially if it's something as trivial as a disconnect or something like that.

    "sometimes when you make a request for the head you don't
    want the big, fat body...don't you go snickering."
                                             -- Nathan Torkington UoP2K a.k.a gnat

      This may be true, but using {RaiseError} gets you into good habits, just like use strict does -- it might be painful at first, but after you get used to it you never have to worry about certain annoying little things again. This leaves your mind ready for certain annoying big things :)
        Yes, and you can always use an eval {} block around a bunch of code, or a local value for RaiseError in a block.

        The default should still be die to require you to think about why something might break. Yes, it's like use strict.

        -- Randal L. Schwartz, Perl hacker