List:Commits« Previous MessageNext Message »
From:ahristov Date:January 26 2006 8:21pm
Subject:bk commit into 5.1 tree (andrey:1.2069) BUG#16419
View as plain text  
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.2069 06/01/26 21:21:21 andrey@lmy004. +5 -0
  fix for bug#16419 (Events: can't use timestamp in the schedule)
  WL #1034 (Internal CRON)

  sql/sql_yacc.yy
    1.444 06/01/26 21:21:14 andrey@lmy004. +10 -0
    - handle new return value of event_timed::init_execute_at()

  sql/share/errmsg.txt
    1.76 06/01/26 21:21:14 andrey@lmy004. +1 -1
    - fix an error message, one more "einen"

  sql/event_timed.cc
    1.20 06/01/26 21:21:13 andrey@lmy004. +15 -7
    - remove stupid check of val_int()
    - fix for bug #16419 (Events: can't use timestamp in the schedule)
      => don't use val_int() but only get_date() and use the date!

  mysql-test/t/events.test
    1.8 06/01/26 21:21:13 andrey@lmy004. +9 -0
    add tests

  mysql-test/r/events.result
    1.7 06/01/26 21:21:13 andrey@lmy004. +9 -0
    update test result

# 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-bug16419

--- 1.443/sql/sql_yacc.yy	2006-01-23 16:13:38 +01:00
+++ 1.444/sql/sql_yacc.yy	2006-01-26 21:21:14 +01:00
@@ -1436,6 +1436,16 @@
                 yyerror(ER(ER_SYNTAX_ERROR));
                 YYABORT;  
                 break;
+              case ER_WRONG_VALUE:
+                {
+                  char buff[120];
+                  String str(buff,(uint32) sizeof(buff), system_charset_info);
+                  String *str2= $2->val_str(&str);
+                  my_error(ER_WRONG_VALUE, MYF(0), "AT",
+                           str2? str2->c_ptr():"NULL");
+                  YYABORT;
+                  break;
+                }          
               case EVEX_BAD_PARAMS:
                 my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0));
                 YYABORT;

--- 1.6/mysql-test/r/events.result	2006-01-20 22:24:51 +01:00
+++ 1.7/mysql-test/r/events.result	2006-01-26 21:21:13 +01:00
@@ -40,6 +40,15 @@
 0
 drop event event3;
 drop table t_event3;
+create event e_26 on schedule at '2017-01-01 00:00:00' disabled do set @a = 5;
+select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
+db	name	body	definer	convert_tz(execute_at, 'UTC', 'SYSTEM')	on_completion
+events_test	e_26	 set @a = 5	root@localhost	2017-01-01 00:00:00	DROP
+drop event e_26;
+create event e_26 on schedule at NULL disabled do set @a = 5;
+ERROR HY000: Incorrect AT value: 'NULL'
+create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
+ERROR HY000: Incorrect AT value: 'definitely not a datetime'
 set names utf8;
 create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
 drop event задачка;

--- 1.7/mysql-test/t/events.test	2006-01-20 22:24:51 +01:00
+++ 1.8/mysql-test/t/events.test	2006-01-26 21:21:13 +01:00
@@ -32,6 +32,15 @@
 drop event event3;
 drop table t_event3;
 
+
+create event e_26 on schedule at '2017-01-01 00:00:00' disabled do set @a = 5;
+select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
+drop event e_26;
+--error 1503
+create event e_26 on schedule at NULL disabled do set @a = 5;
+--error 1503
+create event e_26 on schedule at 'definitely not a datetime' disabled do set @a = 5;
+
 set names utf8;
 create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
 drop event задачка;

--- 1.19/sql/event_timed.cc	2006-01-23 16:13:37 +01:00
+++ 1.20/sql/event_timed.cc	2006-01-26 21:21:13 +01:00
@@ -133,6 +133,7 @@
    0 - OK
    EVEX_PARSE_ERROR - fix_fields failed
    EVEX_BAD_PARAMS  - datetime is in the past
+   ER_WRONG_VALUE   - wrong value for execute at
 */
 
 int
@@ -148,19 +149,19 @@
   if (expr->fix_fields(thd, &expr))
     DBUG_RETURN(EVEX_PARSE_ERROR);
 
-  if (expr->val_int() == MYSQL_TIMESTAMP_ERROR)
-    DBUG_RETURN(EVEX_BAD_PARAMS);
-
   // let's check whether time is in the past
   thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, 
                               (my_time_t) thd->query_start()); 
 
-  if (expr->val_int() < TIME_to_ulonglong_datetime(&time_tmp))
-    DBUG_RETURN(EVEX_BAD_PARAMS);
 
   if ((not_used= expr->get_date(&ltime, TIME_NO_ZERO_DATE)))
+    DBUG_RETURN(ER_WRONG_VALUE);
+
+  if (TIME_to_ulonglong_datetime(&ltime) <
+      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
@@ -292,8 +293,7 @@
 event_timed::init_starts(THD *thd, Item *new_starts)
 {
   my_bool not_used;
-  TIME ltime;
-  my_time_t my_time_tmp;
+  TIME ltime, time_tmp;
 
   DBUG_ENTER("event_timed::init_starts");
 
@@ -304,6 +304,14 @@
     DBUG_RETURN(EVEX_BAD_PARAMS);
 
   if ((not_used= new_starts->get_date(&ltime, TIME_NO_ZERO_DATE)))
+    DBUG_RETURN(EVEX_BAD_PARAMS);
+
+  // let's check whether time is in the past
+  thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, 
+                              (my_time_t) thd->query_start()); 
+
+  if (TIME_to_ulonglong_datetime(&ltime) <
+      TIME_to_ulonglong_datetime(&time_tmp))
     DBUG_RETURN(EVEX_BAD_PARAMS);
 
   /*

--- 1.75/sql/share/errmsg.txt	2006-01-23 13:02:39 +01:00
+++ 1.76/sql/share/errmsg.txt	2006-01-26 21:21:14 +01:00
@@ -5793,7 +5793,7 @@
         eng "Data for column '%s' too long"
 ER_DROP_INDEX_FK
         eng "Cannot drop index '%-.64s': needed in a foreign key constraint"
 ER_CANT_WRITE_LOCK_LOG_TABLE
         eng "You can't write-lock a log table. Only read access is possible."
 ER_CANT_READ_LOCK_LOG_TABLE
Thread
bk commit into 5.1 tree (andrey:1.2069) BUG#16419ahristov26 Jan