Cleanup: renaming methods make_field(Send_field*) to make_send_field(..)

Renaming methods:
- Field::make_field(Send_field*) to make_send_field(..)
- Item::make_field(THD *,Send_field *) to make_send_field(..)
- Item::init_make_field(Send_field *, enum_field_type) to init_make_send_field(..)

These names looked similar to other functions that are used
for a very different purpose (creating Field instances):
- Public function "Field * make_field(..)"
- Method "Field *Column_defitinion::make_field(..)"

The rename makes it's easier to search the code using "grep".
This commit is contained in:
Alexander Barkov 2018-04-05 21:27:33 +04:00
parent d8da97b09a
commit a1a966fc0e
13 changed files with 60 additions and 59 deletions

View File

@ -1034,7 +1034,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
while ((item= it++))
{
Send_field server_field;
item->make_field(thd, &server_field);
item->make_send_field(thd, &server_field);
/* Keep things compatible for old clients */
if (server_field.type == MYSQL_TYPE_VARCHAR)

View File

@ -1941,7 +1941,7 @@ void Field_num::add_zerofill_and_unsigned(String &res) const
}
void Field::make_field(Send_field *field)
void Field::make_send_field(Send_field *field)
{
if (orig_table && orig_table->s->db.str && *orig_table->s->db.str)
{
@ -2173,9 +2173,9 @@ bool Field_str::can_be_substituted_to_equal_item(const Context &ctx,
}
void Field_num::make_field(Send_field *field)
void Field_num::make_send_field(Send_field *field)
{
Field::make_field(field);
Field::make_send_field(field);
field->decimals= dec;
}
@ -5478,9 +5478,9 @@ int Field_timestamp_hires::cmp(const uchar *a_ptr, const uchar *b_ptr)
}
void Field_timestamp_with_dec::make_field(Send_field *field)
void Field_timestamp_with_dec::make_send_field(Send_field *field)
{
Field::make_field(field);
Field::make_send_field(field);
field->decimals= dec;
}
@ -6185,9 +6185,9 @@ void Field_time_hires::sort_string(uchar *to,uint length __attribute__((unused))
to[0]^= 128;
}
void Field_time_with_dec::make_field(Send_field *field)
void Field_time_with_dec::make_send_field(Send_field *field)
{
Field::make_field(field);
Field::make_send_field(field);
field->decimals= dec;
}
@ -6837,9 +6837,9 @@ int Field_datetime_hires::cmp(const uchar *a_ptr, const uchar *b_ptr)
return a < b ? -1 : a > b ? 1 : 0;
}
void Field_datetime_with_dec::make_field(Send_field *field)
void Field_datetime_with_dec::make_send_field(Send_field *field)
{
Field::make_field(field);
Field::make_send_field(field);
field->decimals= dec;
}

View File

@ -1219,7 +1219,7 @@ public:
}
void make_sort_key(uchar *buff, uint length);
virtual void make_field(Send_field *);
virtual void make_send_field(Send_field *);
virtual void sort_string(uchar *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part) const;
virtual void free() {}
@ -1659,7 +1659,7 @@ public:
}
void add_zerofill_and_unsigned(String &res) const;
friend class Create_field;
void make_field(Send_field *);
void make_send_field(Send_field *);
uint decimals() const { return (uint) dec; }
uint size_of() const { return sizeof(*this); }
bool eq_def(const Field *field) const;
@ -2571,7 +2571,7 @@ public:
const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end,
uint param_data)
{ return Field::unpack(to, from, from_end, param_data); }
void make_field(Send_field *field);
void make_send_field(Send_field *field);
void sort_string(uchar *to, uint length)
{
DBUG_ASSERT(length == pack_length());
@ -2855,7 +2855,7 @@ public:
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
longlong val_int(void);
double val_real(void);
void make_field(Send_field *);
void make_send_field(Send_field *);
};
@ -3006,7 +3006,7 @@ public:
}
uint decimals() const { return dec; }
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
void make_field(Send_field *field);
void make_send_field(Send_field *field);
bool send_binary(Protocol *protocol);
uchar *pack(uchar *to, const uchar *from, uint max_length)
{ return Field::pack(to, from, max_length); }

View File

