Hi

I need to understand why selectrow_array() return only one column (first
column) when called in list context as in the code below. On the otherhand
selectrow_arrayref behaves correctly.

code
=====

if ($x){
        print "When using selectrow_array(), DBI returned:";
        print "\$x: $x \$y: $y";

        print "\n\n";
}else{
        print "DB returned no data\n\n";

}

selectrow_arrayref behaves correctly.

my ($arrref) = $dbh->selectrow_arrayref(qq{
SELECT user,perm FROM access
WHERE token=\'Tt9VpStL4xADSDJQtd4AkMc6cVi66Mwmr9pMcCRgO4NVJ\'})|| die
"Could not query database:  $DBI::errstr\n";

my @retarr = @$arrref;

if (@retarr){
        print "When using selectrow_arrayref, DBI returned:";
        print "\@retarr contains: @retarr ";

        print "\n\n";
}else{
        print "DB returned no data\n\n";

}


Output
=========
perl misc_test.pl
Use of uninitialized value $y in concatenation (.) or string at
misc_test.plline 69.
When using selectrow_array(), DBI returned:$x: markb $y:

When using selectrow_arrayref, DBI returned:@retarr contains: markb ro


Installed versions
============
perl -MDBD::mysql -le 'print $DBD::mysql::VERSION;'
4.013
 perl -MDBI -le 'print $DBI::VERSION;'
1.609

Reply via email to