2006-01-11 18:09:05 +01:00
|
|
|
|
create database if not exists events_test;
|
|
|
|
|
use events_test;
|
2005-12-15 14:12:28 +01:00
|
|
|
|
drop event if exists event1;
|
|
|
|
|
Warnings:
|
|
|
|
|
Note 1305 Event event1 does not exist
|
|
|
|
|
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
|
|
|
|
|
alter event event1 rename to event2;
|
2006-01-10 19:16:58 +01:00
|
|
|
|
alter event event2 disabled;
|
2005-12-15 14:12:28 +01:00
|
|
|
|
drop event event2;
|
|
|
|
|
create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
|
|
|
|
|
drop event event2;
|
|
|
|
|
create table t_event3 (a int, b float);
|
|
|
|
|
drop event if exists event3;
|
|
|
|
|
Warnings:
|
|
|
|
|
Note 1305 Event event3 does not exist
|
|
|
|
|
create event event3 on schedule every 50 + 10 minute starts date_add("20010101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
|
|
|
|
|
set max_allowed_packet=128000000;
|
|
|
|
|
select count(*) from t_event3;
|
|
|
|
|
count(*)
|
|
|
|
|
0
|
|
|
|
|
drop event event3;
|
|
|
|
|
drop table t_event3;
|
2006-01-11 18:09:05 +01:00
|
|
|
|
set names utf8;
|
|
|
|
|
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
|
|
|
|
|
drop event задачка;
|
|
|
|
|
set event_scheduler=0;
|
|
|
|
|
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
|
|
|
|
|
set global event_scheduler=2;
|
|
|
|
|
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
|
|
|
|
|
set global event_scheduler=0;
|
|
|
|
|
select count(*) from mysql.event;
|
|
|
|
|
count(*)
|
|
|
|
|
0
|
|
|
|
|
select get_lock("test_lock1", 20);
|
|
|
|
|
get_lock("test_lock1", 20)
|
|
|
|
|
1
|
|
|
|
|
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
|
|
|
|
|
select count(*) from mysql.event;
|
|
|
|
|
count(*)
|
|
|
|
|
1
|
|
|
|
|
select release_lock("test_lock1");
|
|
|
|
|
release_lock("test_lock1")
|
|
|
|
|
1
|
|
|
|
|
drop event закачка;
|
|
|
|
|
select count(*) from mysql.event;
|
|
|
|
|
count(*)
|
|
|
|
|
0
|
|
|
|
|
set global event_scheduler=1;
|
|
|
|
|
select get_lock("test_lock2", 20);
|
|
|
|
|
get_lock("test_lock2", 20)
|
|
|
|
|
1
|
|
|
|
|
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
select release_lock("test_lock2");
|
|
|
|
|
release_lock("test_lock2")
|
|
|
|
|
1
|
|
|
|
|
drop event закачка;
|
|
|
|
|
set global event_scheduler=1;
|
|
|
|
|
select get_lock("test_lock2_1", 20);
|
|
|
|
|
get_lock("test_lock2_1", 20)
|
|
|
|
|
1
|
|
|
|
|
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
set global event_scheduler=0;
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
select release_lock("test_lock2_1");
|
|
|
|
|
release_lock("test_lock2_1")
|
|
|
|
|
1
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
drop event закачка21;
|
|
|
|
|
set global event_scheduler=1;
|
|
|
|
|
select get_lock("test_lock3", 20);
|
|
|
|
|
get_lock("test_lock3", 20)
|
|
|
|
|
1
|
|
|
|
|
create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
drop event закачка;
|
|
|
|
|
select release_lock("test_lock3");
|
|
|
|
|
release_lock("test_lock3")
|
|
|
|
|
1
|
|
|
|
|
set global event_scheduler=0;
|
|
|
|
|
select sleep(2);
|
|
|
|
|
sleep(2)
|
|
|
|
|
0
|
|
|
|
|
drop database events_test;
|