diff options
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r-- | sql/sql_trigger.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 817db2d8a79..617cce05525 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -771,8 +771,8 @@ bool Table_triggers_list::prepare_record1_accessors(TABLE *table) void Table_triggers_list::set_table(TABLE *new_table) { - table= new_table; - for (Field **field= table->triggers->record1_field ; *field ; field++) + trigger_table= new_table; + for (Field **field= new_table->triggers->record1_field ; *field ; field++) { (*field)->table= (*field)->orig_table= new_table; (*field)->table_name= &new_table->alias; @@ -1316,7 +1316,8 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, It is OK to allocate some memory on table's MEM_ROOT since this table instance will be thrown out at the end of rename anyway. */ - new_def.str= memdup_root(&table->mem_root, buff.ptr(), buff.length()); + new_def.str= memdup_root(&trigger_table->mem_root, buff.ptr(), + buff.length()); new_def.length= buff.length(); on_table_name->str= new_def.str + before_on_len; on_table_name->length= on_q_table_name_len; @@ -1496,17 +1497,17 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event, if (old_row_is_record1) { old_field= record1_field; - new_field= table->field; + new_field= trigger_table->field; } else { new_field= record1_field; - old_field= table->field; + old_field= trigger_table->field; } thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER); err_status= sp_trigger->execute_trigger - (thd, table->s->db, table->s->table_name, + (thd, trigger_table->s->db, trigger_table->s->table_name, &subject_table_grants[event][time_type]); thd->restore_sub_statement_state(&statement_state); } @@ -1542,7 +1543,7 @@ void Table_triggers_list::mark_fields_used(THD *thd, trg_event_type event) { /* We cannot mark fields which does not present in table. */ if (trg_field->field_idx != (uint)-1) - table->field[trg_field->field_idx]->query_id = thd->query_id; + trigger_table->field[trg_field->field_idx]->query_id = thd->query_id; } } } @@ -1573,7 +1574,7 @@ bool Table_triggers_list::is_updated_in_before_update_triggers(Field *fld) { if (trg_fld->get_settable_routine_parameter() && trg_fld->field_idx != (uint)-1 && - table->field[trg_fld->field_idx]->eq(fld)) + trigger_table->field[trg_fld->field_idx]->eq(fld)) return TRUE; } return FALSE; |