Skip to content

Commit

Permalink
Removing the "thd" argument from Item::create_field_for_create_select().
Browse files Browse the repository at this point in the history
"thd" is available through the "table" argument, as table->in_use.
  • Loading branch information
Alexander Barkov committed Jul 1, 2016
1 parent ffac854 commit 675d8a9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion sql/item_cmpfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
7 changes: 3 additions & 4 deletions sql/item_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) :
Expand Down Expand Up @@ -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 :
Expand Down
2 changes: 1 addition & 1 deletion sql/item_geofunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sql/item_geofunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/item_timefunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
6 changes: 3 additions & 3 deletions sql/sql_insert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 675d8a9

Please sign in to comment.