Курсовая работа: Захист інформації в інформаційних системах
USERNAME VARCHAR DEFAULT CURRENT_USER,
OPER_TYPECHAR(1) CHECK (OPER_TYPE IN ('I','U','D')),
OPER_TIMETIMESTAMP DEFAULT NOW(),
num_new INTEGER,
num_old INTEGER,
name_new VARCHAR(50),
name_old VARCHAR(50),
address_new VARCHAR(50),
address_old VARCHAR(50),
capital_new INTEGER,
capital_old INTEGER);
DROP RULE Account_logs _INSERT ON Account;
CREATE RULE Account_logs _INSERT AS ON INSERT TO Account
DO
INSERT INTO Account_logs
(OPER_TYPE, num_new , balance_new )
VALUES ('I', NEW.num, NEW.balance);
DROP RULE Account_logs _UPDATE ON Account;
CREATE RULE Account_logs _ UPDATE AS ON UPDATE TO Account
DO
INSERT INTO Account_logs
(OPER_TYPE, num_new , balance_new, num_old, balance_old )
VALUES ('U', NEW.num, NEW.balance, OLD.num, OLD.balance);
DROP RULE Account_logs _DELETE ON Account ;
CREATE RULE Account_logs _DELETE AS ON DELETE TO Account
DO
INSERT INTO Account_logs
(OPER_TYPE, num_old , balance _old,)
VALUES ('D', OLD.num, OLD.balance);