diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2008-08-18 13:05:51 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2008-08-18 13:05:51 +0200 |
commit | 4b317a5688420a7ff0ba438dbc0b5fe6393c673b (patch) | |
tree | a90a32a0037c8098ecdf38ab6760130373cb10c8 /sql/event_parse_data.cc | |
parent | 0e62334a2419e739d5751894626d3d1a894fb314 (diff) | |
download | mariadb-git-4b317a5688420a7ff0ba438dbc0b5fe6393c673b.tar.gz |
Bug#35981: ALTER EVENT causes the server to change the PRESERVE option.
If [NOT] PRESERVE was not given, parser always defaulted to NOT
PRESERVE, making it impossible for the "not given = no change"
rule to work in ALTER EVENT. Leaving out the PRESERVE-clause
defaults to NOT PRESERVE on CREATE now, and to "no change" in
ALTER.
Diffstat (limited to 'sql/event_parse_data.cc')
-rw-r--r-- | sql/event_parse_data.cc | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index e87e4593f8f..df419e92d0d 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -45,7 +45,7 @@ Event_parse_data::new_instance(THD *thd) */ Event_parse_data::Event_parse_data() - :on_completion(Event_parse_data::ON_COMPLETION_DROP), + :on_completion(Event_parse_data::ON_COMPLETION_DEFAULT), status(Event_parse_data::ENABLED), do_not_create(FALSE), body_changed(FALSE), @@ -114,6 +114,12 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc) if (ltime_utc >= (my_time_t) thd->query_start()) return; + /* + We'll come back later when we have the real on_completion value + */ + if (on_completion == Event_parse_data::ON_COMPLETION_DEFAULT) + return; + if (on_completion == Event_parse_data::ON_COMPLETION_DROP) { switch (thd->lex->sql_command) { @@ -142,6 +148,42 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc) /* + Check time/dates in ALTER EVENT + + We check whether ALTER EVENT was given dates that are in the past. + However to know how to react, we need the ON COMPLETION type. Hence, + the check is deferred until we have the previous ON COMPLETION type + from the event-db to fall back on if nothing was specified in the + ALTER EVENT-statement. + + SYNOPSIS + Event_parse_data::check_dates() + thd Thread + on_completion ON COMPLETION value currently in event-db. + Will be overridden by value in ALTER EVENT if given. + + RETURN VALUE + TRUE an error occurred, do not ALTER + FALSE OK +*/ + +bool +Event_parse_data::check_dates(THD *thd, int previous_on_completion) +{ + if (on_completion == Event_parse_data::ON_COMPLETION_DEFAULT) + { + on_completion= previous_on_completion; + if (!ends_null) + check_if_in_the_past(thd, ends); + if (!execute_at_null) + check_if_in_the_past(thd, execute_at); + } + return do_not_create; +} + + + +/* Sets time for execution for one-time event. SYNOPSIS |