diff options
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r-- | sql/sql_trigger.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 95524a6dfbf..f058c306d42 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1,3 +1,20 @@ +/* Copyright (C) 2004-2005 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + #include "mysql_priv.h" #include "sp_head.h" #include "sql_trigger.h" @@ -201,7 +218,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables) { trg_field->setup_field(thd, table); if (!trg_field->fixed && - trg_field->fix_fields(thd, (TABLE_LIST *)0, (Item **)0)) + trg_field->fix_fields(thd, (Item **)0)) return 1; } @@ -418,6 +435,18 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, table->triggers= triggers; /* + Construct key that will represent triggers for this table in the set + of routines used by statement. + */ + triggers->sroutines_key.length= 1+strlen(db)+1+strlen(table_name)+1; + if (!(triggers->sroutines_key.str= + alloc_root(&table->mem_root, triggers->sroutines_key.length))) + DBUG_RETURN(1); + triggers->sroutines_key.str[0]= TYPE_ENUM_TRIGGER; + strmov(strmov(strmov(triggers->sroutines_key.str+1, db), "."), + table_name); + + /* TODO: This could be avoided if there is no triggers for UPDATE and DELETE. */ |