mysql日志触发器

Posted HelloWorld

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql日志触发器相关的知识,希望对你有一定的参考价值。

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日志触发器的主要内容,如果未能解决你的问题,请参考以下文章

mysql日志触发器

MySQL之触发器

Mysql系列--事务日志

mysql触发器trigger

mysql触发器trigger

Mysql触发器实例详解