in reply to Re: DBI specification change
in thread DBI specification change
this actually already exists and is very useful. the method you're looking for is fetchall_arrayref( {} )
from the docs:
"When passed a hash reference, fetchall_arrayref uses /fetchrow_hashref to fetch each row as a hash reference. If the parameter hash is empty then fetchrow_hashref is simply called in a tight loop and the keys in the hashes have whatever name lettercase is returned by default from fetchrow_hashref."
and
"To fetch all fields of every row as a hash ref:
$tbl_ary_ref = $sth->fetchall_arrayref({});"
going through each row then looks something like:
foreach my $hashref_row (@$tbl_ary_ref) { foreach my $field (sort keys %$hashref_row) { my $value = $hashref_row->{$field}; } }
there's a good chance my use of references is off in the 3rd line, but at least I tried :)
hope that's what you were looking for!
--au
|
---|
In Section
Meditations