Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
  Item_result_field(thd), orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
{
  DBUG_ASSERT(orig_item->fixed);
  Type_std_attributes::set(orig_item);
  maybe_null= orig_item->maybe_null;
  with_sum_func= orig_item->with_sum_func;
  with_param= orig_item->with_param;
  with_field= orig_item->with_field;
  name= item_arg->name;
  m_with_subquery= orig_item->with_subquery();
  with_window_func= orig_item->with_window_func;

  if ((expr_value= orig_item->get_cache(thd)))
    expr_value->setup(thd, orig_item);

  fixed= 1;
}
Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg):
  Item_result_field(thd), orig_item(item_arg), expr_cache(NULL), expr_value(NULL)
{
  DBUG_ASSERT(orig_item->fixed);
  Type_std_attributes::set(orig_item);
  maybe_null= orig_item->maybe_null;
  with_sum_func= orig_item->with_sum_func;
  with_param= orig_item->with_param;
  with_field= orig_item->with_field;
  name= item_arg->name;
  m_with_subquery= orig_item->with_subquery();
  with_window_func= orig_item->with_window_func;

  if ((expr_value= orig_item->get_cache(thd)))
    expr_value->setup(thd, orig_item);

  fixed= 1;
}