mariadb/mysql-test/include/ddl_i18n.check_triggers.inc
Monty 8be53a389c MDEV-6112 multiple triggers per table
This is similar to MysQL Worklog 3253, but with
a different implementation. The disk format and
SQL syntax is identical with MySQL 5.7.

Fetures supported:
- "Any" ammount of any trigger
- Supports FOLLOWS and PRECEDES to be
  able to put triggers in a certain execution order.

Implementation details:
- Class Trigger added to hold information about a trigger.
  Before this trigger information was stored in a set of lists in
  Table_triggers_list and in Table_triggers_list::bodies
- Each Trigger has a next field that poinst to the next Trigger with the
  same action and time.
- When accessing a trigger, we now always access all linked triggers
- The list are now only used to load and save trigger files.
- MySQL trigger test case (trigger_wl3253) added and we execute these
  identically.
- Even more gracefully handling of wrong trigger files than before. This
  is useful if a trigger file uses functions or syntax not provided by
  the server.
- Each trigger now has a "Created" field that shows when the trigger was
  created, with 2 decimals.

Other comments:
- Many of the changes in test files was done because of the new "Created"
  field in the trigger file. This shows up in SHOW ... TRIGGER and when
  using information_schema.trigger.
- Don't check if all memory is released if on uses --gdb;  This is needed
  to be able to get a list from safemalloc of not freed memory while
  debugging.
- Added option to trim_whitespace() to know how many prefix characters
  was skipped.
- Changed a few ulonglong sql_mode to sql_mode_t, to find some wrong usage
  of sql_mode.
2016-10-05 01:11:07 +03:00

114 lines
1.7 KiB
PHP

# - Check SHOW CREATE statement;
--echo
--echo
--replace_column 7 #
SHOW CREATE TRIGGER trg1|
--echo
--replace_column 7 #
SHOW CREATE TRIGGER trg2|
--echo
--replace_column 7 #
SHOW CREATE TRIGGER mysqltest2.trg3|
--echo
--replace_column 7 #
SHOW CREATE TRIGGER mysqltest2.trg4|
# - Check SHOW statement;
--echo
--echo
--replace_column 6 #
SHOW TRIGGERS|
--echo
use mysqltest2|
--echo
--replace_column 6 #
SHOW TRIGGERS|
use mysqltest1|
# - Check INFORMATION_SCHEMA;
--echo
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
--echo
--replace_column 17 CREATED
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
# - Initialize the used variables (actual values don't matter);
--echo
--echo
SET @a1 = '1'|
SET @a2 = '1'|
SET @a3 = '1'|
SET @b1 = '2'|
SET @b2 = '2'|
SET @b3 = '2'|
# - Execute the triggers;
--echo
--echo
INSERT INTO t1 VALUES(1)|
--echo
--echo ---> Log:
--sorted_result
SELECT msg FROM log|
--echo
SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
--echo
DELETE FROM log|
--echo
--echo
INSERT INTO mysqltest2.t1 VALUES(1)|
--echo
--echo ---> Log:
--sorted_result
SELECT msg FROM mysqltest2.log|
--echo
SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
--echo
DELETE FROM mysqltest2.log|