On Sun, Mar 23, 2008 at 03:59:23PM -0000, Greg Sabino Mullane wrote:
> 
> I noticed a failing test when using DBI 1.603 on DBD::Pg and
> tracked the error back to this new line inside of pure-perl
> fetchall_arrayref in DBI.pm:
> 
> return undef if $max_rows and not $sth->{Active};
> 
> As far as I can tell, $sth at this point is the *driver's* statement
> handle, and not DBI::st, and thus is not tied, so the value
> always returns false (undef), regardless of whether or not the
> statement is active or not.

Uh. Sorry. Hopefully that'll teach me to make changes without writing tests!

And perhaps to wait a few days longer before announcing the new release :)

> I could not find an easy way to get to the DBI::st information. Here's
> a patch to the test suite that demonstrates the problem:

Great. Thanks Greg. Here's the fix:

--- DBI.pm      (revision 10918)
+++ DBI.pm      (working copy)
@@ -1953,7 +1953,7 @@
         # when batch fetching with $max_rows were very likely to try to
         # fetch the 'next batch' after the previous batch returned
         # <=$max_rows. So don't treat that as an error.
-        return undef if $max_rows and not $sth->{Active};
+        return undef if $max_rows and not $sth->FETCH('Active');
 
        my $mode = ref($slice) || 'ARRAY';
        my @rows;

New DBI release to follow...

Tim.

Reply via email to