Курсовая работа: Захист інформації в інформаційних системах
CREATE RULE Operation_logs _INSERT AS ON INSERT TO Operation
DO
INSERT INTO Operation_logs
(OPER_TYPE, code_new , dat_new, credit_num_new, debet_num_new, change_new )
VALUES ('I', NEW.code, NEW.dat, NEW.credit-num, NEW.debet_num, NEW.change);
DROP RULE Operation_logs _UPDATE ON Operation ;
CREATE RULE Account_logs _ UPDATE AS ON UPDATE TO Operation
DO
INSERT INTO Operation_logs
(OPER_TYPE, code_new , dat_new, credit_num_new, debet_num_new, change_new,
code_old, dat_old, credit_num_old, debet_num_old, change_old)
VALUES ('U', NEW.code, NEW.dat, NEW.credit_num, NEW.debet_num, NEW.change,
OLD.code, OLD.dat, OLD.credit_num, OLD.debet_num, OLD.change);
DROP RULE Operation_logs _DELETE ON Operation ;
CREATE RULE Operation_logs _DELETE AS ON DELETE TO Operation
DO
INSERT INTO Operation_logs
(OPER_TYPE, code_old , dat_old, credit_num_old, debet_num_old, change_old )
VALUES ('D', OLD.code, OLD.dat, OLD.credit_num, OLD. debet_num, OLD.change);
DROP RULE Branch_logs _INSERT ON Branch ;
CREATE RULE Account_logs _INSERT AS ON INSERT TO Branch
DO
INSERT INTO Branch_logs
(OPER_TYPE, num_new , name_new, address_new, capital_new )
VALUES ('I', NEW.num, NEW.name, NEW. address, NEW. capital );
DROP RULE Branch_logs _UPDATE ON Branch ;
CREATE RULE Account_logs _ UPDATE AS ON UPDATE TO Branch
DO
INSERT INTO Branch_logs