Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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();
output:
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().


Comment on Re: $DBI::errstr is always undef
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-08-23 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (169 votes), past polls