C Hagstrom wrote:
> Thanks to all for the suggestions
> (the speed and number of the responses was great)
>
> I'm going to run with Puneet's suggestion:
>
> # Fetch the results as a ref to an AofH
> my $res = $sth->fetchall_arrayref({});
> # Assign the ref to a var in the template
> $t->param(RES => $res);
>
> for the simple reason:
>
> "Specify the column names you want to retrieve,
> and the column names automatically become
> the names of the TMPL_VARs."
>
> This seems the simplest way to go for my application
> From what I understand, working with hash_ref 's
> is supposed to be inefficient (performance-wise),
> but in my case, I'm pursuing such a light
> weight database that I don't think it's an issue.
ya, possibly. As you say, given your situation (and, I daresay, for most
common situations), simplicity weighs heavier than speed.
You can always achieve more speed by tweaking other things (faster
database, better db structure, cached templates, mod_perl or some other
persistent perl, faster hardware and more memory).
I always, always, err toward simplicity.
Good luck.
|