I’ve made a patch to fetchall_hashref to handle
multiple column key. Selectall_hashref will inherit the same result and syntax.
Here is an example: For tables with a multiple columns primary key, an array
reference can be specified: $sth = $dbh->prepare("SELECT date, account,
revenue, profit FROM TABLE"); $sth->execute; $hash_ref = $sth->fetchall_hashref([qw(date account)]);
# or $hash_ref = $sth->fetchall_hashref([1,2]); print "Revenue for account 42 on 2005-02-18 is
$hash_ref->{'2005-02-18'}{42}{revenue}\n"; Thanks, Tim, for answering my questions. Zhuang (John) Li |
DBI-1.47.your_foo.patch
Description: DBI-1.47.your_foo.patch