Item_param::clone_item(THD *thd)
{
  // There's no "default". See comments in Item_param::save_in_field().
  switch (state) {
  case IGNORE_VALUE:
  case DEFAULT_VALUE:
    invalid_default_param();
    // fall through
  case NULL_VALUE:
    return new (thd->mem_root) Item_null(thd, name.str);
  case SHORT_DATA_VALUE:
  case LONG_DATA_VALUE:
  {
    DBUG_ASSERT(type_handler()->cmp_type() == value.type_handler()->cmp_type());
    return value_clone_item(thd);
  }
  case NO_VALUE:
    return 0;
  }
  DBUG_ASSERT(0);  // Garbage
  return 0;
}
Item_param::clone_item(THD *thd)
{
   
  switch (state) {
  case IGNORE_VALUE:
  case DEFAULT_VALUE:
    invalid_default_param();
     
  case NULL_VALUE:
    return new (thd->mem_root) Item_null(thd, name.str);
  case SHORT_DATA_VALUE:
  case LONG_DATA_VALUE:
  {
    DBUG_ASSERT(type_handler()->cmp_type() == value.type_handler()->cmp_type());
    return value_clone_item(thd);
  }
  case NO_VALUE:
    return 0;
  }
  DBUG_ASSERT(0);   
  return 0;
}