mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user