mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
various cleanups
This commit is contained in:
committed by
Sergei Golubchik
parent
db7edfed17
commit
2fe8dd0f90
@ -7728,7 +7728,7 @@ fill_record(THD *thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
|
||||
table_arg->auto_increment_field_not_null= FALSE;
|
||||
f.rewind();
|
||||
}
|
||||
else if (thd->lex->unit.insert_table_with_stored_vcol)
|
||||
else
|
||||
vcol_table= thd->lex->unit.insert_table_with_stored_vcol;
|
||||
|
||||
while ((fld= f++))
|
||||
@ -7796,6 +7796,7 @@ void switch_to_nullable_trigger_fields(List<Item> &items, TABLE *table)
|
||||
{
|
||||
Field** field= table->field_to_fill();
|
||||
|
||||
/* True if we have NOT NULL fields and BEFORE triggers */
|
||||
if (field != table->field)
|
||||
{
|
||||
List_iterator_fast<Item> it(items);
|
||||
@ -7888,7 +7889,8 @@ static bool not_null_fields_have_null_values(TABLE *table)
|
||||
*/
|
||||
|
||||
bool
|
||||
fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
|
||||
fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
|
||||
List<Item> &fields,
|
||||
List<Item> &values, bool ignore_errors,
|
||||
enum trg_event_type event)
|
||||
{
|
||||
@ -7898,16 +7900,17 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
|
||||
result= fill_record(thd, table, fields, values, ignore_errors,
|
||||
event == TRG_EVENT_UPDATE);
|
||||
|
||||
if (!result && triggers)
|
||||
result= triggers->process_triggers(thd, event, TRG_ACTION_BEFORE, TRUE) ||
|
||||
not_null_fields_have_null_values(table);
|
||||
|
||||
/*
|
||||
Re-calculate virtual fields to cater for cases when base columns are
|
||||
updated by the triggers.
|
||||
*/
|
||||
if (!result && triggers)
|
||||
{
|
||||
if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE,
|
||||
TRUE) ||
|
||||
not_null_fields_have_null_values(table))
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
Re-calculate virtual fields to cater for cases when base columns are
|
||||
updated by the triggers.
|
||||
*/
|
||||
List_iterator_fast<Item> f(fields);
|
||||
Item *fld;
|
||||
Item_field *item_field;
|
||||
@ -7915,12 +7918,12 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
|
||||
{
|
||||
fld= (Item_field*)f++;
|
||||
item_field= fld->field_for_view_update();
|
||||
if (item_field && item_field->field && table && table->vfield)
|
||||
if (item_field && table->vfield)
|
||||
{
|
||||
DBUG_ASSERT(table == item_field->field->table);
|
||||
result= update_virtual_fields(thd, table,
|
||||
table->triggers ? VCOL_UPDATE_ALL :
|
||||
VCOL_UPDATE_FOR_WRITE);
|
||||
VCOL_UPDATE_FOR_WRITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7930,6 +7933,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
|
||||
|
||||
/**
|
||||
Fill the field buffer of a table with the values of an Item list
|
||||
All fields are given a value
|
||||
|
||||
@param thd thread handler
|
||||
@param table_arg the table that is being modified
|
||||
@ -8005,7 +8009,8 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
|
||||
goto err;
|
||||
field->set_explicit_default(value);
|
||||
}
|
||||
/* Update virtual fields*/
|
||||
/* There is no default fields to update, as all fields are updated */
|
||||
/* Update virtual fields */
|
||||
thd->abort_on_warning= FALSE;
|
||||
if (table->vfield &&
|
||||
update_virtual_fields(thd, table,
|
||||
@ -8065,8 +8070,9 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr,
|
||||
DBUG_ASSERT(table == (*ptr)->table);
|
||||
if (table->vfield)
|
||||
result= update_virtual_fields(thd, table,
|
||||
table->triggers ? VCOL_UPDATE_ALL :
|
||||
VCOL_UPDATE_FOR_WRITE);
|
||||
table->triggers ?
|
||||
VCOL_UPDATE_ALL :
|
||||
VCOL_UPDATE_FOR_WRITE);
|
||||
}
|
||||
return result;
|
||||
|
||||
|
Reference in New Issue
Block a user