Commit a1d87d6a authored by andrey@lmy004's avatar andrey@lmy004

manual merge

parents 2ad835a7 3c67b803
create database if not exists events_test; create database if not exists events_test;
use events_test; use events_test;
set @a=3; set @a=3;
CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5; CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
call p_16(); call p_16();
...@@ -14,6 +15,13 @@ CALL p_16(); ...@@ -14,6 +15,13 @@ CALL p_16();
ERROR HY000: Event 'e_16' already exists ERROR HY000: Event 'e_16' already exists
DROP PROCEDURE p_16; DROP PROCEDURE p_16;
DROP EVENT e_16; DROP EVENT e_16;
create event e_55 on schedule at 99990101000000 do drop table t;
ERROR HY000: Incorrect AT value: '99990101000000'
create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
ERROR HY000: Incorrect STARTS value: '99990101000000'
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
ERROR HY000: ENDS is either invalid or before STARTS
set global event_scheduler=0; set global event_scheduler=0;
"Wait a bit to settle down" "Wait a bit to settle down"
delete from mysql.event; delete from mysql.event;
......
...@@ -21,6 +21,19 @@ DROP EVENT e_16; ...@@ -21,6 +21,19 @@ DROP EVENT e_16;
# END - BUG#16408: Events: crash for an event in a procedure # END - BUG#16408: Events: crash for an event in a procedure
# #
#
# Start - 16396: Events: Distant-future dates become past dates
#
--error 1503
create event e_55 on schedule at 99990101000000 do drop table t;
--error 1503
create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
--error 1521
create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
#
# End - 16396: Events: Distant-future dates become past dates
#
# #
# Start - 16407: Events: Changes in sql_mode won't be taken into account # Start - 16407: Events: Changes in sql_mode won't be taken into account
# #
......
...@@ -151,6 +151,7 @@ Event_timed::init_execute_at(THD *thd, Item *expr) ...@@ -151,6 +151,7 @@ Event_timed::init_execute_at(THD *thd, Item *expr)
{ {
my_bool not_used; my_bool not_used;
TIME ltime; TIME ltime;
my_time_t t;
TIME time_tmp; TIME time_tmp;
DBUG_ENTER("Event_timed::init_execute_at"); DBUG_ENTER("Event_timed::init_execute_at");
...@@ -174,12 +175,18 @@ Event_timed::init_execute_at(THD *thd, Item *expr) ...@@ -174,12 +175,18 @@ Event_timed::init_execute_at(THD *thd, Item *expr)
TIME_to_ulonglong_datetime(&time_tmp)) TIME_to_ulonglong_datetime(&time_tmp))
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx. This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem. CONVERT_TZ has similar problem.
mysql_priv.h currently lists
#define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/ */
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd,&ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime,t=TIME_to_timestamp(thd,&ltime,&not_used));
if (!t)
{
DBUG_PRINT("error", ("Execute AT after year 2037"));
DBUG_RETURN(ER_WRONG_VALUE);
}
execute_at_null= FALSE; execute_at_null= FALSE;
execute_at= ltime; execute_at= ltime;
...@@ -302,6 +309,7 @@ Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval) ...@@ -302,6 +309,7 @@ Event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
RETURNS RETURNS
0 OK 0 OK
EVEX_PARSE_ERROR fix_fields failed EVEX_PARSE_ERROR fix_fields failed
EVEX_BAD_PARAMS starts before now
*/ */
int int
...@@ -309,6 +317,7 @@ Event_timed::init_starts(THD *thd, Item *new_starts) ...@@ -309,6 +317,7 @@ Event_timed::init_starts(THD *thd, Item *new_starts)
{ {
my_bool not_used; my_bool not_used;
TIME ltime, time_tmp; TIME ltime, time_tmp;
my_time_t t;
DBUG_ENTER("Event_timed::init_starts"); DBUG_ENTER("Event_timed::init_starts");
...@@ -329,10 +338,17 @@ Event_timed::init_starts(THD *thd, Item *new_starts) ...@@ -329,10 +338,17 @@ Event_timed::init_starts(THD *thd, Item *new_starts)
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem CONVERT_TZ has similar problem.
mysql_priv.h currently lists
#define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/ */
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime,t=TIME_to_timestamp(thd, &ltime, &not_used));
if (!t)
{
DBUG_PRINT("error", ("STARTS after year 2037"));
DBUG_RETURN(EVEX_BAD_PARAMS);
}
starts= ltime; starts= ltime;
starts_null= FALSE; starts_null= FALSE;
...@@ -359,6 +375,7 @@ Event_timed::init_starts(THD *thd, Item *new_starts) ...@@ -359,6 +375,7 @@ Event_timed::init_starts(THD *thd, Item *new_starts)
RETURNS RETURNS
0 OK 0 OK
EVEX_PARSE_ERROR fix_fields failed EVEX_PARSE_ERROR fix_fields failed
ER_WRONG_VALUE starts distant date (after year 2037)
EVEX_BAD_PARAMS ENDS before STARTS EVEX_BAD_PARAMS ENDS before STARTS
*/ */
...@@ -367,6 +384,7 @@ Event_timed::init_ends(THD *thd, Item *new_ends) ...@@ -367,6 +384,7 @@ Event_timed::init_ends(THD *thd, Item *new_ends)
{ {
TIME ltime, ltime_now; TIME ltime, ltime_now;
my_bool not_used; my_bool not_used;
my_time_t t;
DBUG_ENTER("Event_timed::init_ends"); DBUG_ENTER("Event_timed::init_ends");
...@@ -378,11 +396,18 @@ Event_timed::init_ends(THD *thd, Item *new_ends) ...@@ -378,11 +396,18 @@ Event_timed::init_ends(THD *thd, Item *new_ends)
DBUG_RETURN(EVEX_BAD_PARAMS); DBUG_RETURN(EVEX_BAD_PARAMS);
/* /*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx ? This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
CONVERT_TZ has similar problem ? CONVERT_TZ has similar problem.
mysql_priv.h currently lists
#define TIMESTAMP_MAX_YEAR 2038 (see TIME_to_timestamp())
*/ */
DBUG_PRINT("info", ("get the UTC time")); DBUG_PRINT("info", ("get the UTC time"));
my_tz_UTC->gmt_sec_to_TIME(&ltime, TIME_to_timestamp(thd, &ltime, &not_used)); my_tz_UTC->gmt_sec_to_TIME(&ltime,t=TIME_to_timestamp(thd, &ltime, &not_used));
if (!t)
{
DBUG_PRINT("error", ("ENDS after year 2037"));
DBUG_RETURN(EVEX_BAD_PARAMS);
}
/* Check whether ends is after starts */ /* Check whether ends is after starts */
DBUG_PRINT("info", ("ENDS after STARTS?")); DBUG_PRINT("info", ("ENDS after STARTS?"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment