diff options
author | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-06-10 00:07:03 +0700 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-06-10 00:07:03 +0700 |
commit | 7be063ad8063af97b33f96240b7b488da48c443f (patch) | |
tree | 63a7c37a1ec59dfeb60718fa0d55eda1f8038628 /sql | |
parent | 95f1b6762b59a7e4dfb2a93fa230fbc896b0ce6c (diff) | |
parent | 1cc304e33eee2c3fdf9ec46ab4ad481dd30ea274 (diff) | |
download | mariadb-git-7be063ad8063af97b33f96240b7b488da48c443f.tar.gz |
Auto-merge of patch for bug#11764334 from mysql-5.1 tree.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_db_repository.cc | 13 | ||||
-rw-r--r-- | sql/event_parse_data.cc | 11 | ||||
-rw-r--r-- | sql/event_parse_data.h | 1 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 3 |
4 files changed, 20 insertions, 8 deletions
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 9d52627fa83..5bcc90718c7 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -235,9 +235,16 @@ mysql_event_fill_row(THD *thd, if (fields[f_num= ET_FIELD_NAME]->store(et->name.str, et->name.length, scs)) goto err_truncate; - /* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/ + /* ON_COMPLETION field is NOT NULL thus not calling set_notnull()*/ rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE); - rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE); + + /* + Set STATUS value unconditionally in case of CREATE EVENT. + For ALTER EVENT set it only if value of this field was changed. + Since STATUS field is NOT NULL call to set_notnull() is not needed. + */ + if (!is_update || et->status_changed) + rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE); rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE); /* @@ -716,8 +723,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE)) goto end; - table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE); - if ((ret= table->file->ha_write_row(table->record[0]))) { table->file->print_error(ret, MYF(0)); diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index c36567fc8e1..d8c9847d0a0 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -48,9 +48,8 @@ Event_parse_data::new_instance(THD *thd) Event_parse_data::Event_parse_data() :on_completion(Event_parse_data::ON_COMPLETION_DEFAULT), - status(Event_parse_data::ENABLED), - do_not_create(FALSE), - body_changed(FALSE), + status(Event_parse_data::ENABLED), status_changed(false), + do_not_create(FALSE), body_changed(FALSE), item_starts(NULL), item_ends(NULL), item_execute_at(NULL), starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE), item_expression(NULL), expression(0) @@ -142,6 +141,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc) else if (status == Event_parse_data::ENABLED) { status= Event_parse_data::DISABLED; + status_changed= true; push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_EVENT_EXEC_TIME_IN_THE_PAST, ER(ER_EVENT_EXEC_TIME_IN_THE_PAST)); @@ -571,7 +571,10 @@ void Event_parse_data::check_originator_id(THD *thd) DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED.")); if ((status == Event_parse_data::ENABLED) || (status == Event_parse_data::DISABLED)) - status = Event_parse_data::SLAVESIDE_DISABLED; + { + status= Event_parse_data::SLAVESIDE_DISABLED; + status_changed= true; + } originator = thd->server_id; } else diff --git a/sql/event_parse_data.h b/sql/event_parse_data.h index 4ca46b40d3f..4be82e30c43 100644 --- a/sql/event_parse_data.h +++ b/sql/event_parse_data.h @@ -55,6 +55,7 @@ public: int on_completion; int status; + bool status_changed; longlong originator; /* do_not_create will be set if STARTS time is in the past and diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5ab1a648d09..a974998f207 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2227,16 +2227,19 @@ opt_ev_status: | ENABLE_SYM { Lex->event_parse_data->status= Event_parse_data::ENABLED; + Lex->event_parse_data->status_changed= true; $$= 1; } | DISABLE_SYM ON SLAVE { Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED; + Lex->event_parse_data->status_changed= true; $$= 1; } | DISABLE_SYM { Lex->event_parse_data->status= Event_parse_data::DISABLED; + Lex->event_parse_data->status_changed= true; $$= 1; } ; |