Commit f832b478 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.

Backporting (partially) from 10.2.
parent ccdd6338
...@@ -1023,7 +1023,7 @@ class Item: public Value_source, ...@@ -1023,7 +1023,7 @@ class Item: public Value_source,
virtual Field *get_tmp_table_field() { return 0; } virtual Field *get_tmp_table_field() { return 0; }
/* This is also used to create fields in CREATE ... SELECT: */ /* This is also used to create fields in CREATE ... SELECT: */
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; } virtual Field *tmp_table_field(TABLE *t_arg) { 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 Field *create_field_for_schema(THD *thd, TABLE *table);
virtual const char *full_name() const { return name ? name : "???"; } virtual const char *full_name() const { return name ? name : "???"; }
const char *field_name_or_null() const char *field_name_or_null()
......
...@@ -175,7 +175,7 @@ class Item_func :public Item_func_or_sum ...@@ -175,7 +175,7 @@ class Item_func :public Item_func_or_sum
friend class udf_handler; friend class udf_handler;
Field *tmp_table_field() { return result_field; } Field *tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg); Field *tmp_table_field(TABLE *t_arg);
Field *create_field_for_create_select(THD *thd, TABLE *table) Field *create_field_for_create_select(TABLE *table)
{ {
return result_type() != STRING_RESULT ? return result_type() != STRING_RESULT ?
tmp_table_field(table) : tmp_table_field(table) :
...@@ -1762,7 +1762,7 @@ class Item_func_set_user_var :public Item_func_user_var ...@@ -1762,7 +1762,7 @@ class Item_func_set_user_var :public Item_func_user_var
bool update(); bool update();
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec(); 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 ? return result_type() != STRING_RESULT ?
tmp_table_field(table) : tmp_table_field(table) :
......
...@@ -3924,10 +3924,10 @@ void select_insert::abort_result_set() { ...@@ -3924,10 +3924,10 @@ void select_insert::abort_result_set() {
CREATE TABLE (SELECT) ... 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; 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); (Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0);
} }
...@@ -4002,7 +4002,7 @@ static TABLE *create_table_from_items(THD *thd, ...@@ -4002,7 +4002,7 @@ static TABLE *create_table_from_items(THD *thd,
while ((item=it++)) 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) if (!tmp_field)
DBUG_RETURN(NULL); 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