diff options
author | unknown <mskold/marty@linux.site> | 2007-04-04 13:21:49 +0200 |
---|---|---|
committer | unknown <mskold/marty@linux.site> | 2007-04-04 13:21:49 +0200 |
commit | 655a58d85c5b83824ceec5a7041bbb3b84b5731a (patch) | |
tree | 625030adbf3bf1a60ae1260b13c5cfa9ce655ef6 /sql/sql_insert.cc | |
parent | 5abe2fdba4823370b50495ca1f926a514124785c (diff) | |
parent | 2efc0f51cf3e80cd49c1ea0dee9a440936ee6287 (diff) | |
download | mariadb-git-655a58d85c5b83824ceec5a7041bbb3b84b5731a.tar.gz |
Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1
sql/ha_ndbcluster.h:
Auto merged
sql/sql_trigger.h:
Auto merged
mysql-test/r/ndb_trigger.result:
Using local, will re-generate.
include/my_base.h:
Merge
mysql-test/t/ndb_trigger.test:
Merge
sql/ha_ndbcluster.cc:
Merge
sql/mysql_priv.h:
Merge
sql/sql_delete.cc:
Merge
sql/sql_insert.cc:
Merge
sql/sql_load.cc:
Merge
sql/sql_update.cc:
Merge
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index aaffa09b978..af239c1f62b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -341,6 +341,51 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list, } + Prepare triggers for INSERT-like statement. + + SYNOPSIS + prepare_triggers_for_insert_stmt() + thd The current thread + table Table to which insert will happen + duplic Type of duplicate handling for insert which will happen + + NOTE + Prepare triggers for INSERT-like statement by marking fields + used by triggers and inform handlers that batching of UPDATE/DELETE + cannot be done if there are BEFORE UPDATE/DELETE triggers. +*/ + +void prepare_triggers_for_insert_stmt(THD *thd, TABLE *table, + enum_duplicates duplic) +{ + if (table->triggers) + { + if (table->triggers->has_triggers(TRG_EVENT_DELETE, + TRG_ACTION_AFTER)) + { + /* + The table has AFTER DELETE triggers that might access to + subject table and therefore might need delete to be done + immediately. So we turn-off the batching. + */ + (void) table->file->extra(HA_EXTRA_DELETE_CANNOT_BATCH); + } + if (table->triggers->has_triggers(TRG_EVENT_UPDATE, + TRG_ACTION_AFTER)) + { + /* + The table has AFTER UPDATE triggers that might access to subject + table and therefore might need update to be done immediately. + So we turn-off the batching. + */ + (void) table->file->extra(HA_EXTRA_UPDATE_CANNOT_BATCH); + } + mark_fields_used_by_triggers_for_insert_stmt(thd, table, duplic); + } +} + + +/* bool mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, List<List_item> &values_list, |