Now I see, but that is specific to your implementation, so I don't see the
use/need for it in standard DBI interface.  Anyone?

Ilya 

-----Original Message-----
From: Wilson, Doug
To: Sterin, Ilya; 'raptor '; '[EMAIL PROTECTED] '
Sent: 9/5/01 11:11 AM
Subject: RE: selectall_hashref()


> From: raptor

> I want a litle more extended sytax for selectall_hashref(), 
> or if u can
> tell
> me how the achieve this :
> 
> my $Query = qq{SELECT field1, field2, field3};
> my $res = $dbh->selectall_hashref($Query, {field1=>1, 
> field2=>1}, %attr)
> so as a result i get the following HoH :
> 
> $$res{field1}{field2} = $field3;

You're going to have to do this yourself in a fetch loop
(unless you supply the patches to Tim yourself :)

E.g.:

my $sth = $dbh->prepare($Query);
$sth->bind_columns(\my ($field1, $field2, $field3));
my %res;
while ($sth->fetch) {
 $res{$field1}{$field2} = $field3;
}

HTH,
Douglas Wilson

Reply via email to