Two related questions (prompted by a question from people using
DBD::Informix):

1.  Are there any known problems with $sth->fetchall_arrayref({}, 50);?
2.  Are there any requirements on a DBD module to make the limit on
fetchall_arrayref({}, 50) notation work, or is it purely a DBI feature?

Test code:

#!/usr/bin/env perl
use strict;
use warnings;
use DBI;

my $dbh = DBI->connect('dbi:Informix:stores', '', '') or die "Horribly 1";
my $sth = $dbh->prepare(q{SELECT * FROM Elements}) or die "Horribly 2";
$sth->execute;

#my $res = $sth->fetchall_arrayref;        # Works
#my $res = $sth->fetchall_arrayref({}, 50);    # Fails: no data
#my $res = $sth->fetchall_arrayref([], 50);    # Fails: no data
#my $res = $sth->fetchall_arrayref([0,1,2]);    # Works
my $res = $sth->fetchall_arrayref([0,1,2], 50);   # Fails: no data
#my $res = $sth->fetchall_arrayref({});    # Works
#my $res = $sth->fetchall_arrayref(undef, 50);  # Fails: no data
foreach my $row (@{$res})
{
    # Use this section for printing arrays
    foreach my $value (@{$row})
    {
        printf "%s ", $value;
    }
    print "\n";
    # Use this section for printing hashes
    #foreach my $key (sort keys %{$row})
    #{
    #    printf "%-15s = %s\n", $key, $row->{$key};
    #}
}

$dbh->disconnect;

Choose your own driver and database, etc; choose your own table (my table of
elements has entries for hydrogen through ununoctium - 1..118; 50 is about
half the table).  It seems that fetchall_arrayref() works fine with no
arguments and with slice arguments, but none of the slice versions with a
maximum count does anything.

Am I missing something?  Or is there a bug?

Perl 5.13.4 on MacOS X 10.6.5; DBI 1.615, DBD::Informix 2008.0513.

-- 
Jonathan Leffler <jonathan.leff...@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."

Reply via email to