Re: Trigger Function and Html Output

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Trigger Function and Html Output
Дата
Msg-id 3AC758D6.41FDD33C@archonet.com
обсуждение исходный текст
Ответ на Trigger Function and Html Output  (Stef Telford <stef@chronozon.artofdns.com>)
Ответы Re: Trigger Function and Html Output  (Stef Telford <stef@chronozon.artofdns.com>)
Список 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "J.Fernando Moyano"
Дата:
Сообщение: ON DELETE rule
Следующее
От: Stef Telford
Дата:
Сообщение: Re: Trigger Function and Html Output