Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
trg1 INSERT t1 begin
begin
if new.a > 10 then
if new.a > 10 then
set new.a := 10;
set new.a := 10;
set new.a := 11;
set new.a := 11;
end if;
end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
end BEFORE 0000-00-00 00:00:00 root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE 0000-00-00 00:00:00 root@localhost
end BEFORE 0000-00-00 00:00:00 root@localhost
trg3 UPDATE t1
trg3 UPDATE t1 begin
begin
if new.a = -1 then
if new.a = -1 then
set @fired:= "Yes";
set @fired:= "Yes";
end if;
end if;
...
@@ -2055,8 +2053,7 @@ UNLOCK TABLES;
...
@@ -2055,8 +2053,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin
begin
if new.a > 10 then
if new.a > 10 then
set new.a := 10;
set new.a := 10;
set new.a := 11;
set new.a := 11;
...
@@ -2069,8 +2066,7 @@ if old.a % 2 = 0 then set new.b := 12; end if;
...
@@ -2069,8 +2066,7 @@ if old.a % 2 = 0 then set new.b := 12; end if;
end */;;
end */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin
begin
if new.a = -1 then
if new.a = -1 then
set @fired:= "Yes";
set @fired:= "Yes";
end if;
end if;
...
@@ -2092,8 +2088,7 @@ UNLOCK TABLES;
...
@@ -2092,8 +2088,7 @@ UNLOCK TABLES;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
DELIMITER ;;
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin
begin
if new.a > 10 then
if new.a > 10 then
set @fired:= "No";
set @fired:= "No";
end if;
end if;
...
@@ -2165,24 +2160,21 @@ t1
...
@@ -2165,24 +2160,21 @@ t1
t2
t2
show triggers;
show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer
trg1 INSERT t1
trg1 INSERT t1 begin
begin
if new.a > 10 then
if new.a > 10 then
set new.a := 10;
set new.a := 10;
set new.a := 11;
set new.a := 11;
end if;
end if;
end BEFORE # root@localhost
end BEFORE # root@localhost
trg2 UPDATE t1 begin
trg2 UPDATE t1 begin
if old.a % 2 = 0 then set new.b := 12; end if;
if old.a % 2 = 0 then set new.b := 12; end if;
end BEFORE # root@localhost
end BEFORE # root@localhost
trg3 UPDATE t1
trg3 UPDATE t1 begin
begin
if new.a = -1 then
if new.a = -1 then
set @fired:= "Yes";
set @fired:= "Yes";
end if;
end if;
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
trg4 INSERT t2
trg4 INSERT t2 begin
begin
if new.a > 10 then
if new.a > 10 then
set @fired:= "No";
set @fired:= "No";
end if;
end if;
...
@@ -2210,7 +2202,7 @@ a2
...
@@ -2210,7 +2202,7 @@ a2
1
1
SHOW TRIGGERS;
SHOW TRIGGERS;
Trigger Event Table Statement Timing Created sql_mode Definer
Trigger Event Table Statement Timing Created sql_mode Definer
testref INSERT test1 BEGIN
testref INSERT test1 BEGIN
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost
INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost