From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Stef Telford <stef(at)chronozon(dot)artofdns(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Trigger Function and Html Output |
Date: | 2001-04-01 16:35:35 |
Message-ID: | 3AC758D6.41FDD33C@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Stef Telford wrote:
>
> Hello,
> i find i must turn once again to the list for help, in what
> is probably another silly request.
That's what the list is for, and it's only silly if you already know the
answer :-)
> The long and short of it is this, I would like the view to
> return a html table. I understand that I can do this via a function
> and a trigger on select, massage the data, and then construct
> each line to simply be returned to the perl program. The only
> problem comes with, as far as i am aware, a trigger returns and
> is processed on a 'per line' basis for a select, so how would i
> get the view's column titles output for the table header ?
For this sort of stuff, I like to make as much use of Perl's DBI and
HTML templating modules as I can. For the templating, it's trivial to
write your own stuff for this sort of problem, but have a look at the
various modules on CPAN - there'll be something there for you.
I've got to admit, I try to avoid using SELECT * if I can - maybe it's
just me, but I've always felt if the database changes the code needs to
break. I'd rather get errors than unexpected results. IMHO of course.
> I ideally want to make as much of the perl construction
> of the table from the database, this includes the head of the table,
> all and each row, and then of course closing the table 'off'. I know
> this sounds like a strange way to do things, but i think this is the
> best way to go.
Definitely look at some of the general-purpose templating modules.
They'll all handle tables.
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Stef Telford | 2001-04-01 17:21:43 | Re: Trigger Function and Html Output |
Previous Message | J.Fernando Moyano | 2001-04-01 08:09:38 | ON DELETE rule |