On Apr 27, 2006, at 11:38 AM, Cees Hek wrote:
> You can have the database do all that for you using a trigger (if your
> database suports it). I have used PostgreSQL in the past to do the
> following:
>
> CREATE TABLE sessions (
> id varchar(32) NOT NULL PRIMARY KEY,
> a_session text NOT NULL,
> lm timestamp with time zone DEFAULT now()
> );

thats actually in the docs to some perl mod somewhere. maybe
cgi::session?


> CREATE FUNCTION update_session_lm() RETURNS "trigger"
> AS '
> BEGIN
> NEW.lm := ''now'';
> RETURN NEW;
> END;
> '
> LANGUAGE plpgsql;
>
> CREATE TRIGGER update_session_lm_trig
> BEFORE UPDATE ON sessions
> FOR EACH ROW
> EXECUTE PROCEDURE update_session_lm();


you could also just have apache::session update that column as well
on the data store by overrideing the store mechanism