Subject Create Log for tables change, which one is better via app or via firebird?
Author trskopo
Hi all,

I want to record all changes in tables (insert/update/delete).

I can do this by creating triggers for each tables, triggers ex :

SET TERM ^ ;
CREATE TRIGGER UPD_M_AREA FOR M_AREA ACTIVE
AFTER UPDATE POSITION 10
AS
BEGIN
insert into log (id_tbl,tbl_nm, opr)
values(new.ID, 'M_AREA', 'U');
END^
SET TERM ; ^

SET TERM ^ ;
CREATE TRIGGER DEL_M_AREA FOR M_AREA ACTIVE
AFTER DELETE POSITION 10
AS
BEGIN
insert into log (id_tbl, tbl_nm, opr, sql_del)
values(old.ID, 'M_AREA', 'D', old.dscp);
END^
SET TERM ; ^

SET TERM ^ ;
CREATE TRIGGER INS_M_AREA FOR M_AREA ACTIVE
AFTER INSERT POSITION 10
AS
BEGIN
insert into log (id_tbl,tbl_nm, opr)
values(new.ID, 'M_AREA', 'I');
END^
SET TERM ; ^

Or, I can record changes via my app, which one do you thing is better, regarding database performance and size?

Thanks in advance and best regards,
sugiarto