Commit 465cbc2a authored by unknown's avatar unknown

Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into lmy004.:/work/mysql-5.1-new
parents 7a13bedc 41bc3433
...@@ -4,8 +4,9 @@ drop event if exists event1; ...@@ -4,8 +4,9 @@ drop event if exists event1;
Warnings: Warnings:
Note 1305 Event event1 does not exist Note 1305 Event event1 does not exist
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
alter event event1 rename to event2; alter event event1 rename to event2 enable;
alter event event2 disabled; alter event event2 disable;
alter event event2 enable;
alter event event2 on completion not preserve; alter event event2 on completion not preserve;
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__ alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
alter event event3 rename to event2; alter event event3 rename to event2;
...@@ -40,6 +41,15 @@ count(*) ...@@ -40,6 +41,15 @@ count(*)
0 0
drop event event3; drop event event3;
drop table t_event3; drop table t_event3;
create event e_26 on schedule at '2017-01-01 00:00:00' disable 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; set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка; drop event задачка;
......
...@@ -2,8 +2,9 @@ create database if not exists events_test; ...@@ -2,8 +2,9 @@ create database if not exists events_test;
use events_test; use events_test;
drop event if exists event1; drop event if exists event1;
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
alter event event1 rename to event2; alter event event1 rename to event2 enable;
alter event event2 disabled; alter event event2 disable;
alter event event2 enable;
alter event event2 on completion not preserve; alter event event2 on completion not preserve;
delimiter __; delimiter __;
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__ alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
...@@ -32,6 +33,15 @@ select count(*) from t_event3; ...@@ -32,6 +33,15 @@ select count(*) from t_event3;
drop event event3; drop event event3;
drop table t_event3; drop table t_event3;
create event e_26 on schedule at '2017-01-01 00:00:00' disable 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; set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка; drop event задачка;
......
...@@ -133,6 +133,7 @@ event_timed::init_body(THD *thd) ...@@ -133,6 +133,7 @@ event_timed::init_body(THD *thd)
0 - OK 0 - OK
EVEX_PARSE_ERROR - fix_fields failed EVEX_PARSE_ERROR - fix_fields failed
EVEX_BAD_PARAMS - datetime is in the past EVEX_BAD_PARAMS - datetime is in the past
ER_WRONG_VALUE - wrong value for execute at
*/ */
int int
...@@ -148,19 +149,19 @@ event_timed::init_execute_at(THD *thd, Item *expr) ...@@ -148,19 +149,19 @@ event_timed::init_execute_at(THD *thd, Item *expr)
if (expr->fix_fields(thd, &expr)) if (expr->fix_fields(thd, &expr))
DBUG_RETURN(EVEX_PARSE_ERROR); 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 // let's check whether time is in the past
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp, thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,
(my_time_t) thd->query_start()); (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))) 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); 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
...@@ -292,8 +293,7 @@ int ...@@ -292,8 +293,7 @@ int
event_timed::init_starts(THD *thd, Item *new_starts) event_timed::init_starts(THD *thd, Item *new_starts)
{ {
my_bool not_used; my_bool not_used;
TIME ltime; TIME ltime, time_tmp;
my_time_t my_time_tmp;
DBUG_ENTER("event_timed::init_starts"); DBUG_ENTER("event_timed::init_starts");
...@@ -306,6 +306,14 @@ event_timed::init_starts(THD *thd, Item *new_starts) ...@@ -306,6 +306,14 @@ event_timed::init_starts(THD *thd, Item *new_starts)
if ((not_used= new_starts->get_date(&ltime, TIME_NO_ZERO_DATE))) if ((not_used= new_starts->get_date(&ltime, TIME_NO_ZERO_DATE)))
DBUG_RETURN(EVEX_BAD_PARAMS); 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);
/* /*
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
......
...@@ -168,7 +168,6 @@ static SYMBOL symbols[] = { ...@@ -168,7 +168,6 @@ static SYMBOL symbols[] = {
{ "DETERMINISTIC", SYM(DETERMINISTIC_SYM)}, { "DETERMINISTIC", SYM(DETERMINISTIC_SYM)},
{ "DIRECTORY", SYM(DIRECTORY_SYM)}, { "DIRECTORY", SYM(DIRECTORY_SYM)},
{ "DISABLE", SYM(DISABLE_SYM)}, { "DISABLE", SYM(DISABLE_SYM)},
{ "DISABLED", SYM(DISABLED_SYM)},
{ "DISCARD", SYM(DISCARD)}, { "DISCARD", SYM(DISCARD)},
{ "DISK", SYM(DISK_SYM)}, { "DISK", SYM(DISK_SYM)},
{ "DISTINCT", SYM(DISTINCT)}, { "DISTINCT", SYM(DISTINCT)},
...@@ -185,7 +184,6 @@ static SYMBOL symbols[] = { ...@@ -185,7 +184,6 @@ static SYMBOL symbols[] = {
{ "ELSE", SYM(ELSE)}, { "ELSE", SYM(ELSE)},
{ "ELSEIF", SYM(ELSEIF_SYM)}, { "ELSEIF", SYM(ELSEIF_SYM)},
{ "ENABLE", SYM(ENABLE_SYM)}, { "ENABLE", SYM(ENABLE_SYM)},
{ "ENABLED", SYM(ENABLED_SYM)},
{ "ENCLOSED", SYM(ENCLOSED)}, { "ENCLOSED", SYM(ENCLOSED)},
{ "END", SYM(END)}, { "END", SYM(END)},
{ "ENDS", SYM(ENDS_SYM)}, { "ENDS", SYM(ENDS_SYM)},
......
...@@ -5793,7 +5793,7 @@ ER_EVENT_DATA_TOO_LONG ...@@ -5793,7 +5793,7 @@ ER_EVENT_DATA_TOO_LONG
eng "Data for column '%s' too long" eng "Data for column '%s' too long"
ER_DROP_INDEX_FK ER_DROP_INDEX_FK
eng "Cannot drop index '%-.64s': needed in a foreign key constraint" eng "Cannot drop index '%-.64s': needed in a foreign key constraint"
ger "Kann Index '%-.64s' nicht lschen: wird fr einen einen Fremdschlssel bentigt" ger "Kann Index '%-.64s' nicht lschen: wird fr einen Fremdschlssel bentigt"
ER_CANT_WRITE_LOCK_LOG_TABLE ER_CANT_WRITE_LOCK_LOG_TABLE
eng "You can't write-lock a log table. Only read access is possible." eng "You can't write-lock a log table. Only read access is possible."
ER_CANT_READ_LOCK_LOG_TABLE ER_CANT_READ_LOCK_LOG_TABLE
......
...@@ -243,7 +243,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -243,7 +243,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token DETERMINISTIC_SYM %token DETERMINISTIC_SYM
%token DIRECTORY_SYM %token DIRECTORY_SYM
%token DISABLE_SYM %token DISABLE_SYM
%token DISABLED_SYM
%token DISCARD %token DISCARD
%token DISK_SYM %token DISK_SYM
%token DISTINCT %token DISTINCT
...@@ -259,7 +258,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -259,7 +258,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ELSEIF_SYM %token ELSEIF_SYM
%token ELT_FUNC %token ELT_FUNC
%token ENABLE_SYM %token ENABLE_SYM
%token ENABLED_SYM
%token ENCLOSED %token ENCLOSED
%token ENCODE_SYM %token ENCODE_SYM
%token ENCRYPT %token ENCRYPT
...@@ -1436,6 +1434,16 @@ ev_schedule_time: EVERY_SYM expr interval ...@@ -1436,6 +1434,16 @@ ev_schedule_time: EVERY_SYM expr interval
yyerror(ER(ER_SYNTAX_ERROR)); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
break; 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: case EVEX_BAD_PARAMS:
my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0)); my_error(ER_EVENT_EXEC_TIME_IN_THE_PAST, MYF(0));
YYABORT; YYABORT;
...@@ -1446,14 +1454,14 @@ ev_schedule_time: EVERY_SYM expr interval ...@@ -1446,14 +1454,14 @@ ev_schedule_time: EVERY_SYM expr interval
; ;
opt_ev_status: /* empty */ {$<ulong_num>$= 0;} opt_ev_status: /* empty */ {$<ulong_num>$= 0;}
| ENABLED_SYM | ENABLE_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->et_compile_phase) if (!lex->et_compile_phase)
lex->et->status= MYSQL_EVENT_ENABLED; lex->et->status= MYSQL_EVENT_ENABLED;
$<ulong_num>$= 1; $<ulong_num>$= 1;
} }
| DISABLED_SYM | DISABLE_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -9302,7 +9310,7 @@ keyword_sp: ...@@ -9302,7 +9310,7 @@ keyword_sp:
| DELAY_KEY_WRITE_SYM {} | DELAY_KEY_WRITE_SYM {}
| DES_KEY_FILE {} | DES_KEY_FILE {}
| DIRECTORY_SYM {} | DIRECTORY_SYM {}
| DISABLED_SYM {} | DISABLE_SYM {}
| DISCARD {} | DISCARD {}
| DISK_SYM {} | DISK_SYM {}
| DUMPFILE {} | DUMPFILE {}
...@@ -9322,9 +9330,7 @@ keyword_sp: ...@@ -9322,9 +9330,7 @@ keyword_sp:
| EXTENT_SIZE_SYM {} | EXTENT_SIZE_SYM {}
| FAST_SYM {} | FAST_SYM {}
| FOUND_SYM {} | FOUND_SYM {}
| DISABLE_SYM {}
| ENABLE_SYM {} | ENABLE_SYM {}
| ENABLED_SYM {}
| FULL {} | FULL {}
| FILE_SYM {} | FILE_SYM {}
| FIRST_SYM {} | FIRST_SYM {}
......
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