Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: $DBI::errstr is always undef

by Joost (Canon)
on Mar 02, 2007 at 22:05 UTC ( #602970=note: print w/ replies, xml ) Need Help??

in reply to $DBI::errstr is always undef

This looks like a bug in your DBD::Oracle but in any case you shouldn't be using RaiseError if you plan on testing the return codes.

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:

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 line 8. Issuing rollback() for database handle being DESTROY'd without explici +t disconnect().

Comment on Re: $DBI::errstr is always undef
Select or Download Code
Replies are listed 'Best First'.
Re^2: $DBI::errstr is always undef
by runrig (Abbot) on Mar 02, 2007 at 22:48 UTC
    MySQL doesn't really have a separate prepare phase, so it doesn't parse the statement until you execute it. I would expect setting RaiseError to cause Oracle to throw an error during prepare though.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://602970]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2015-11-29 09:10 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (750 votes), past polls