From 8b3b76c6d47bdc4b00615196844d789ffdb7a8be Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Jan 2006 22:01:34 +0100 Subject: [PATCH] fix for bug#16434 (Events: Illegal dates don't cause errors) (post-review commit) WL#1034 (Internal CRON) sql/event_timed.cc: remove bogus check sql/share/errmsg.txt: change error messages sql/sql_yacc.yy: handle error code returned by event_timed::init_starts() --- sql/event_timed.cc | 3 --- sql/share/errmsg.txt | 2 +- sql/sql_yacc.yy | 20 +++++++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/sql/event_timed.cc b/sql/event_timed.cc index cc8849364da..df40f5ed6f9 100644 --- a/sql/event_timed.cc +++ b/sql/event_timed.cc @@ -238,9 +238,6 @@ event_timed::init_starts(THD *thd, Item *new_starts) if (new_starts->fix_fields(thd, &new_starts)) DBUG_RETURN(EVEX_PARSE_ERROR); - if (new_starts->val_int() == MYSQL_TIMESTAMP_ERROR) - DBUG_RETURN(EVEX_BAD_PARAMS); - if ((not_used= new_starts->get_date(<ime, TIME_NO_ZERO_DATE))) DBUG_RETURN(EVEX_BAD_PARAMS); diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index e735a87bab4..0ee2fc5e6f1 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5760,7 +5760,7 @@ ER_EVENT_DROP_FAILED ER_EVENT_INTERVAL_NOT_POSITIVE eng "INTERVAL must be positive" ER_EVENT_ENDS_BEFORE_STARTS - eng "ENDS must be after STARTS" + eng "ENDS is either invalid or before STARTS" ER_EVENT_EXEC_TIME_IN_THE_PAST eng "Activation (AT) time is in the past" ER_EVENT_OPEN_TABLE_FAILED diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f35683b5f76..678ac9e169c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1467,7 +1467,25 @@ ev_starts: /* empty */ { LEX *lex= Lex; if (!lex->et_compile_phase) - lex->et->init_starts(YYTHD, $2); + { + + switch (lex->et->init_starts(YYTHD, $2)) { + case EVEX_PARSE_ERROR: + yyerror(ER(ER_SYNTAX_ERROR)); + YYABORT; + break; + case EVEX_BAD_PARAMS: + { + char buff[20]; + String str(buff,(uint32) sizeof(buff), system_charset_info); + String *str2= $2->val_str(&str); + my_error(ER_WRONG_VALUE, MYF(0), "STARTS", str2? str2->c_ptr(): + NULL); + YYABORT; + break; + } + } + } } ;