@ -1776,11 +1776,11 @@ bool Item_sp_variable::is_null()
return this_item()->is_null();
}
void Item_sp_variable::make_field(THD *thd, Send_field *field)
void Item_sp_variable::make_send_field(THD *thd, Send_field *field)
{
Item *it= this_item();
it->make_field(thd, field);
it->make_send_field(thd, field);
if (name.str)
field->col_name= name;
else
@ -3057,7 +3057,7 @@ Item* Item_ref::build_clone(THD *thd)
}
void Item_ident_for_show::make_field(THD *thd, Send_field *tmp_field)
void Item_ident_for_show::make_send_field(THD *thd, Send_field *tmp_field)
{
tmp_field->table_name= tmp_field->org_table_name= table_name;
tmp_field->db_name= db_name;
@ -5033,9 +5033,9 @@ Item_param::get_out_param_info() const
@param field container for meta-data to be filled
*/
void Item_param::make_field(THD *thd, Send_field *field)
void Item_param::make_send_field(THD *thd, Send_field *field)
{
Item::make_field(thd, field);
Item::make_send_field(thd, field);
if (!m_out_param_info)
return;
@ -6613,8 +6613,8 @@ Item *Item_field::replace_equal_field(THD *thd, uchar *arg)
}
void Item::init_make_field(Send_field *tmp_field,
enum enum_field_types field_type_arg)
void Item::init_make_send_field(Send_field *tmp_field,
enum enum_field_types field_type_arg)
{
tmp_field->db_name= "";
tmp_field->org_table_name= "";
@ -6631,15 +6631,15 @@ void Item::init_make_field(Send_field *tmp_field,
tmp_field->flags |= UNSIGNED_FLAG;
}
void Item::make_field(THD *thd, Send_field *tmp_field)
void Item::make_send_field(THD *thd, Send_field *tmp_field)
{
init_make_field(tmp_field, field_type());
init_make_send_field(tmp_field, field_type());
}
void Item_empty_string::make_field(THD *thd, Send_field *tmp_field)
void Item_empty_string::make_send_field(THD *thd, Send_field *tmp_field)
{
init_make_field(tmp_field, string_type_handler()->field_type());
init_make_send_field(tmp_field, string_type_handler()->field_type());
}
@ -6774,9 +6774,9 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
/* ARGSUSED */
void Item_field::make_field(THD *thd, Send_field *tmp_field)
void Item_field::make_send_field(THD *thd, Send_field *tmp_field)
{
field->make_field(tmp_field);
field->make_send_field(tmp_field);
DBUG_ASSERT(tmp_field->table_name != 0);
if (name.str)
{
@ -8510,9 +8510,9 @@ void Item_ref::save_org_in_field(Field *field, fast_field_copier optimizer_data)
}
void Item_ref::make_field(THD *thd, Send_field *field)
void Item_ref::make_send_field(THD *thd, Send_field *field)
{
(*ref)->make_field(thd, field);
(*ref)->make_send_field(thd, field);
/* Non-zero in case of a view */
if (name.str)
field->col_name= name;

View File

@ -780,9 +780,9 @@ public:
void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
void set_name_no_truncate(THD *thd, const char *str, uint length,
CHARSET_INFO *cs);
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
void init_make_send_field(Send_field *tmp_field,enum enum_field_types type);
virtual void cleanup();
virtual void make_field(THD *thd, Send_field *field);
virtual void make_send_field(THD *thd, Send_field *field);
virtual bool fix_fields(THD *, Item **);
/*
Fix after some tables has been pulled out. Basically re-calculate all
@ -2399,7 +2399,7 @@ public:
bool is_null();
public:
void make_field(THD *thd, Send_field *field);
void make_send_field(THD *thd, Send_field *field);
inline bool const_item() const;
@ -2833,7 +2833,7 @@ public:
{
return field->get_date(ltime, fuzzydate);
}
void make_field(THD *thd, Send_field *tmp_field);
void make_send_field(THD *thd, Send_field *tmp_field);
const Type_handler *type_handler() const
{
const Type_handler *handler= field->type_handler();
@ -2919,7 +2919,7 @@ public:
void reset_field(Field *f);
bool fix_fields(THD *, Item **);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
void make_field(THD *thd, Send_field *tmp_field);
void make_send_field(THD *thd, Send_field *tmp_field);
int save_in_field(Field *field,bool no_conversions);
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
fast_field_copier setup_fast_field_copier(Field *field);
@ -3580,7 +3580,7 @@ public:
Item_param *get_item_param() { return this; }
virtual void make_field(THD *thd, Send_field *field);
virtual void make_send_field(THD *thd, Send_field *field);
private:
Send_field *m_out_param_info;
@ -4130,7 +4130,7 @@ public:
name.length= strlen(name.str);
max_length= length * collation.collation->mbmaxlen;
}
void make_field(THD *thd, Send_field *field);
void make_send_field(THD *thd, Send_field *field);
};
@ -4732,7 +4732,7 @@ public:
bool val_bool_result();
bool is_null_result();
bool send(Protocol *prot, st_value *buffer);
void make_field(THD *thd, Send_field *field);
void make_send_field(THD *thd, Send_field *field);
bool fix_fields(THD *, Item **);
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
int save_in_field(Field *field, bool no_conversions);
@ -5047,8 +5047,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
virtual const char *full_name() const { return orig_item->full_name(); }
virtual void make_field(THD *thd, Send_field *field)
{ orig_item->make_field(thd, field); }
virtual void make_send_field(THD *thd, Send_field *field)
{ orig_item->make_send_field(thd, field); }
bool eq(const Item *item, bool binary_cmp) const
{
Item *it= ((Item *) item)->real_item();
@ -5490,7 +5490,8 @@ public:
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
void make_field(THD *thd, Send_field *field) { item->make_field(thd, field); }
void make_send_field(THD *thd, Send_field *field)
{ item->make_send_field(thd, field); }
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
bool is_null() { return null_value; }
@ -6324,9 +6325,9 @@ public:
bool setup(THD *thd, Item *item);
void store(Item *item);
void illegal_method_call(const char *);
void make_field(THD *thd, Send_field *)
void make_send_field(THD *thd, Send_field *)
{
illegal_method_call((const char*)"make_field");
illegal_method_call((const char*)"make_send_field");
};
double val_real()
{

View File

@ -5128,17 +5128,17 @@ bool Item_func_set_user_var::send(Protocol *protocol, st_value *buffer)
return Item::send(protocol, buffer);
}
void Item_func_set_user_var::make_field(THD *thd, Send_field *tmp_field)
void Item_func_set_user_var::make_send_field(THD *thd, Send_field *tmp_field)
{
if (result_field)
{
result_field->make_field(tmp_field);
result_field->make_send_field(tmp_field);
DBUG_ASSERT(tmp_field->table_name != 0);
if (Item::name.str)
tmp_field->col_name= Item::name; // Use user supplied name
}
else
Item::make_field(thd, tmp_field);
Item::make_send_field(thd, tmp_field);
}
@ -6380,11 +6380,11 @@ Item_func_sp::execute()
void
Item_func_sp::make_field(THD *thd, Send_field *tmp_field)
Item_func_sp::make_send_field(THD *thd, Send_field *tmp_field)
{
DBUG_ENTER("Item_func_sp::make_field");
DBUG_ENTER("Item_func_sp::make_send_field");
DBUG_ASSERT(sp_result_field);
sp_result_field->make_field(tmp_field);
sp_result_field->make_send_field(tmp_field);
if (name.str)
{
DBUG_ASSERT(name.length == strlen(name.str));

View File

@ -2414,7 +2414,7 @@ public:
bool update_hash(void *ptr, size_t length, enum Item_result type,
CHARSET_INFO *cs, bool unsigned_arg);
bool send(Protocol *protocol, st_value *buffer);
void make_field(THD *thd, Send_field *tmp_field);
void make_send_field(THD *thd, Send_field *tmp_field);
bool check(bool use_result_field);
void save_item_result(Item *item);
bool update();
@ -2840,7 +2840,7 @@ public:
sp_result_field :
tmp_table_field_from_field_type(table);
}
void make_field(THD *thd, Send_field *tmp_field);
void make_send_field(THD *thd, Send_field *tmp_field);
longlong val_int()
{

View File

@ -58,9 +58,9 @@ public:
const Type_handler *type_handler() const { return &type_handler_row; }
void illegal_method_call(const char *);
bool is_null() { return null_value; }
void make_field(THD *thd, Send_field *)
void make_send_field(THD *thd, Send_field *)
{
illegal_method_call((const char*)"make_field");
illegal_method_call((const char*)"make_send_field");
};
double val_real()
{

View File

@ -49,9 +49,9 @@ public:
virtual void set(longlong nr)=0;
const Type_handler *type_handler() const=0;
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
void make_field(THD *thd, Send_field *tmp_field)
void make_send_field(THD *thd, Send_field *tmp_field)
{
init_make_field(tmp_field,field_type());
init_make_send_field(tmp_field,field_type());
}
unsigned int size_of() { return sizeof(*this);}
bool check_vcol_func_processor(void *arg)

View File

@ -821,7 +821,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
char *pos;
CHARSET_INFO *cs= system_charset_info;
Send_field field;
item->make_field(thd, &field);
item->make_send_field(thd, &field);
/* limit number of decimals for float and double */
if (field.type == MYSQL_TYPE_FLOAT || field.type == MYSQL_TYPE_DOUBLE)

View File

@ -2332,7 +2332,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
}
Send_field *out_param_info= new (thd->mem_root) Send_field();
nctx->get_parameter(i)->make_field(thd, out_param_info);
nctx->get_parameter(i)->make_send_field(thd, out_param_info);
out_param_info->db_name= m_db.str;
out_param_info->table_name= m_name.str;
out_param_info->org_table_name= m_name.str;

View File

@ -281,7 +281,7 @@ int Materialized_cursor::send_result_set_metadata(
{
Send_field send_field;
Item_ident *ident= static_cast<Item_ident *>(item_dst);
item_org->make_field(thd, &send_field);
item_org->make_send_field(thd, &send_field);
ident->db_name= thd->strdup(send_field.db_name);
ident->table_name= thd->strdup(send_field.table_name);

View File

@ -293,7 +293,7 @@ bool Type_std_attributes::count_string_length(const char *func_name,
This method is used by:
- Item_user_var_as_out_param::field_type()
- Item_func_udf_str::field_type()
- Item_empty_string::make_field()
- Item_empty_string::make_send_field()
TODO: type_handler_adjusted_to_max_octet_length() and string_type_handler()
provide very similar functionality, to properly choose between