Skip to content

Commit 24d7642

Browse files
committed
Fix the $sth->{Active} fix (1682ad6) properly so it only applies to sth.
1 parent 1682ad6 commit 24d7642

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/DBD/Gofer.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@
551551
go_last_insert_id_args => $lii_args,
552552
go_cache => $go_cache,
553553
});
554-
$sth->STORE(Active => 0);
554+
$sth->STORE(Active => 0); # XXX needed? It should be the default
555555

556556
my $skip_prepare_check = $policy->skip_prepare_check($attr, $dbh, $statement, $attr, $sth);
557557
if (not $skip_prepare_check) {

lib/DBI/PurePerl.pm

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,14 +504,19 @@ sub _setup_handle {
504504
$h_inner->{$_} = $parent->{$_}
505505
if exists $parent->{$_} && !exists $h_inner->{$_};
506506
}
507-
if (ref($parent) =~ /::db$/) {
507+
if (ref($parent) =~ /::db$/) { # is sth
508508
$h_inner->{Database} = $parent;
509509
$parent->{Statement} = $h_inner->{Statement};
510510
$h_inner->{NUM_OF_PARAMS} = 0;
511+
$h_inner->{Active} = 0; # driver sets true when there's data to fetch
511512
}
512-
elsif (ref($parent) =~ /::dr$/){
513+
elsif (ref($parent) =~ /::dr$/){ # is dbh
513514
$h_inner->{Driver} = $parent;
515+
$h_inner->{Active} = 0;
514516
}
517+
else {
518+
warn "panic: ".ref($parent); # should never happen
519+
}
515520
$h_inner->{dbi_pp_parent} = $parent;
516521

517522
# add to the parent's ChildHandles
@@ -536,11 +541,11 @@ sub _setup_handle {
536541
$h_inner->{LongReadLen} ||= 80;
537542
$h_inner->{ChildHandles} ||= [] if $HAS_WEAKEN;
538543
$h_inner->{Type} ||= 'dr';
544+
$h_inner->{Active} = 1;
539545
}
540546
$h_inner->{"dbi_pp_call_depth"} = 0;
541547
$h_inner->{"dbi_pp_pid"} = $$;
542548
$h_inner->{ErrCount} = 0;
543-
$h_inner->{Active} = 0; # driver should set true when there's data to fetch
544549
}
545550

546551
sub constant {

0 commit comments

Comments
 (0)