Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Re: DBI specification change

by aufrank (Pilgrim)
on Jul 18, 2002 at 16:06 UTC ( #182879=note: print w/replies, xml ) Need Help??

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."
"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!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://182879]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-03-18 21:59 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.