The DBI docs also have a written-out example for that, giving you the advantage of speed combined with the ease of hash access, something like:
my %rec; my $sth = $dbh->prepare ("select region, sales from sales_by_region"); $sth->execute; $sth->bind_columns (\(@rec{@{$sth->{NAME_lc}}})); while ($sth->fetch) { print "$rec{region}: $rec{sales}\n"; }
In reply to Re: DBI Hash of Column name values
by Tux
in thread DBI Hash of Column name values
by avrono
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |