Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2213 06/03/03 01:39:11 andrey@lmy004. +3 -0
fix for bug #16396: Events: Distant-future dates become past dates
WL#1034 (Internal CRON)
timestamps does not support > y2038
sql/event_timed.cc
1.46 06/03/03 01:39:00 andrey@lmy004. +33 -8
fix for bug #16396: Events: Distant-future dates become past dates.
mysql-test/t/events_bugs.test
1.2 06/03/03 01:39:00 andrey@lmy004. +13 -0
add tests
mysql-test/r/events_bugs.result
1.3 06/03/03 01:39:00 andrey@lmy004. +6 -0
update results
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: lmy004.
# Root: /work/mysql-5.1-bug16406
--- 1.2/mysql-test/r/events_bugs.result 2006-02-21 02:40:15 +01:00
+++ 1.3/mysql-test/r/events_bugs.result 2006-03-03 01:39:00 +01:00
@@ -1,5 +1,11 @@
create database if not exists events_test;
use events_test;
+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;
"Wait a bit to settle down"
delete from mysql.event;
--- 1.1/mysql-test/t/events_bugs.test 2006-02-20 23:52:12 +01:00
+++ 1.2/mysql-test/t/events_bugs.test 2006-03-03 01:39:00 +01:00
@@ -1,6 +1,19 @@
create database if not exists events_test;
use events_test;
#
+# 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
#
set global event_scheduler=0;
--- 1.45/sql/event_timed.cc 2006-03-02 21:01:56 +01:00
+++ 1.46/sql/event_timed.cc 2006-03-03 01:39:00 +01:00
@@ -150,6 +150,7 @@ Event_timed::init_execute_at(THD *thd, I
{
my_bool not_used;
TIME ltime;
+ my_time_t t;
TIME time_tmp;
DBUG_ENTER("Event_timed::init_execute_at");
@@ -173,12 +174,18 @@ Event_timed::init_execute_at(THD *thd, I
TIME_to_ulonglong_datetime(&time_tmp))
DBUG_RETURN(EVEX_BAD_PARAMS);
-
/*
This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
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(<ime, TIME_to_timestamp(thd,<ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd,<ime,¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("Execute AT after year 2037"));
+ DBUG_RETURN(ER_WRONG_VALUE);
+ }
execute_at_null= FALSE;
execute_at= ltime;
@@ -301,6 +308,7 @@ Event_timed::init_interval(THD *thd, Ite
RETURNS
0 OK
EVEX_PARSE_ERROR fix_fields failed
+ EVEX_BAD_PARAMS starts before now
*/
int
@@ -308,6 +316,7 @@ Event_timed::init_starts(THD *thd, Item
{
my_bool not_used;
TIME ltime, time_tmp;
+ my_time_t t;
DBUG_ENTER("Event_timed::init_starts");
@@ -328,10 +337,17 @@ Event_timed::init_starts(THD *thd, Item
DBUG_RETURN(EVEX_BAD_PARAMS);
/*
- This may result in a 1970-01-01 date if ltime is > 2037-xx-xx
- CONVERT_TZ has similar problem
+ This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
+ 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(<ime, TIME_to_timestamp(thd, <ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd, <ime, ¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("STARTS after year 2037"));
+ DBUG_RETURN(EVEX_BAD_PARAMS);
+ }
starts= ltime;
starts_null= FALSE;
@@ -358,6 +374,7 @@ Event_timed::init_starts(THD *thd, Item
RETURNS
0 OK
EVEX_PARSE_ERROR fix_fields failed
+ ER_WRONG_VALUE starts distant date (after year 2037)
EVEX_BAD_PARAMS ENDS before STARTS
*/
@@ -366,6 +383,7 @@ Event_timed::init_ends(THD *thd, Item *n
{
TIME ltime, ltime_now;
my_bool not_used;
+ my_time_t t;
DBUG_ENTER("Event_timed::init_ends");
@@ -377,11 +395,18 @@ Event_timed::init_ends(THD *thd, Item *n
DBUG_RETURN(EVEX_BAD_PARAMS);
/*
- This may result in a 1970-01-01 date if ltime is > 2037-xx-xx ?
- CONVERT_TZ has similar problem ?
+ This may result in a 1970-01-01 date if ltime is > 2037-xx-xx.
+ 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"));
- my_tz_UTC->gmt_sec_to_TIME(<ime, TIME_to_timestamp(thd, <ime, ¬_used));
+ my_tz_UTC->gmt_sec_to_TIME(<ime,t=TIME_to_timestamp(thd, <ime, ¬_used));
+ if (!t)
+ {
+ DBUG_PRINT("error", ("ENDS after year 2037"));
+ DBUG_RETURN(EVEX_BAD_PARAMS);
+ }
/* Check whether ends is after starts */
DBUG_PRINT("info", ("ENDS after STARTS?"));
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2213) BUG#16396 | ahristov | 3 Mar |