mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged sql/sql_delete.cc: Auto merged
This commit is contained in:
@@ -45,6 +45,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
bool transactional_table, safe_update, const_cond;
|
||||
bool const_cond_result;
|
||||
ha_rows deleted= 0;
|
||||
bool triggers_applicable;
|
||||
uint usable_index= MAX_KEY;
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
@@ -102,6 +103,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
/* Error evaluating val_int(). */
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
Test if the user wants to delete all rows and deletion doesn't have
|
||||
any side-effects (because of triggers), so we can use optimized
|
||||
@@ -249,7 +251,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
|
||||
init_ftfuncs(thd, select_lex, 1);
|
||||
thd_proc_info(thd, "updating");
|
||||
if (table->triggers &&
|
||||
|
||||
/* NOTE: TRUNCATE must not invoke triggers. */
|
||||
|
||||
triggers_applicable= table->triggers &&
|
||||
thd->lex->sql_command != SQLCOM_TRUNCATE;
|
||||
|
||||
if (triggers_applicable &&
|
||||
table->triggers->has_triggers(TRG_EVENT_DELETE,
|
||||
TRG_ACTION_AFTER))
|
||||
{
|
||||
@@ -274,7 +282,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
if (!(select && select->skip_record())&& ! thd->is_error() )
|
||||
{
|
||||
|
||||
if (table->triggers &&
|
||||
if (triggers_applicable &&
|
||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||
TRG_ACTION_BEFORE, FALSE))
|
||||
{
|
||||
@@ -285,7 +293,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
if (!(error= table->file->ha_delete_row(table->record[0])))
|
||||
{
|
||||
deleted++;
|
||||
if (table->triggers &&
|
||||
if (triggers_applicable &&
|
||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||
TRG_ACTION_AFTER, FALSE))
|
||||
{
|
||||
|
Reference in New Issue
Block a user