Subject | problem with insert/commit moment |
---|---|
Author | df_nina |
Post date | 2008-04-16T14:44:18Z |
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
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