summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.h
diff options
context:
space:
mode:
authorunknown <dlenev@brandersnatch.localdomain>2004-11-12 17:04:07 +0300
committerunknown <dlenev@brandersnatch.localdomain>2004-11-12 17:04:07 +0300
commitbb43e8317fc3d78fd5f3d22a0ca0acf090540cd5 (patch)
tree3d3e39fea75ed94d80cbd130282b1549532aa7e0 /sql/sql_trigger.h
parente5fd013fdf6c8664daa0bbdcaf0d22bf44e90d62 (diff)
downloadmariadb-git-bb43e8317fc3d78fd5f3d22a0ca0acf090540cd5.tar.gz
Fix for bug #5890 "Triggers fail for DELETE without WHERE".
If we have DELETE with always true WHERE clause we should not use optimized delete_all_rows() method for tables with DELETE triggers, because in this case we will lose side-effect of deletion. mysql-test/r/trigger.result: Added test for bug #5890 "Triggers fail for DELETE without WHERE". mysql-test/t/trigger.test: Added test for bug #5890 "Triggers fail for DELETE without WHERE". sql/sql_delete.cc: mysql_delete(): We should not use optimized delete_all_rows() method for tables with DELETE triggers, because in this case we will lose side-effect of deletion. sql/sql_trigger.h: Added new Table_triggers_list::has_delete_triggers() method which allows to understand quickly if we have some DELETE triggers in our list.
Diffstat (limited to 'sql/sql_trigger.h')
-rw-r--r--sql/sql_trigger.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h
index 8ab2ab003f8..d0376f056d9 100644
--- a/sql/sql_trigger.h
+++ b/sql/sql_trigger.h
@@ -58,5 +58,11 @@ public:
static bool check_n_load(THD *thd, const char *db, const char *table_name,
TABLE *table);
+ bool has_delete_triggers()
+ {
+ return (bodies[TRG_EVENT_DELETE][TRG_ACTION_BEFORE] ||
+ bodies[TRG_EVENT_DELETE][TRG_ACTION_AFTER]);
+ }
+
friend class Item_trigger_field;
};