summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/create_drop_event.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/create_drop_event.test
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/create_drop_event.test')
-rw-r--r--mysql-test/main/create_drop_event.test48
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/main/create_drop_event.test b/mysql-test/main/create_drop_event.test
new file mode 100644
index 00000000..a906ec33
--- /dev/null
+++ b/mysql-test/main/create_drop_event.test
@@ -0,0 +1,48 @@
+--source include/not_embedded.inc
+--source include/no_view_protocol.inc
+
+SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
+SET GLOBAL event_scheduler=off;
+
+CREATE TABLE t1 (a INT);
+
+--error ER_WRONG_USAGE
+CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1;
+
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+--source include/count_sessions.inc
+SET GLOBAL event_scheduler=on;
+let $wait_condition= SELECT count(*)>0 FROM t1;
+--source include/wait_condition.inc
+SELECT DISTINCT a FROM t1;
+SET GLOBAL event_scheduler=off;
+--source include/wait_until_count_sessions.inc
+DELETE FROM t1;
+
+--error ER_EVENT_ALREADY_EXISTS
+CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12);
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13);
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+
+SET GLOBAL event_scheduler=on;
+let $wait_condition= SELECT count(*)>0 FROM t1;
+--source include/wait_condition.inc
+SELECT DISTINCT a FROM t1;
+SET GLOBAL event_scheduler=off;
+--source include/wait_until_count_sessions.inc
+DELETE FROM t1;
+
+DROP EVENT IF EXISTS ev1;
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+DROP EVENT IF EXISTS ev1;
+--error ER_EVENT_DOES_NOT_EXIST
+DROP EVENT ev1;
+SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
+
+DROP TABLE t1;
+
+SET timestamp=DEFAULT;