Commit 675d8a94 authored by Alexander Barkov's avatar Alexander Barkov

Removing the "thd" argument from Item::create_field_for_create_select().

"thd" is available through the "table" argument, as table->in_use.
parent ffac8548
......@@ -1056,7 +1056,7 @@ class Item: public Value_source,
int save_str_value_in_field(Field *field, String *result);
virtual Field *get_tmp_table_field() { return 0; }
virtual Field *create_field_for_create_select(THD *thd, TABLE *table);
virtual Field *create_field_for_create_select(TABLE *table);
virtual Field *create_field_for_schema(THD *thd, TABLE *table);
virtual const char *full_name() const { return name ? name : "???"; }
const char *field_name_or_null()
......
......@@ -951,7 +951,7 @@ class Item_func_ifnull :public Item_func_case_abbreviation2
maybe_null= args[1]->maybe_null;
}
const char *func_name() const { return "ifnull"; }
Field *create_field_for_create_select(THD *thd, TABLE *table)
Field *create_field_for_create_select(TABLE *table)
{ return tmp_table_field_from_field_type(table, false, false); }
table_map not_null_tables() const { return 0; }
......
......@@ -173,9 +173,8 @@ class Item_func :public Item_func_or_sum
}
void signal_divide_by_null();
friend class udf_handler;
Field *create_field_for_create_select(THD *thd, TABLE *table)
Field *create_field_for_create_select(TABLE *table)
{
DBUG_ASSERT(thd == table->in_use);
return result_type() != STRING_RESULT ?
create_tmp_field(false, table, MY_INT32_NUM_DECIMAL_DIGITS) :
tmp_table_field_from_field_type(table, false, false);
......@@ -1789,7 +1788,7 @@ class Item_func_set_user_var :public Item_func_user_var
bool update();
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
Field *create_field_for_create_select(THD *thd, TABLE *table)
Field *create_field_for_create_select(TABLE *table)
{
return result_type() != STRING_RESULT ?
create_tmp_field(false, table, MY_INT32_NUM_DECIMAL_DIGITS) :
......@@ -2158,7 +2157,7 @@ class Item_func_sp :public Item_func
enum enum_field_types field_type() const;
Field *create_field_for_create_select(THD *thd, TABLE *table)
Field *create_field_for_create_select(TABLE *table)
{
return result_type() != STRING_RESULT ?
sp_result_field :
......
......@@ -40,7 +40,7 @@
#include "opt_range.h"
Field *Item_geometry_func::create_field_for_create_select(THD *thd, TABLE *t_arg)
Field *Item_geometry_func::create_field_for_create_select(TABLE *t_arg)
{
Field *result;
if ((result= new Field_geom(max_length, maybe_null, name, t_arg->s,
......
......@@ -40,7 +40,7 @@ class Item_geometry_func: public Item_str_func
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
void fix_length_and_dec();
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *create_field_for_create_select(THD *thd, TABLE *table);
Field *create_field_for_create_select(TABLE *table);
};
class Item_func_geometry_from_text: public Item_geometry_func
......
......@@ -506,7 +506,7 @@ class Item_temporal_func: public Item_func
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date) { DBUG_ASSERT(0); return 1; }
my_decimal *val_decimal(my_decimal *decimal_value)
{ return val_decimal_from_date(decimal_value); }
Field *create_field_for_create_select(THD *thd, TABLE *table)
Field *create_field_for_create_select(TABLE *table)
{ return tmp_table_field_from_field_type(table, false, false); }
int save_in_field(Field *field, bool no_conversions)
{ return save_date_in_field(field); }
......
......@@ -3934,10 +3934,10 @@ void select_insert::abort_result_set() {
CREATE TABLE (SELECT) ...
***************************************************************************/
Field *Item::create_field_for_create_select(THD *thd, TABLE *table)
Field *Item::create_field_for_create_select(TABLE *table)
{
Field *def_field, *tmp_field;
return ::create_tmp_field(thd, table, this, type(),
return ::create_tmp_field(table->in_use, table, this, type(),
(Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0);
}
......@@ -4012,7 +4012,7 @@ static TABLE *create_table_from_items(THD *thd,
while ((item=it++))
{
Field *tmp_field= item->create_field_for_create_select(thd, &tmp_table);
Field *tmp_field= item->create_field_for_create_select(&tmp_table);
if (!tmp_field)
DBUG_RETURN(NULL);
......
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