allan wrote:
1) i found that the PostgreSQL custom functions seem to return *stringIck. You should try to avoid this kind of eval stuff if at all possible. It's slow and hard to debug.
concatenations* of the results-set. so in those functions i will loop
over the results and end up with a return string that looks like this:
$cust_id = 1; $cust_name = "allan";
in my perl code i will then do an eval like
my $ret = $sth->fetchrow_hashref->{postgres_function"};
eval($ret);
2)That's not so hot either, because now the template knows about database stuff, has to deal with any db errors, etc.
my $sth = $DBH->prepare->{'select statement'};
my $vars = {
'sth' => $sth, }
2)
loop inside of the template
WHILE (ref = sth.fetchrow_hashref);
...
ref = ref.next; END;
The most obvious way to do it is to simply query the database, put the results into your own data structure, and pass that to the template. There are things like Class::DBI which can automate some of that if your database structure is appropriate.
By the way, fetchrow_hashref() is slow. You'll get much better performance from using bind_params() with fetch().
- Perrin
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates
