On Wed, Jan 28, 2004 at 07:42:00AM -0000, Avis, Ed wrote:
> Tim Bunce <[EMAIL PROTECTED]> wrote:
> 
> >>You'd get questions from beginners saying 'I get $sth->{NAME} but it
> >>is always undef, what am I doing wrong?'.  The answer is probably
> >>that you need to execute() first.  An error message would make this
> >>obvious.
> 
> >FETCH is marked as a 'keep_error' method. That means that err &
> >errstr are not cleared before the call and not checked (for
> >RaiseError etc) after it.
> >
> >I'm reluctant to change that as any code that fetches an attribute
> >after a method call but before checking $h->err (or $DBI::err) will
> >now not see the error.
> 
> So it is not possible for the various attributes fetched via the hash
> interface to give an error.

That's right, currently.

> - But in the case of RaiseError = 1, which was the original reason for
> suggesting an exception be thrown, it would be possible for attribute
> fetches to raise an error without breaking compatibility?

I think I can implement for DBI v1 what I envisaged for v2.
Then it would work so long as drivers set errors using set_err().

> So the meaning of RaiseError would be a bit more than at present; as
> well as throwing exceptions for set_err() database operations, it
> would also enable some error checking for other things like {NAME}.

The meaning would remain the same really, it's just that for some
methods it would only be triggered for 'new' errors that happened
during the method call, but that's a subtle distinction.

Tim.

Reply via email to