summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <mskold/marty@linux.site>2007-04-04 17:03:31 +0200
committerunknown <mskold/marty@linux.site>2007-04-04 17:03:31 +0200
commit7279edc72dd951e356db1cf9842115452a5773a1 (patch)
treedd37944358fa408c8d0b0528e0d416320718c1e4 /sql/sql_delete.cc
parent2770bf0bfcc73c78b37320c4662c27c72b9d9e12 (diff)
parent59a64c2b1604649be464d38141e2345c79d27bd3 (diff)
downloadmariadb-git-7279edc72dd951e356db1cf9842115452a5773a1.tar.gz
Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb include/my_base.h: Auto merged sql/ha_ndbcluster.h: Auto merged sql/mysql_priv.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_trigger.h: Auto merged sql/sql_update.cc: Auto merged sql/ha_ndbcluster.cc: Merge
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc26
1 files changed, 25 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d300edd6e18..4e865a12b66 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -221,7 +221,20 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
init_ftfuncs(thd, select_lex, 1);
thd->proc_info="updating";
- will_batch= !table->file->start_bulk_delete();
+ if (table->triggers &&
+ 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);
+ will_batch= FALSE;
+ }
+ else
+ will_batch= !table->file->start_bulk_delete();
table->mark_columns_needed_for_delete();
@@ -563,6 +576,17 @@ multi_delete::initialize_tables(JOIN *join)
transactional_tables= 1;
else
normal_tables= 1;
+ if (tbl->triggers &&
+ tbl->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) tbl->file->extra(HA_EXTRA_DELETE_CANNOT_BATCH);
+ }
tbl->prepare_for_position();
tbl->mark_columns_needed_for_delete();
}