Bob Hunter wrote:
I have a better question for you.
I make extensive use of the following Pg method, which
returns the value of the given record and field
number:
$sth->getvalue($rn,$fn)
In particular, I use statements like
$sth->getvalue($rn+$i,$fn-$j)
where the the number of record/field are displaced by
variables. As far as I can see DBI has a method to
work one row at the time, in sequence. This is way too
simple to handle the case above. I looked for a more
powerful DBI method, but it does not seem to exist. Is
it so? Does DBI have an equivalent to Pg' method
"getvalue"?
The DBI docs show:
"selectall_arrayref"
$ary_ref = $dbh->selectall_arrayref($statement);
$ary_ref = $dbh->selectall_arrayref($statement, \%attr);
$ary_ref = $dbh->selectall_arrayref($statement, \%attr,
@bind_values);
This utility method combines "prepare", "execute" and
"fetchall_arrayref" into a single call. It returns a reference to
an array containing a reference to an array for each row of data
fetched.
So you would do something like:
my $resultset = $dbh->selectall_arrayref($stmt);
my $datum = $resultset->[$rownum]->[$colnum];