diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/period/create_triggers.inc | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/period/create_triggers.inc')
-rw-r--r-- | mysql-test/suite/period/create_triggers.inc | 38 |
1 files changed, 38 insertions, 0 deletions
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('<UPD: ', $old_trig_args, ' -> ', $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('<DEL: ', $old_trig_args)); +eval create trigger tr1ins_$trig_table before insert 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('<INS: ', $new_trig_args)); + + +let trig_cols= 0; +let trig_table= 0; |