标签:where AC tps varchar 实现 new logs 事件触发 log
触发器实现:(增、删、改操作事件触发数据单向同步)
数据库触发器教程:https://www.cnblogs.com/phpper/p/7587031.html
同步代码:
DELIMITER $ DROP TRIGGER IF EXISTS insertdata; CREATE TRIGGER insertdata AFTER INSERT ON repair.user FOR EACH ROW BEGIN DECLARE s1 INT(11); DECLARE s2 VARCHAR(30); SET s1=NEW.id; SET s2=NEW.name; INSERT INTO sale.user(id,name) VALUES(s1,s2); END $ DELIMITER $ DROP TRIGGER IF EXISTS updatedata; CREATE TRIGGER updatedata AFTER UPDATE ON repair.user FOR EACH ROW BEGIN DECLARE s1 INT(11); DECLARE s2 VARCHAR(30); SET s1=OLD.id; SET s2=NEW.name; UPDATE sale.user a SET a.name=s2 WHERE a.id=s1; END $ DELIMITER $ DROP TRIGGER IF EXISTS deletedata; CREATE TRIGGER deletedata AFTER DELETE ON repair.user FOR EACH ROW BEGIN DECLARE s1 INT(11); DECLARE s2 VARCHAR(30); SET s1=OLD.id; SET s2=OLD.name; DELETE FROM sale.user WHERE id=s1; END $
标签:where AC tps varchar 实现 new logs 事件触发 log
原文地址:https://www.cnblogs.com/fuxuyang/p/8966483.html