diff options
author | Dmitry Shulga <Dmitry.Shulga@Sun.COM> | 2010-09-07 16:00:41 +0700 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@Sun.COM> | 2010-09-07 16:00:41 +0700 |
commit | 029cc52c88fc970fa8703367c53fd4b291084080 (patch) | |
tree | 24dcee86bc8e7af2cfb099fa229d10b25eb42113 /sql/sql_trigger.cc | |
parent | 5c5cd5764964def5ef85e9504a53f465c1ad6ec9 (diff) | |
parent | d6f6db6f4cb02fb5a4c6225747af0673bd91ea94 (diff) | |
download | mariadb-git-029cc52c88fc970fa8703367c53fd4b291084080.tar.gz |
Auto-merge from mysql-5.1-bugteam.
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r-- | sql/sql_trigger.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index b81461e8371..f0f9011f61f 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2006,6 +2006,7 @@ bool Table_triggers_list::process_triggers(THD *thd, bool err_status; Sub_statement_state statement_state; sp_head *sp_trigger= bodies[event][time_type]; + SELECT_LEX *save_current_select; if (sp_trigger == NULL) return FALSE; @@ -2029,11 +2030,19 @@ bool Table_triggers_list::process_triggers(THD *thd, thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER); + /* + Reset current_select before call execute_trigger() and + restore it after return from one. This way error is set + in case of failure during trigger execution. + */ + save_current_select= thd->lex->current_select; + thd->lex->current_select= NULL; err_status= sp_trigger->execute_trigger(thd, &trigger_table->s->db, &trigger_table->s->table_name, &subject_table_grants[event][time_type]); + thd->lex->current_select= save_current_select; thd->restore_sub_statement_state(&statement_state); |