Subject | Re: [firebird-support] timestamp trigger? |
---|---|
Author | Lester Caine |
Post date | 2006-10-13T06:08:11Z |
Fernando Salaices wrote:
MYTIMESTAMPFIELD TIMESTAMP DEFAULT CURRENT_TIMESTAMP
and add an extra BEFORE UPDATE trigger with
:NEW.MYTIMESTAMPFIELD = CURRENT_TIMESTAMP
Works fine for me. And I create a log of the all changes from the BEFORE
UPDATE which copies some of the :OLD data to another table.
( I believe that the statement about triggers SHOULD say - from 1.5 you
can create a trigger with UPDATE, INSERT AND DELETE in the one trigger -
prior to 1.5 you had to duplicate the trigger when you needed the same
things both on INSERT and UPDATE. You can add a number of triggers as
long as they have different names, and order the sequence they are used
in is specified with the POSITION number )
--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php
> Can a BEFORE UPDATE and a BEFORE UPDATE OR INSERT coexist? Because myCreate the he table with
> table already has a BEFORE INSERT trigger.
MYTIMESTAMPFIELD TIMESTAMP DEFAULT CURRENT_TIMESTAMP
and add an extra BEFORE UPDATE trigger with
:NEW.MYTIMESTAMPFIELD = CURRENT_TIMESTAMP
Works fine for me. And I create a log of the all changes from the BEFORE
UPDATE which copies some of the :OLD data to another table.
( I believe that the statement about triggers SHOULD say - from 1.5 you
can create a trigger with UPDATE, INSERT AND DELETE in the one trigger -
prior to 1.5 you had to duplicate the trigger when you needed the same
things both on INSERT and UPDATE. You can add a number of triggers as
long as they have different names, and order the sequence they are used
in is specified with the POSITION number )
--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php