MySQL Forums
Forum List  »  Perl

Re: Problem with DBI error handling
Posted by: Bill Karwin
Date: November 04, 2006 05:56PM

It's better to check the return value of $sth3->execute(). This is guaranteed to be a true result even if the statement affected zero rows. See documentation for the DBI method execute() at: http://search.cpan.org/~timb/DBI-1.53/DBI.pm#execute

For example:

$result = $sth3->execute();
if (!$result) {
  # handle error, output #sth3->errstr, etc.
}

Also note that $sth3->err is reset to undef before every DBI call, according to the docs. So this might explain why you aren't able to test for it. I'm not sure why RaiseError isn't helping in this case, though.

Regards,
Bill K.

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with DBI error handling
November 04, 2006 05:56PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.