On Thu, Oct 21, 2004 at 08:47:48AM -0500, Dave Cash wrote:
>> while (my $rowref = $sth->fetchrow_hashref) {
>> foreach (my $href = $rowref) {
>> my %result = %{ $href };
>> push @notes, \%result;
>> }
>> }
> Perhaps I'm not following exactly what you're trying to do, but
> could you just do this?
>
> push @notes, $rowref while my $rowref = $sth->fetchrow_hashref;
According to the DBI documentation, this would be dangerous. Future
versions of DBI may reuse the hashref it returns,
--8<--
Currently, a new hash reference is returned for each row. This
will change in the future to return the same hash ref each time, so
don't rely on the current behaviour.
--8<�-
So it is safer to do
push @notes, {%$rowref} while my $rowref = $sth->fetchrow_hashref;
but
$sth->fetchall_arrayref({});
was very cute. I've never seen that before.
--
Trond Michelsen
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates