Subject Re: problem with insert/commit moment
Author m24paul
Hi df_nina

The simplest solution is to leave blank parameter `NOW' and define
into your log table the default value as `NOW' for "ora" field.This
way you get the time when transaction is commited!

insert into log(chiave,utente)
values(, user);

Best regards,

--- In, "df_nina" <df_nina@...>
> Hi!
> I'm using Firebird 2.0.1 and I create a log table that regiter all
> insert of the table "A". I save in the log the primary key and the
> instant of the insert of every record... This happens automaticly
> through a trigger in after insert on the table "A" like this:
> create trigger insa for a
> active after insert position 0
> as
> begin
> insert into log
> (ora,
> chiave /* PK */,
> utente)
> values
> ('NOW',
> user);
> end
> My problem is that 'NOW' is the insert moment and not the commit
> moment, so, if the user insert a record and commit it after few
> minutes, I don't have a correct image of my data. Is there a way to
> register the commit instant? As far as I know it's not possible
> through triggers because they are active before or after INSERT (or
> update...) and not before or after COMMIT, but maybe someone had the
> same problem and now there is a solution...
> Thanks in advance
> Nina