mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
45 lines
999 B
Text
45 lines
999 B
Text
|
drop table if exists t1;
|
||
|
## Creating new table ##
|
||
|
CREATE TABLE t1
|
||
|
(
|
||
|
id INT NOT NULL auto_increment,
|
||
|
PRIMARY KEY (id),
|
||
|
name VARCHAR(30)
|
||
|
);
|
||
|
'#--------------------FN_DYNVARS_018_01-------------------------#'
|
||
|
## Setting initial value of variable to ON ##
|
||
|
SET @@global.event_scheduler = ON;
|
||
|
SELECT @@event_scheduler;
|
||
|
@@event_scheduler
|
||
|
ON
|
||
|
## Creating new event ##
|
||
|
CREATE EVENT test_event_1
|
||
|
ON SCHEDULE EVERY 3 SECOND
|
||
|
DO
|
||
|
INSERT into t1(name) values('Record_1');
|
||
|
SELECT * from t1;
|
||
|
id name
|
||
|
1 Record_1
|
||
|
2 Record_1
|
||
|
DROP EVENT test_event_1;
|
||
|
DELETE from t1;
|
||
|
select * from t1;
|
||
|
id name
|
||
|
'#--------------------FN_DYNVARS_018_02-------------------------#'
|
||
|
## Setting value of variable to OFF ##
|
||
|
SET @@global.event_scheduler = OFF;
|
||
|
SELECT @@event_scheduler;
|
||
|
@@event_scheduler
|
||
|
OFF
|
||
|
## Creating new event ##
|
||
|
CREATE EVENT test_event_1
|
||
|
ON SCHEDULE EVERY 3 SECOND
|
||
|
DO
|
||
|
INSERT into t1(name) values('Record_2');
|
||
|
## Table should be empty ##
|
||
|
SELECT * from t1;
|
||
|
id name
|
||
|
DROP EVENT test_event_1;
|
||
|
## Dropping table ##
|
||
|
DROP table t1;
|