Setting RaiseError as you do will cause an exception to be thrown on all errors (except I think errors during the connect() call). That means that $dbh->prepare should either throw an exception or return a valid statement handle.
Also, testing with mysql throws an error only when you execute the query object. Oracle might behave differently ofcourse:
output:use strict; use warnings; use DBI; my $dbh = DBI->connect( "dbi:mysql:test", "root", "", {AutoCommit => 0 +, RaiseError => 1, PrintError => 0}) || die "Can't connect to databas +e: $DBI::errstr"; my $qry = $dbh->prepare(q{ select BAD__column from users where id=1254 +3256 }) or die "Prepare bad: $DBI::errstr"; $qry->execute();
DBD::mysql::st execute failed: Table 'test.users' doesn't exist at tes +t.pl line 8. Issuing rollback() for database handle being DESTROY'd without explici +t disconnect().
In reply to Re: $DBI::errstr is always undef
by Joost
in thread $DBI::errstr is always undef
by spivey3587
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |