Subject: | fetchall_arrayref([], $n) return is undefined |
In DBI-1.616, fetchall_arrayref() works, but fetchall_arrayref([], $n)
does not. The latter form returns an undefined value, even when there
are valid rows. Both forms work in DBI-1.601.
The environment where I saw the problem is:
Linux x64 (Arch Linux, kernel ver 2.6.38.5)
perl 5.12.3
Informix 11.50FC8
DBD-Informix 2008.0513
DBI-1.616
Subject: | bug_fetchrow_arrayref.pl |
#!/usr/bin/perl -w
#
# DBD::Informix Example - fetchall_arrayref
#
# @(#)$Id: x03fetchrow_arrayref.pl,v 100.1 2002/02/08 22:50:08 jleffler Exp $
#
# Copyright 1998 Jonathan Leffler
# Copyright 2000 Informix Software Inc
# Copyright 2002 IBM
use DBI;
my $DATABASE="optifacts";
my $TABLE="blocks";
printf("DEMO1 Sample DBD::Informix Program running.\n");
printf("Variant: using fetchall_arrayref()\n");
my($dbh) = DBI->connect("DBI:Informix:$DATABASE") or die;
my($sth) = $dbh->prepare("SELECT * FROM $TABLE") or die;
$sth->execute() or die;
my($row_ref);
$row_ref = $sth->fetchall_arrayref([], 1000); # this fails. row_ref is undefined.
#$row_ref = $sth->fetchall_arrayref(); # this works.
my (@rows) = @{$row_ref};
printf("%d rows fetched\n",scalar(@rows));
for ($i = 0; $i <= $#rows; $i++) {
my (@row) = @{$rows[$i]};
for ($j = 0; $j <= $#row; $j++) {
printf("%8s ", $row[$j]);
}
printf("\n");
}
undef $sth;
$dbh->disconnect();
printf("\nDEMO1 Sample Program over.\n\n");