mysql实例中的每一个trigger 对应到information_schema.triggers 中有一行

1、information_schema.triggers 表的常用列:

  1、trigger_catalog          :永远是def

  2、trigger_schema          :trigger 所在的数据库名

  3、event_manipulation        :触发trigger 的事件类型可以是 insert | update | delete

  4、event_object_schema        :trigger 所基于的表所在的数据库名

  5、event_object_table        :trigger 所基于的表名

  6、action_statement         :trigger 内部所包涵的SQL语句

2、例子:

drop table if exists t;
drop table if exists t_log; create table t(
id int auto_increment,
x int,
constraint pk__t__id primary key(id))
engine=innodb
default char set utf8; create table t_log(
id int auto_increment,
log_time datetime default now(),
constraint pk__t_log__id primary key(id))
engine=innodb
default char set utf8; delimiter go
create trigger tg__insert__t
before insert
on t
for each row
begin insert into t_log(log_time) values(current_timestamp());
end
go delimiter ;

查看trigger 信息:

mysql> select * from triggers \G
*************************** 1. row ***************************
TRIGGER_CATALOG: def
TRIGGER_SCHEMA: tempdb
TRIGGER_NAME: tg__insert__t
EVENT_MANIPULATION: INSERT
EVENT_OBJECT_CATALOG: def
EVENT_OBJECT_SCHEMA: tempdb
EVENT_OBJECT_TABLE: t
ACTION_ORDER: 0
ACTION_CONDITION: NULL
ACTION_STATEMENT: begin insert into t_log(log_time) values(current_timestamp());
end
ACTION_ORIENTATION: ROW
ACTION_TIMING: BEFORE
ACTION_REFERENCE_OLD_TABLE: NULL
ACTION_REFERENCE_NEW_TABLE: NULL
ACTION_REFERENCE_OLD_ROW: OLD
ACTION_REFERENCE_NEW_ROW: NEW
CREATED: NULL
SQL_MODE: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
DEFINER: root@localhost
CHARACTER_SET_CLIENT: utf8
COLLATION_CONNECTION: utf8_general_ci
DATABASE_COLLATION: latin1_swedish_ci

information_schema.triggers 学习的更多相关文章

  1. mysql中information_schema.triggers字段说明

    1. 获取所有触发器信息(TRIGGERS) SELECT  *  FROM information_schema.TRIGGERS WHERE  TRIGGER_SCHEMA='数据库名';  TR ...

  2. information_schema.referential_constraints 学习

    information_schema.referential_constraints 表用于查看外键约束 1.information_schema.referential_constraints表的常 ...

  3. information_schema.profiling学习

    information_schema.profiling可以用来分析每一条SQL在它执行的各个阶段的用时,注意这个表是session 级的,也就是说如果session1 开启了它:session2没有 ...

  4. information_schema.optimizer_trace学习

    information_schema.optimizer_trace 用于追踪优化器的优化过程:通常来说这张表中是没有数据的,要想开户追踪要把 @@session.optimizer_trace='e ...

  5. information_schema.routines 学习

    information_schema.routines 用户查看mysql中的routine信息 1.information_schema.routines 表中的常用列: 1.

  6. information_schema.key_column_usage 学习

    information_schema.key_column_usage 表可以查看索引列上的约束: 1.information_schema.key_column_usage 的常用列: 1.cons ...

  7. information_schema.events 学习

    information_schema.events 表保存了整个mysql实例中的event 信息 1.常用列: 1.event_catalog :永远是def 2.event_schema :eve ...

  8. information_schema.engines学习

    当前mysql实例的存储引擎信息可以从information_schema.engines 中查询到 例子: mysql> select * from information_schema.en ...

  9. information_schema.column_privileges 学习

    mysql 的授权是分层次的 实例级 | 库级 | 表级 | 列级 而这些授权信息被保存在了mysql.user | mysql.db | mysql.tables_priv | mysql.colu ...

随机推荐

  1. Mysqldump记录

    MySql导出特定的一段记录(导出为SQL语句) mysqldump –u root -p 数据库名 表名 --where=" author like '%Joking%' " & ...

  2. Shell脚本调试技术

    http://www.ibm.com/developerworks/cn/linux/l-cn-shell-debug/ 一. 前言 shell编程在unix/linux世界中使用得非常广泛,熟练掌握 ...

  3. Android和FTP服务器交互,上传下载文件(实例demo)

    今天同学说他备份了联系人的数据放在一个文件里,想把它存到服务器上,以便之后可以进行下载恢复..于是帮他写了个上传,下载文件的demo 主要是 跟FTP服务器打交道-因为这个东东有免费的可以身亲哈 1. ...

  4. 【转】android cts failed items

    原文网址:http://blog.csdn.net/linsa0517/article/details/19031479 Fail的一些修改   1.直接设置问题 estUnknownSourcesO ...

  5. bzoj1734 [Usaco2005 feb]Aggressive cows 愤怒的牛

    Description Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stal ...

  6. Linux用户基础

    http://itercast.com/lecture/21 操作系统通过用户.组概念来管理使用计算机的人 用户代表一个使用计算机的使用者,操作系统通过用户概念限制一个使用者能够访问的资源 组用来组织 ...

  7. uva11624 - Fire!

    uva11624 - Fire! 火在蔓延,人在走.火会蔓延,不会熄灭,我们可以确定某个点着火的时间(广搜).对于J来说,要是他走到某点的时间比火蔓延到该点的时间要短,那么他走到该点的时候,火还没蔓延 ...

  8. UIKit和Core Graphics绘图(三)——绘制虚线,椭圆以及饼图

    绘制虚线 虚线绘制主要调用CGContextSetLineDash函数. 这个函数有4个参数,除了一个是上下文外,phase为初始跳过几个点开始绘制,第三个参数为一个CGFloat数组,指定你绘制的样 ...

  9. 0..n去掉一个数,给你剩下的数,找出去掉的那个数

    转载请注明转自blog.csdn.net/souldak , 微博@evagle 首先,考虑没有去掉那些数,如果n是奇数,n+1个最低位肯定是0101...01,count(0)=count(1),如 ...

  10. 9. KNN和Sparse构图

    一.前言 图是一种重要的数据结构,本文主要表示图像的无向图.所谓无向图是指,图的节点间通过没有方向的边连接. 无向图的表示: 无向图G=<V,E>,其中: 1.V是非空集合,称为顶点集. ...