Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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().

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]
[stevieb]: Nick... can you include a comma-separated list to the operation, or a wildcard?
[1nickt]: yes, comma-sep (if you mean the html input attr). This ^ is for the human label :-)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2017-07-22 19:13 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (340 votes). Check out past polls.