diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-09-30 12:43:43 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-09-30 12:43:43 +0200 |
commit | a53f61e6e83c2feaee509f5d793d2c033acb63f1 (patch) | |
tree | 3c8bad484e298eb47244274edb7d539f0f81b691 /sql/sql_trigger.cc | |
parent | 49406b97dfe1d54709eae4aa1234d0071b6667ad (diff) | |
parent | c70a6f5c234dc18744a3305d5a601630bfd4ae75 (diff) | |
download | mariadb-git-a53f61e6e83c2feaee509f5d793d2c033acb63f1.tar.gz |
Merge from mysql-5.5-bugteam to mysql-5.5-runtime
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 392343eb9a3..a9b52eee9fc 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2008,6 +2008,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; @@ -2031,11 +2032,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); |