err()
$handle->err()This function returns any error codes from the last driver method call. Here is an example:
...
my $dbh = DBI->connect('DBI:mysql:bookstore:localhost','russell',
'wrong_password')
|| die DBI->err();Notice the err() method is added to the
end of the database handle as part of the die
function from Perl. Here are the results of executing this
connect() with the wrong password:
DBI connect('bookstore:localhost','russell',...) failed:
1045 at ./dbi_test_program.plx line 8...Notice that the function err() only
returns the error code 1045 from the MySQL server. The rest of the
text is from Perl in general.