in reply to (jeffa) 2Re: Perl DBI problem
in thread Perl DBI problem

Hi jeffa,

Fair enough, I don't use that method as I prefer what might be known as the long hand approach. You are probably correct. I haven't tried RaiseError so if you or anyone else could answer the following I'd be grateful (and may even change my mind as to how to go about doing error exceptions ;).

My understanding is this: $DBI::errstr method returns the native database engine error message from the last driver function called. Does using RaiseError do exactly the same thing? And AFAIR RaiseError is used to "force errors" - will it implicitly 'die' on any error?

I'm just another monk trying to learn from my peers and betters.
barrd

Replies are listed 'Best First'.
(jeffa) 4Re: Perl DBI problem
by jeffa (Bishop) on Jun 14, 2003 at 14:40 UTC
    The "long hand" approach? Doesn't sound very Perlish. ;)

    Anyway, hate to do this to you, but you should have RTFM'ed:

    `RaiseError' (boolean, inherited) The `RaiseError' attribute can be used to force errors to raise exceptions rather than simply return error codes in the normal way. It is "off" by default. When set "on", any method which results in an error will cause the DBI to effectively do a `die("$class $method failed: $DBI::errstr")', where `$class' is the driver class and `$method' is the name of the method that failed. E.g., DBD::Oracle::db prepare failed: ... error text here ... If you turn `RaiseError' on then you'd normally turn `PrintError' off. If `PrintError' is also on, then the `PrintError' is done first (naturally).
    Happy coding :)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      ++jeffa,

      :^) yup, I am a lazy sod, thanks for that. I'll slap a vote your way when I get some more 'ammo'. And I fully deserved all the down votes on this thread -- "must try harder"...

      barrd - the lazy monkey