Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RaiseError doesn't raise an error when $sth passed to wrong $dbh #28

Closed
jeffjanes opened this issue Jun 26, 2017 · 1 comment
Closed

Comments

@jeffjanes
Copy link

If I am in RaiseError mode and want to use one of the database handle method which can take a statement in lieu of a string, it doesn't raise an error if it points to a disconnected database. Could the disconnected handle keep track that it was in RaiseError=>1 mode even after being discontinued?

perl -wle 'use strict; use Data::Dumper; use DBI; my $dbh=DBI->connect("dbi:Pg:",undef,undef,{RaiseError=>1}); my $sth=$dbh->prepare("select * from pgbench_accounts limit 5"); $dbh->disconnect(); $dbh=DBI->connect("dbi:Pg:",undef,undef,{RaiseError=>1}); my $x=$dbh->selectrow_array($sth); print Dumper $x; print $DBD::Pg::VERSION; print $sth->errstr'

$VAR1 = undef;

3.6.2
Cannot call execute on a disconnected database handle

@machack666
Copy link
Collaborator

Hi @jeffjanes I think this is handled inside of DBI itself; the RaiseError attribute isn't handled in the code at all. I would expect you to see a similar issue/error with any other DBD module.

Since this is an inherited attribute and the DBH is undefined at the point this error is raised, I'm not seeing how/where we can accomplish this without stashing the individual attributes when creating STHs, which might be worth doing.

I'm adding this to the future ideas list to consider, but not considering this a bug at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants