Commit 8322eb0a authored by unknown's avatar unknown
Browse files

* Added comments and one assert

 * Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()


sql/item.cc:
   * More comments
   * Backport of safety measures from 5.0: make numeorous replaces:
      s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item.h:
  Assert added
sql/item_cmpfunc.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_func.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_strfunc.h:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_subselect.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/item_sum.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/set_var.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_base.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_handler.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_help.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
sql/sql_select.cc:
  Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
parent 0e486852
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1490,8 +1490,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
	}
        /*
          Here, a subset of actions performed by Item_ref::set_properties
          is not enough. So we pass ptr to NULL into Item_[direct]_ref ctor,
          so no initialization is performed, and call fix_fields() below.
          is not enough. So we pass ptr to NULL into Item_[direct]_ref
          constructor, so no initialization is performed, and call 
          fix_fields() below.
        */
        Item *save= last->ref_pointer_array[counter];
        last->ref_pointer_array[counter]= NULL;
@@ -2291,7 +2292,7 @@ bool Item_default_value::fix_fields(THD *thd,
    fixed= 1;
    return 0;
  }
  if (arg->fix_fields(thd, table_list, &arg))
  if (!arg->fixed && arg->fix_fields(thd, table_list, &arg))
    return 1;
  
  if (arg->type() == REF_ITEM)
@@ -2338,7 +2339,7 @@ bool Item_insert_value::fix_fields(THD *thd,
				   Item **items)
{
  DBUG_ASSERT(fixed == 0);
  if (arg->fix_fields(thd, table_list, &arg))
  if (!arg->fixed && arg->fix_fields(thd, table_list, &arg))
    return 1;

  if (arg->type() == REF_ITEM)
+1 −0
Original line number Diff line number Diff line
@@ -852,6 +852,7 @@ class Item_ref :public Item_ident
  Item_ref(Item **item, const char *table_name_par, const char *field_name_par)
    :Item_ident(NullS, table_name_par, field_name_par), ref(item)
  {
    DBUG_ASSERT(item);
    if (*item)
      set_properties();
  }
+4 −2
Original line number Diff line number Diff line
@@ -2374,8 +2374,10 @@ bool
Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
  DBUG_ASSERT(fixed == 0);
  if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1) ||
      args[1]->fix_fields(thd,tables, args + 1) || args[1]->check_cols(1))
  if ((!args[0]->fixed &&
       args[0]->fix_fields(thd, tables, args)) || args[0]->check_cols(1) ||
      (!args[1]->fixed && 
       args[1]->fix_fields(thd,tables, args + 1)) || args[1]->check_cols(1))
    return 1;					/* purecov: inspected */
  with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
  max_length= 1;
+2 −2
Original line number Diff line number Diff line
@@ -351,7 +351,6 @@ void Item_func::split_sum_func(THD *thd, Item **ref_pointer_array,
      uint el= fields.elements;
      ref_pointer_array[el]= item;
      Item *new_item= new Item_ref(ref_pointer_array + el, 0, item->name);
      new_item->collation.set(item->collation);
      fields.push_front(item);
      ref_pointer_array[el]= item;
      thd->change_item_tree(arg, new_item);
@@ -1664,7 +1663,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
	 arg != arg_end ;
	 arg++,i++)
    {
      if ((*arg)->fix_fields(thd, tables, arg))
      if (!(*arg)->fixed && 
          (*arg)->fix_fields(thd, tables, arg))
	DBUG_RETURN(1);
      // we can't assign 'item' before, because fix_fields() can change arg
      Item *item= *arg;
+2 −1
Original line number Diff line number Diff line
@@ -397,7 +397,8 @@ class Item_func_make_set :public Item_str_func
  bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
  {
    DBUG_ASSERT(fixed == 0);
    return (item->fix_fields(thd, tlist, &item) ||
    return (!item->fixed &&
            item->fix_fields(thd, tlist, &item) ||
	    item->check_cols(1) ||
	    Item_func::fix_fields(thd, tlist, ref));
  }
Loading