Commit e2bd1ee9 authored by unknown's avatar unknown

Fix of LP bug#706884: fill_record should be used for only one table (no need list).

sql/sql_base.cc:
  fill_record should be used for only one table (no need list).
parent 7effc175
...@@ -8256,11 +8256,9 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values, ...@@ -8256,11 +8256,9 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
List_iterator_fast<Item> f(fields),v(values); List_iterator_fast<Item> f(fields),v(values);
Item *value, *fld; Item *value, *fld;
Item_field *field; Item_field *field;
TABLE *table= 0; TABLE *table= 0, *vcol_table= 0;
List<TABLE> tbl_list;
bool abort_on_warning_saved= thd->abort_on_warning; bool abort_on_warning_saved= thd->abort_on_warning;
DBUG_ENTER("fill_record"); DBUG_ENTER("fill_record");
tbl_list.empty();
/* /*
Reset the table->auto_increment_field_not_null as it is valid for Reset the table->auto_increment_field_not_null as it is valid for
...@@ -8283,7 +8281,7 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values, ...@@ -8283,7 +8281,7 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
f.rewind(); f.rewind();
} }
else if (thd->lex->unit.insert_table_with_stored_vcol) else if (thd->lex->unit.insert_table_with_stored_vcol)
tbl_list.push_back(thd->lex->unit.insert_table_with_stored_vcol); vcol_table= thd->lex->unit.insert_table_with_stored_vcol;
while ((fld= f++)) while ((fld= f++))
{ {
if (!(field= fld->filed_for_view_update())) if (!(field= fld->filed_for_view_update()))
...@@ -8313,33 +8311,19 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values, ...@@ -8313,33 +8311,19 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0)); my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
goto err; goto err;
} }
tbl_list.push_back(table); DBUG_ASSERT(vcol_table == 0 || vcol_table == table);
vcol_table= table;
} }
/* Update virtual fields*/ /* Update virtual fields*/
thd->abort_on_warning= FALSE; thd->abort_on_warning= FALSE;
if (tbl_list.head()) if (vcol_table)
{ {
List_iterator_fast<TABLE> it(tbl_list); if (vcol_table->vfield)
TABLE *prev_table= 0;
while ((table= it++))
{
/*
Do simple optimization to prevent unnecessary re-generating
values for virtual fields
*/
if (table != prev_table)
{
prev_table= table;
if (table->vfield)
{
if (update_virtual_fields(thd, table, TRUE))
{ {
if (update_virtual_fields(thd, vcol_table, TRUE))
goto err; goto err;
} }
} }
}
}
}
thd->abort_on_warning= abort_on_warning_saved; thd->abort_on_warning= abort_on_warning_saved;
DBUG_RETURN(thd->is_error()); DBUG_RETURN(thd->is_error());
err: err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment