DBD::mysql 3.0004+ not resetting $sth->{Active} after fetch



Hello,

I upgraded DBD::mysql from 2.9006-1 to 3.0006-1 and suddenly started
getting
screens full of errors like:

prepare_cached(SELECT * FROM foo) statement handle
DBIx::ContextualFetch::st=HASH(0x971cc80) still Active at
/usr/share/perl5/Ima/DBI.pm line 381

After some digging it seems that the new version of the DBD::mysql is
failing
to reset the Active attribute on the sth after fetching all the rows.
The
following test script shows this.

#!env perl

use strict;
use warnings;
use DBI;

my $dbh=DBI->connect(
'DBI:mysql:host=localhost;database=test',
'test' => '',
{ RaiseError => 1, PrintError => 1 }
);

my $sql = 'SELECT 1';

my $sth = $dbh->prepare_cached($sql);
print "Prepared active:",$sth->{Active},"\n";
$sth->execute;
print "Executed active:",$sth->{Active},"\n";
while ( $sth->fetchrow_hashref ) { }
print "Fetched active:",$sth->{Active},"\n";

# Prep again to see if we get Still Active warning
$sth = $dbh->prepare_cached($sql);

__END__

On a Debian System with
Linux jhary.itn.local 2.6.16-1-686 #1 Tue Mar 21 14:51:09 UTC 2006 i686
GNU/Linux
DBI 1.50
Perl v5.8.8 built for i486-linux-gnu-thread-multi
DBD::mysql 3.0006-1 or 3.0004-1

$ perl test-dbd-mysql.pl
Prepared active:
Executed active:1
Fetched active:1
prepare_cached(SELECT 1) statement handle DBI::st=HASH(0x82bb238) still
Active
at test-dbd-mysql.pl line 26

If I drop back to DBD::mysql 2.9006-1 it works again.

$ perl test-dbd-mysql.pl
Prepared active:
Executed active:1
Fetched active:

I can't test any other versions as the CPAN source won't complile on
this box
(Mysql deb doesn't seem to include mysql_config which the dbd make
wants)
and apt only offers me these versions.
Calling finish on the handle does reset the flag with any of the dbd
versions.
Playing with the mysql_server_prepare option doesn't seem to make any
difference.

Is anyone else seeing this? It seems odd that it didn't get spotted
through a
couple of release versions (although debian seem to be packaging the
developer
releases).

cheers,
mark
--






MARK ADDISON
WEB DEVELOPER

200 GRAYS INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4678
F
E MARK.ADDISON@xxxxxxxxx
WWW.ITN.CO.UK
Please Note:



Any views or opinions are solely those of the author and do not necessarily represent
those of Independent Television News Limited unless specifically stated.
This email and any files attached are confidential and intended solely for the use of the individual
or entity to which they are addressed.
If you have received this email in error, please notify postmaster@xxxxxxxxx

Please note that to ensure regulatory compliance and for the protection of our clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.

.



Relevant Pages

  • Re: DBD::mysql 3.0004+ not resetting $sth->{Active} after fetch
    ... $ perl test-dbd-mysql.pl ... WEB DEVELOPER ... Any views or opinions are solely those of the author and do not necessarily represent ... Please note that to ensure regulatory compliance and for the protection of our clients and business, ...
    (perl.dbi.users)
  • Informix DBD (on Win2k) build problems and solutions (or saving the world)
    ... >> The DBD make process makes several references to this path but does not ... Suggested Fixes/changes to called Perl lib modules ... I believe that the points in this section would be primarily of interest to "would-be" DBD-on-Win2K builders, or Informix DBD builders. ... My MSVC++ installation process apparently did not update my PATH to support the compiler command line tools needed by the esql test and build processes. ...
    (perl.dbi.users)
  • RE: Cant make DBD: a solution on HP-UX 11.00 with Oracle 9i
    ... I followed most of reccomendations from Garry Ferguson ... The most important difference concerns the LINKTYPE of dbi and dbd. ... by perl, compiled in 32 bits, right. ... Aren't the two lib dirs in LD_LIBRARY_PATH needed for sqlplus ...
    (perl.dbi.users)
  • RE: perl DBD and DBI for 64 bit perl
    ... Here's the error I get when I try to compile the DBD:. ... Below you'll find my level of Perl and the dbd and dbi ... Here are the versions I'm trying to compile as well as the perl version. ...
    (perl.dbi.users)
  • Re: DBD-Oracle-1.14 and Oracle 9i
    ... > perl itself was built with the same 64bit model as Oracle wants to use. ... me it was enough to build DBI and DBD without any parameters and it ... compile fine, ...
    (perl.dbi.users)