On Monday, December 10, 2001, at 11:45 PM, Matisse Enzer wrote:
> Hi folks.
Hi Matisse.
>
> I'm looking for feedback on this...
>
>
> You would write:
>
> my $sql = "SELECT name,address FROM $table WHERE zipcode=?";
> my $found_rows = $wrapper->FetchAll("$sql","$zipcode");
> # $found_rows is an array_ref of hash_refs
>
>
This seems to be covered by the standard DBI method
selectall_hashref. I actually missed it, because I was searching
for fetchall_hashref (any possibility of that becoming a synonym,
Tim?)
"selectall_hashref"
$ary_ref = $dbh->selectall_hashref($statement);
$ary_ref = $dbh->selectall_hashref($statement, \%attr);
$ary_ref = $dbh->selectall_hashref($statement,
\%attr, @bind_value$
This utility method combines the prepare, execute, and
fetchrow_hashref entries elsewhere in this document
into a single call. It returns a reference to an array
containing, for each row of data fetched, a reference
to a hash containing field name and value pairs for
that row.
The $statement parameter can be a previously prepared
statement handle, in which case the "prepare" is
skipped. This is recommended if the statement is going
to be executed many times.