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. One could add an attr() method just for this, but it would be a pain to change the documentation to recommend getting $sth->attr('NAME') rather than $sth->{NAME}, and the difference between the two. - 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? 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}. -- Ed Avis <[EMAIL PROTECTED]>