Bug #15546 selectcol_arrayref failure with DBD::mysql 3.002_4

Submitted: 7 Dec 2005 8:57 Modified: 1 Feb 2006 23:40
Reporter: Giuseppe Maxia Email Updates:
Status: Closed Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S2 (Serious)
Version:3.0002_4 OS:Linux (Linux)
Assigned to: Bugs System CPU Architecture:Any

[7 Dec 2005 8:57] Giuseppe Maxia
Description:
With  the latest developmend version (3.002_4), selectcol_arrayref
does not work as expected. Instead of returning the first column
of the dataset, it returns undef.

Here is a test case:

#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use Data::Dumper;

my $HOST = 'localhost';

my $dbh = DBI->connect("DBI:mysql:test;host=$HOST"
     . ";mysql_read_default_file=$ENV{HOME}/.my.cnf",
     undef,undef, {RaiseError => 1})
     or die q{can't connect\n};

my $query = qq{show tables from test};
print $DBD::mysql::VERSION, "\n";
print Dumper($dbh->selectcol_arrayref($query));

Running this test with the previous versions, gives correct results:

3.0002
$VAR1 = [
           'testaa',
           'testad'
         ];

3.0002_2
$VAR1 = [
           'testaa',
           'testad'
         ];

In the latest version, though, it fails:

3.0002_4
$VAR1 = [
           undef,
           undef
         ];

Regards,

Giuseppe

How to repeat:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use Data::Dumper;

my $HOST = 'localhost';

my $dbh = DBI->connect("DBI:mysql:test;host=$HOST"
     . ";mysql_read_default_file=$ENV{HOME}/.my.cnf",
     undef,undef, {RaiseError => 1})
     or die q{can't connect\n};

my $query = qq{show tables from test};
print $DBD::mysql::VERSION, "\n";
print Dumper($dbh->selectcol_arrayref($query));

Suggested fix:
none
[9 Dec 2005 10:33] Aleksey Kishkin
Verified on slackware 10.2 against mysql 5.0.16/ perl v5.8.7 

$perl b16646.pl
3.0002_4
$VAR1 = [
          undef,
          undef
        ];
[1 Feb 2006 23:40] Patrick Galbraith
Thank you for finding this bug! It is now fixed with DBD::mysql 3.0002_5

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.