From 06eaf7232e9a920468c0f8d74dcf2fe8b555501c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:24:36 +0200 Subject: Adding upstream version 1:10.11.6. Signed-off-by: Daniel Baumann --- mysql-test/suite/period/create_triggers.inc | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 mysql-test/suite/period/create_triggers.inc (limited to 'mysql-test/suite/period/create_triggers.inc') diff --git a/mysql-test/suite/period/create_triggers.inc b/mysql-test/suite/period/create_triggers.inc new file mode 100644 index 00000000..1126ae08 --- /dev/null +++ b/mysql-test/suite/period/create_triggers.inc @@ -0,0 +1,38 @@ +create or replace table log_tbl(id int auto_increment primary key, log text) engine=myisam; + +create or replace procedure log(s text) + insert into log_tbl(log) values(s); + +if (!$trig_table) +{ + die "No $trig_table specified"; +} + +if (!$trig_cols) +{ + let $trig_cols= s, e; +} + +let $old_trig_args= `select REGEXP_REPLACE('$trig_cols', '([[:word:]]+)', + 'old.\\\\\\\\1')`; +let $old_trig_args= `select REPLACE('$old_trig_args', ',', ', ", ", ')`; +let $new_trig_args= `select REGEXP_REPLACE('$trig_cols', '([[:word:]]+)', + 'new.\\\\\\\\1')`; +let $new_trig_args= `select REPLACE('$new_trig_args', ',', ', ", ", ')`; + +eval create trigger tr1upd_$trig_table before update on $trig_table + for each row call log(CONCAT('>UPD: ', $old_trig_args, ' -> ', $new_trig_args)); +eval create trigger tr2upd_$trig_table after update on $trig_table + for each row call log(CONCAT(' ', $new_trig_args)); +eval create trigger tr1del_$trig_table before delete on $trig_table + for each row call log(CONCAT('>DEL: ', $old_trig_args)); +eval create trigger tr2del_$trig_table after delete on $trig_table + for each row call log(CONCAT('INS: ', $new_trig_args)); +eval create trigger tr2ins_$trig_table after insert on $trig_table + for each row call log(CONCAT('