码迷,mamicode.com
首页 > 数据库 > 详细

mysql日志触发器

时间:2018-12-28 19:21:04      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:.so   time   value   pid   data   insert   status   json   upd   

DROP TRIGGER
IF
EXISTS sys_menu_edit;
CREATE TRIGGER sys_menu_edit BEFORE UPDATE ON sys_menu FOR EACH ROW
BEGIN
INSERT INTO `g4m`.`sys_log` ( `table_name`, `val_id`, `data_json` )
VALUES
(
‘sys_menu‘,
old.id,
CONCAT(
"{",
CONCAT_WS(
‘,‘,
CONCAT_WS( old.id, ‘"id":"‘, ‘"‘ ),
CONCAT_WS( old.CODE, ‘"code":"‘, ‘"‘ ),
CONCAT_WS( old.type_dic, ‘"type_dic":"‘, ‘"‘ ),
CONCAT_WS( old.NAME, ‘"name":"‘, ‘"‘ ),
CONCAT_WS( old.pid, ‘"pid":"‘, ‘"‘ ),
CONCAT_WS( old.status_dic, ‘"status_dic":"‘, ‘"‘ ),
CONCAT_WS( old.url, ‘"url":"‘, ‘"‘ ),
CONCAT_WS( old.path, ‘"path":"‘, ‘"‘ ),
CONCAT_WS( old.icon, ‘"icon":"‘, ‘"‘ ),
CONCAT_WS( old.sort, ‘"sort":"‘, ‘"‘ ),
CONCAT_WS( old.remark, ‘"remark":"‘, ‘"‘ ),
CONCAT_WS( old.create_time, ‘"create_time":"‘, ‘"‘ ),
CONCAT_WS( old.modify_uer_id, ‘"modify_uer_id":"‘, ‘"‘ ),
CONCAT_WS( old.modify_time, ‘"modify_time":"‘, ‘"‘ )
),
"}"
)
);

END

mysql日志触发器

标签:.so   time   value   pid   data   insert   status   json   upd   

原文地址:https://www.cnblogs.com/go4mi/p/10192245.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!