Subject RE: [firebird-support] problem with insert/commit moment
Author Mercea Paul
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 committed!



Best regards,

Paul



From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of df_nina
Sent: 16 April 2008 17:44
To: firebird-support@yahoogroups.com
Subject: [firebird-support] problem with insert/commit moment




Hi!

I'm using Firebird 2.0.1 and I create a log table that regiter all the
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',
new.id,
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





[Non-text portions of this message have been removed]