pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Stef Telford <stef@chronozon.artofdns.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Trigger Function and Html Output
Date: Sun, 01 Apr 2001 17:35:35 +0100
Message-ID: <3AC758D6.41FDD33C@archonet.com> (raw)
References: <01040103502000.12630@devil.hades>

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



view thread (5+ messages)  latest in thread

Message-ID: <3AC758D6.41FDD33C@archonet.com>
Permalink:  ../3AC758D6.41FDD33C@archonet.com/
Also on:    postgresql.org/message-id/3AC758D6.41FDD33C@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, stef@chronozon.artofdns.com
  Subject: Re: Trigger Function and Html Output
  In-Reply-To: <3AC758D6.41FDD33C@archonet.com>
  References: <01040103502000.12630@devil.hades> <3AC758D6.41FDD33C@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox