Author: timbo
Date: Mon Dec 6 05:47:25 2004
New Revision: 600
Modified:
dbi/trunk/lib/DBI/DBD.pm
Log:
Added note that DESTROY for sth should call finish.
Modified: dbi/trunk/lib/DBI/DBD.pm
==============================================================================
--- dbi/trunk/lib/DBI/DBD.pm (original)
+++ dbi/trunk/lib/DBI/DBD.pm Mon Dec 6 05:47:25 2004
@@ -994,7 +994,7 @@
my ($sth, @bind_values) = @_;
# start of by finishing any previous execution if still active
- $sth->finish if $sth->{Active};
+ $sth->finish if $sth->FETCH('Active');
my $params = (@bind_values) ?
[EMAIL PROTECTED] : $sth->FETCH('drv_params');
@@ -1039,7 +1039,7 @@
my $data = $sth->FETCH('drv_data');
my $row = shift @$data;
if (!$row) {
- $sth->{Active} = 0; # mark as no longer active
+ $sth->STORE(Active => 0); # mark as no longer active
return undef;
}
if ($sth->FETCH('ChopBlanks')) {
@@ -1086,6 +1086,13 @@
Remember that they must have names that begin with your drivers
registered prefix so they can be installed using install_method().
+If DESTROY() is called on a statement handle that's still active
+($sth->{Active} is true) then it should effectively call finish().
+
+ sub DESTROY {
+ my $sth = shift;
+ $sth->finish if $sth->FETCH('Active');
+ }
=head2 Tests