diff options
author | unknown <andrey@lmy004.> | 2006-04-07 09:18:29 +0200 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2006-04-07 09:18:29 +0200 |
commit | 3fe07e27852f258f201829bbb68f2ed18d76f8c3 (patch) | |
tree | 04f1d083d58ffd223dab2e7ee0310f4545622098 /mysql-test | |
parent | 040fc2d335bc8dc83b403562cde3c6e2e89c0e6a (diff) | |
parent | 7c596993453f1a77f92072f29a2d52eee5d81db1 (diff) | |
download | mariadb-git-3fe07e27852f258f201829bbb68f2ed18d76f8c3.tar.gz |
manual merge
mysql-test/r/events.result:
Auto merged
sql/event.cc:
Auto merged
sql/event_timed.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_show.cc:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/events.result | 11 | ||||
-rw-r--r-- | mysql-test/r/events_scheduling.result | 46 | ||||
-rw-r--r-- | mysql-test/t/events.test | 23 | ||||
-rw-r--r-- | mysql-test/t/events_scheduling.test | 36 |
4 files changed, 102 insertions, 14 deletions
diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result index 06c846da781..5ff26d7428d 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events.result @@ -106,7 +106,6 @@ 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("20100101", 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 @@ -232,6 +231,9 @@ Db Name Definer Type Execute at Interval value Interval field Starts Ends Status events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; +ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; +SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; +ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default ''; SHOW CREATE TABLE mysql.event; Table Create Table @@ -260,11 +262,10 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d "This should work" SHOW EVENTS; Db Name Definer Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED -ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; -SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; -ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. +events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default ''; +Warnings: +Warning 1265 Data truncated for column 'db' at row 1 SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ALTER TABLE mysql.event DROP comment, DROP starts; diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result new file mode 100644 index 00000000000..67e8e6d5691 --- /dev/null +++ b/mysql-test/r/events_scheduling.result @@ -0,0 +1,46 @@ +CREATE DATABASE IF NOT EXISTS events_test; +USE events_test; +CREATE TABLE table_1(a int); +CREATE TABLE table_2(a int); +CREATE TABLE table_3(a int); +CREATE TABLE table_4(a int); +SET GLOBAL event_scheduler=1; +CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); +CREATE EVENT start_n_end +ON SCHEDULE EVERY 1 SECOND +ENDS NOW() + INTERVAL 6 SECOND +ON COMPLETION PRESERVE +DO INSERT INTO table_2 VALUES(1); +CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1); +CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1); +SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; +IF(SUM(a) >= 4, 'OK', 'ERROR') +OK +SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; +IF(SUM(a) >= 5, 'OK', 'ERROR') +OK +SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3; +IF(SUM(a) > 0, 'OK', 'ERROR') +OK +SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4; +IF(SUM(a) > 0, 'OK', 'ERROR') +OK +DROP EVENT two_sec; +SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') +OK +SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') +OK +DROP EVENT start_n_end; +"Already dropped because ended. Therefore an error." +DROP EVENT only_one_time; +ERROR HY000: Unknown event 'only_one_time' +"Already dropped because ended. Therefore an error." +DROP EVENT two_time; +ERROR HY000: Unknown event 'two_time' +DROP TABLE table_1; +DROP TABLE table_2; +DROP TABLE table_3; +DROP TABLE table_4; +DROP DATABASE events_test; diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test index 755d4e7775b..73cadd406d8 100644 --- a/mysql-test/t/events.test +++ b/mysql-test/t/events.test @@ -101,7 +101,6 @@ set global event_scheduler = 0; create table t_event3 (a int, b float); drop event if exists event3; create event event3 on schedule every 50 + 10 minute starts date_add("20100101", 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; drop event event3; drop table t_event3; @@ -148,8 +147,8 @@ SHOW CREATE EVENT root19; create event root20 on schedule every '50:20:12:45' day_second do select 1; SHOW CREATE EVENT root20; set names cp1251; -create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; -SHOW CREATE EVENT ðóóò21; +create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåÃòà ð' do select 1; +SHOW CREATE EVENT ðóóò21; insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND"); --error 1235 show create event root22; @@ -174,7 +173,7 @@ drop event root17_1; drop event root18; drop event root19; drop event root20; -drop event ðóóò21; +drop event ðóóò21; set names latin1; # @@ -202,6 +201,9 @@ CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; #sleep a bit or we won't catch the change of time --sleep 1 +ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; +--error 1526 +SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default ''; #wait a bit or we won't see the difference because of seconds resolution --sleep 1 @@ -220,6 +222,7 @@ ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; --sleep 1 ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default ''; +--sleep 1 --error ER_CANNOT_LOAD_FROM_TABLE SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; --sleep 1 @@ -412,7 +415,8 @@ select 1; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; drop event white_space; create event white_space on schedule every 10 hour disable do -
select 2; + +select 2; select event_schema, event_name, definer, event_body from information_schema.events where event_name='white_space'; drop event white_space; create event white_space on schedule every 10 hour disable do select 3; @@ -422,7 +426,7 @@ drop event white_space; # END: BUG #17453: Creating Event crash the server # -# +##set global event_scheduler=1; # Bug#17403 "Events: packets out of order with show create event" # create event e1 on schedule every 1 year do set @a = 5; @@ -436,7 +440,7 @@ drop event e1; ##select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); ##select sleep(2); -##select /*7*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; +##show processlist; ##drop event закачка; ##select release_lock("test_lock3"); @@ -446,13 +450,14 @@ drop event e1; ##select get_lock("test_lock4", 20); ##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20); ##select sleep(3); -##select /*8*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; +##--replace_column 1 # 6 # ##drop event закачка4; ##select release_lock("test_lock4"); ##set global event_scheduler=0; ##select sleep(2); -##select /*9*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info; +##--replace_column 1 # 6 # ##select count(*) from mysql.event; drop database events_test; + diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test new file mode 100644 index 00000000000..41bbb1da3c0 --- /dev/null +++ b/mysql-test/t/events_scheduling.test @@ -0,0 +1,36 @@ +CREATE DATABASE IF NOT EXISTS events_test; +USE events_test; +CREATE TABLE table_1(a int); +CREATE TABLE table_2(a int); +CREATE TABLE table_3(a int); +CREATE TABLE table_4(a int); +SET GLOBAL event_scheduler=1; +CREATE EVENT two_sec ON SCHEDULE EVERY 2 SECOND DO INSERT INTO table_1 VALUES(1); +CREATE EVENT start_n_end + ON SCHEDULE EVERY 1 SECOND + ENDS NOW() + INTERVAL 6 SECOND + ON COMPLETION PRESERVE + DO INSERT INTO table_2 VALUES(1); +--sleep 5 +CREATE EVENT only_one_time ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_3 VALUES(1); +CREATE EVENT two_time ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND DO INSERT INTO table_4 VALUES(1); +--sleep 5 +SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1; +SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2; +SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_3; +SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4; +DROP EVENT two_sec; +SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +SELECT IF(LAST_EXECUTED-ENDS < 2, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; +DROP EVENT start_n_end; +--echo "Already dropped because ended. Therefore an error." +--error 1517 +DROP EVENT only_one_time; +--echo "Already dropped because ended. Therefore an error." +--error 1517 +DROP EVENT two_time; +DROP TABLE table_1; +DROP TABLE table_2; +DROP TABLE table_3; +DROP TABLE table_4; +DROP DATABASE events_test; |