On Fri, Jan 16, 2004 at 02:59:07PM +0100, Steffen Goeldner wrote:
> 
> Tim Bunce wrote:
> 
> >   join "\n", ...
> >
> > Very old (pre perl5!) versions of the DBI spec (or DBPerl as it then was)
> > mentioned that specifically. I'll add it to the DBI docs.
> 
> Indeed, that's what actually happens (for $errstr). But $err is
> another story (and don't ask for $state).
> Imagine that my Errors collection contains exactly one error most
> of the time, but may contain warnings and errors. Error codes
> have the first bit set (if the ADO provider plays well). Then
> I'll do something like this:
> 
>   for ( @Errors ) {
>     $errstr .= $_->Description . ... . $_->Number ...
>     $err    |= $_->Number;
>   # $state   = $_->SQLState  # ???
>   }
>   $err = 0 unless $err & 1 << 31;  # solely warnings
>   $h->set_err( $err, $errstr );
> 
> To compensate for a loss of information in $err, these values are
> part of $errstr too.

I think it would be good have set_err() append the old err and/or old
state (if either are set, normally err wouldn't be) to the old errstr:

   "olderrstr [DBI err=olderr state=oldstate]\n" . newerrstr

And also not let a warning/info set_err change err if err is already true.

And finally, I figure I could specify that err is an empty string
for "info" and err is zero for warning - just in case someone cares.

Tim.

Reply via email to