mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-8718 - Obsolete sql_strmake() in favor of THD::strmake() and thd_strmake()
This commit is contained in:
@@ -1029,7 +1029,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
|||||||
while ((item= it++))
|
while ((item= it++))
|
||||||
{
|
{
|
||||||
Send_field server_field;
|
Send_field server_field;
|
||||||
item->make_field(&server_field);
|
item->make_field(thd, &server_field);
|
||||||
|
|
||||||
/* Keep things compatible for old clients */
|
/* Keep things compatible for old clients */
|
||||||
if (server_field.type == MYSQL_TYPE_VARCHAR)
|
if (server_field.type == MYSQL_TYPE_VARCHAR)
|
||||||
|
@@ -10531,7 +10531,7 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
|
|||||||
{
|
{
|
||||||
StringBuffer<MAX_FIELD_WIDTH> tmp(charset);
|
StringBuffer<MAX_FIELD_WIDTH> tmp(charset);
|
||||||
String *res= orig_field->val_str(&tmp, orig_field->ptr_in_record(dv));
|
String *res= orig_field->val_str(&tmp, orig_field->ptr_in_record(dv));
|
||||||
char *pos= (char*) sql_strmake(res->ptr(), res->length());
|
char *pos= (char*) thd->strmake(res->ptr(), res->length());
|
||||||
def= new (thd->mem_root) Item_string(thd, pos, res->length(), charset);
|
def= new (thd->mem_root) Item_string(thd, pos, res->length(), charset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
sql/item.cc
33
sql/item.cc
@@ -970,7 +970,7 @@ bool Item::check_cols(uint c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
|
void Item::set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
if (!length)
|
if (!length)
|
||||||
{
|
{
|
||||||
@@ -1001,7 +1001,6 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
|
|||||||
if (str != str_start && !is_autogenerated_name)
|
if (str != str_start && !is_autogenerated_name)
|
||||||
{
|
{
|
||||||
char buff[SAFE_NAME_LEN];
|
char buff[SAFE_NAME_LEN];
|
||||||
THD *thd= current_thd;
|
|
||||||
|
|
||||||
strmake(buff, str_start,
|
strmake(buff, str_start,
|
||||||
MY_MIN(sizeof(buff)-1, length + (int) (str-str_start)));
|
MY_MIN(sizeof(buff)-1, length + (int) (str-str_start)));
|
||||||
@@ -1025,11 +1024,12 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
|
|||||||
name_length= res_length;
|
name_length= res_length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
name= sql_strmake(str, (name_length= MY_MIN(length,MAX_ALIAS_NAME)));
|
name= thd->strmake(str, (name_length= MY_MIN(length,MAX_ALIAS_NAME)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item::set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs)
|
void Item::set_name_no_truncate(THD *thd, const char *str, uint length,
|
||||||
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
if (!my_charset_same(cs, system_charset_info))
|
if (!my_charset_same(cs, system_charset_info))
|
||||||
{
|
{
|
||||||
@@ -1040,7 +1040,7 @@ void Item::set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs)
|
|||||||
name_length= res_length;
|
name_length= res_length;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
name= sql_strmake(str, (name_length= length));
|
name= thd->strmake(str, (name_length= length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1049,7 +1049,7 @@ void Item::set_name_for_rollback(THD *thd, const char *str, uint length,
|
|||||||
{
|
{
|
||||||
char *old_name, *new_name;
|
char *old_name, *new_name;
|
||||||
old_name= name;
|
old_name= name;
|
||||||
set_name(str, length, cs);
|
set_name(thd, str, length, cs);
|
||||||
new_name= name;
|
new_name= name;
|
||||||
if (old_name != new_name)
|
if (old_name != new_name)
|
||||||
{
|
{
|
||||||
@@ -1703,7 +1703,8 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
|
|||||||
}
|
}
|
||||||
if (is_autogenerated_name)
|
if (is_autogenerated_name)
|
||||||
{
|
{
|
||||||
set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
|
set_name(thd, item_name->ptr(), (uint) item_name->length(),
|
||||||
|
system_charset_info);
|
||||||
}
|
}
|
||||||
collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
|
collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
|
||||||
max_length= value_item->max_length;
|
max_length= value_item->max_length;
|
||||||
@@ -2168,7 +2169,7 @@ bool Item_func_or_sum::agg_item_set_converter(const DTCollation &coll,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_ident_for_show::make_field(Send_field *tmp_field)
|
void Item_ident_for_show::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
tmp_field->table_name= tmp_field->org_table_name= table_name;
|
tmp_field->table_name= tmp_field->org_table_name= table_name;
|
||||||
tmp_field->db_name= db_name;
|
tmp_field->db_name= db_name;
|
||||||
@@ -3846,9 +3847,9 @@ Item_param::get_out_param_info() const
|
|||||||
@param field container for meta-data to be filled
|
@param field container for meta-data to be filled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Item_param::make_field(Send_field *field)
|
void Item_param::make_field(THD *thd, Send_field *field)
|
||||||
{
|
{
|
||||||
Item::make_field(field);
|
Item::make_field(thd, field);
|
||||||
|
|
||||||
if (!m_out_param_info)
|
if (!m_out_param_info)
|
||||||
return;
|
return;
|
||||||
@@ -5379,13 +5380,13 @@ void Item::init_make_field(Send_field *tmp_field,
|
|||||||
tmp_field->flags |= UNSIGNED_FLAG;
|
tmp_field->flags |= UNSIGNED_FLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::make_field(Send_field *tmp_field)
|
void Item::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
init_make_field(tmp_field, field_type());
|
init_make_field(tmp_field, field_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_empty_string::make_field(Send_field *tmp_field)
|
void Item_empty_string::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
init_make_field(tmp_field, string_field_type());
|
init_make_field(tmp_field, string_field_type());
|
||||||
}
|
}
|
||||||
@@ -5705,7 +5706,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table,
|
|||||||
|
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void Item_field::make_field(Send_field *tmp_field)
|
void Item_field::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
field->make_field(tmp_field);
|
field->make_field(tmp_field);
|
||||||
DBUG_ASSERT(tmp_field->table_name != 0);
|
DBUG_ASSERT(tmp_field->table_name != 0);
|
||||||
@@ -7319,9 +7320,9 @@ void Item_ref::save_org_in_field(Field *field, fast_field_copier optimizer_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Item_ref::make_field(Send_field *field)
|
void Item_ref::make_field(THD *thd, Send_field *field)
|
||||||
{
|
{
|
||||||
(*ref)->make_field(field);
|
(*ref)->make_field(thd, field);
|
||||||
/* Non-zero in case of a view */
|
/* Non-zero in case of a view */
|
||||||
if (name)
|
if (name)
|
||||||
field->col_name= name;
|
field->col_name= name;
|
||||||
@@ -8507,7 +8508,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint length= result->length();
|
uint length= result->length();
|
||||||
char *tmp_str= sql_strmake(result->ptr(), length);
|
char *tmp_str= thd->strmake(result->ptr(), length);
|
||||||
new_item= new (mem_root) Item_string(thd, name, tmp_str, length, result->charset());
|
new_item= new (mem_root) Item_string(thd, name, tmp_str, length, result->charset());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
53
sql/item.h
53
sql/item.h
@@ -714,14 +714,15 @@ public:
|
|||||||
name=0;
|
name=0;
|
||||||
#endif
|
#endif
|
||||||
} /*lint -e1509 */
|
} /*lint -e1509 */
|
||||||
void set_name(const char *str, uint length, CHARSET_INFO *cs);
|
void set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs);
|
||||||
void set_name_no_truncate(const char *str, uint length, CHARSET_INFO *cs);
|
void set_name_no_truncate(THD *thd, const char *str, uint length,
|
||||||
|
CHARSET_INFO *cs);
|
||||||
void set_name_for_rollback(THD *thd, const char *str, uint length,
|
void set_name_for_rollback(THD *thd, const char *str, uint length,
|
||||||
CHARSET_INFO *cs);
|
CHARSET_INFO *cs);
|
||||||
void rename(char *new_name);
|
void rename(char *new_name);
|
||||||
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
|
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
|
||||||
virtual void cleanup();
|
virtual void cleanup();
|
||||||
virtual void make_field(Send_field *field);
|
virtual void make_field(THD *thd, Send_field *field);
|
||||||
virtual Field *make_string_field(TABLE *table);
|
virtual Field *make_string_field(TABLE *table);
|
||||||
virtual bool fix_fields(THD *, Item **);
|
virtual bool fix_fields(THD *, Item **);
|
||||||
/*
|
/*
|
||||||
@@ -1982,7 +1983,7 @@ public:
|
|||||||
bool is_null();
|
bool is_null();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline void make_field(Send_field *field);
|
inline void make_field(THD *thd, Send_field *field);
|
||||||
|
|
||||||
inline bool const_item() const;
|
inline bool const_item() const;
|
||||||
|
|
||||||
@@ -1994,15 +1995,15 @@ public:
|
|||||||
Item_sp_variable inline implementation.
|
Item_sp_variable inline implementation.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
inline void Item_sp_variable::make_field(Send_field *field)
|
inline void Item_sp_variable::make_field(THD *thd, Send_field *field)
|
||||||
{
|
{
|
||||||
Item *it= this_item();
|
Item *it= this_item();
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
it->set_name(name, (uint) strlen(name), system_charset_info);
|
it->set_name(thd, name, (uint) strlen(name), system_charset_info);
|
||||||
else
|
else
|
||||||
it->set_name(m_name.str, (uint) m_name.length, system_charset_info);
|
it->set_name(thd, m_name.str, (uint) m_name.length, system_charset_info);
|
||||||
it->make_field(field);
|
it->make_field(thd, field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Item_sp_variable::const_item() const
|
inline bool Item_sp_variable::const_item() const
|
||||||
@@ -2325,7 +2326,7 @@ public:
|
|||||||
longlong val_int() { return field->val_int(); }
|
longlong val_int() { return field->val_int(); }
|
||||||
String *val_str(String *str) { return field->val_str(str); }
|
String *val_str(String *str) { return field->val_str(str); }
|
||||||
my_decimal *val_decimal(my_decimal *dec) { return field->val_decimal(dec); }
|
my_decimal *val_decimal(my_decimal *dec) { return field->val_decimal(dec); }
|
||||||
void make_field(Send_field *tmp_field);
|
void make_field(THD *thd, Send_field *tmp_field);
|
||||||
CHARSET_INFO *charset_for_protocol(void) const
|
CHARSET_INFO *charset_for_protocol(void) const
|
||||||
{ return field->charset_for_protocol(); }
|
{ return field->charset_for_protocol(); }
|
||||||
};
|
};
|
||||||
@@ -2381,7 +2382,7 @@ public:
|
|||||||
void reset_field(Field *f);
|
void reset_field(Field *f);
|
||||||
bool fix_fields(THD *, Item **);
|
bool fix_fields(THD *, Item **);
|
||||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
||||||
void make_field(Send_field *tmp_field);
|
void make_field(THD *thd, Send_field *tmp_field);
|
||||||
int save_in_field(Field *field,bool no_conversions);
|
int save_in_field(Field *field,bool no_conversions);
|
||||||
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
|
void save_org_in_field(Field *field, fast_field_copier optimizer_data);
|
||||||
fast_field_copier setup_fast_field_copier(Field *field);
|
fast_field_copier setup_fast_field_copier(Field *field);
|
||||||
@@ -2733,7 +2734,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
virtual const Send_field *get_out_param_info() const;
|
virtual const Send_field *get_out_param_info() const;
|
||||||
|
|
||||||
virtual void make_field(Send_field *field);
|
virtual void make_field(THD *thd, Send_field *field);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Send_field *m_out_param_info;
|
Send_field *m_out_param_info;
|
||||||
@@ -2925,10 +2926,11 @@ protected:
|
|||||||
// it is constant => can be used without fix_fields (and frequently used)
|
// it is constant => can be used without fix_fields (and frequently used)
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
}
|
}
|
||||||
void fix_and_set_name_from_value(Derivation dv, const Metadata metadata)
|
void fix_and_set_name_from_value(THD *thd, Derivation dv,
|
||||||
|
const Metadata metadata)
|
||||||
{
|
{
|
||||||
fix_from_value(dv, metadata);
|
fix_from_value(dv, metadata);
|
||||||
set_name(str_value.ptr(), str_value.length(), str_value.charset());
|
set_name(thd, str_value.ptr(), str_value.length(), str_value.charset());
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
/* Just create an item and do not fill string representation */
|
/* Just create an item and do not fill string representation */
|
||||||
@@ -2937,7 +2939,7 @@ protected:
|
|||||||
{
|
{
|
||||||
collation.set(cs, dv);
|
collation.set(cs, dv);
|
||||||
max_length= 0;
|
max_length= 0;
|
||||||
set_name(NULL, 0, system_charset_info);
|
set_name(thd, NULL, 0, system_charset_info);
|
||||||
decimals= NOT_FIXED_DEC;
|
decimals= NOT_FIXED_DEC;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
}
|
}
|
||||||
@@ -2946,7 +2948,7 @@ public:
|
|||||||
Item_basic_constant(thd)
|
Item_basic_constant(thd)
|
||||||
{
|
{
|
||||||
collation.set(csi, DERIVATION_COERCIBLE);
|
collation.set(csi, DERIVATION_COERCIBLE);
|
||||||
set_name(NULL, 0, system_charset_info);
|
set_name(thd, NULL, 0, system_charset_info);
|
||||||
decimals= NOT_FIXED_DEC;
|
decimals= NOT_FIXED_DEC;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
str_value.copy(str_arg, length_arg, csi);
|
str_value.copy(str_arg, length_arg, csi);
|
||||||
@@ -2957,14 +2959,14 @@ public:
|
|||||||
Derivation dv, uint repertoire): Item_basic_constant(thd)
|
Derivation dv, uint repertoire): Item_basic_constant(thd)
|
||||||
{
|
{
|
||||||
str_value.set_or_copy_aligned(str, length, cs);
|
str_value.set_or_copy_aligned(str, length, cs);
|
||||||
fix_and_set_name_from_value(dv, Metadata(&str_value, repertoire));
|
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
|
||||||
}
|
}
|
||||||
Item_string(THD *thd, const char *str, uint length,
|
Item_string(THD *thd, const char *str, uint length,
|
||||||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
|
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
|
||||||
Item_basic_constant(thd)
|
Item_basic_constant(thd)
|
||||||
{
|
{
|
||||||
str_value.set_or_copy_aligned(str, length, cs);
|
str_value.set_or_copy_aligned(str, length, cs);
|
||||||
fix_and_set_name_from_value(dv, Metadata(&str_value));
|
fix_and_set_name_from_value(thd, dv, Metadata(&str_value));
|
||||||
}
|
}
|
||||||
Item_string(THD *thd, const String *str, CHARSET_INFO *tocs, uint *conv_errors,
|
Item_string(THD *thd, const String *str, CHARSET_INFO *tocs, uint *conv_errors,
|
||||||
Derivation dv, uint repertoire): Item_basic_constant(thd)
|
Derivation dv, uint repertoire): Item_basic_constant(thd)
|
||||||
@@ -2972,7 +2974,7 @@ public:
|
|||||||
if (str_value.copy(str, tocs, conv_errors))
|
if (str_value.copy(str, tocs, conv_errors))
|
||||||
str_value.set("", 0, tocs); // EOM ?
|
str_value.set("", 0, tocs); // EOM ?
|
||||||
str_value.mark_as_const();
|
str_value.mark_as_const();
|
||||||
fix_and_set_name_from_value(dv, Metadata(&str_value, repertoire));
|
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
|
||||||
}
|
}
|
||||||
// Constructors with an externally provided item name
|
// Constructors with an externally provided item name
|
||||||
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
||||||
@@ -2981,7 +2983,7 @@ public:
|
|||||||
{
|
{
|
||||||
str_value.set_or_copy_aligned(str, length, cs);
|
str_value.set_or_copy_aligned(str, length, cs);
|
||||||
fix_from_value(dv, Metadata(&str_value));
|
fix_from_value(dv, Metadata(&str_value));
|
||||||
set_name(name_par, 0, system_charset_info);
|
set_name(thd, name_par, 0, system_charset_info);
|
||||||
}
|
}
|
||||||
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
||||||
CHARSET_INFO *cs, Derivation dv, uint repertoire):
|
CHARSET_INFO *cs, Derivation dv, uint repertoire):
|
||||||
@@ -2989,7 +2991,7 @@ public:
|
|||||||
{
|
{
|
||||||
str_value.set_or_copy_aligned(str, length, cs);
|
str_value.set_or_copy_aligned(str, length, cs);
|
||||||
fix_from_value(dv, Metadata(&str_value, repertoire));
|
fix_from_value(dv, Metadata(&str_value, repertoire));
|
||||||
set_name(name_par, 0, system_charset_info);
|
set_name(thd, name_par, 0, system_charset_info);
|
||||||
}
|
}
|
||||||
void print_value(String *to) const
|
void print_value(String *to) const
|
||||||
{
|
{
|
||||||
@@ -3218,7 +3220,7 @@ public:
|
|||||||
Item_partition_func_safe_string(thd, "", 0,
|
Item_partition_func_safe_string(thd, "", 0,
|
||||||
cs ? cs : &my_charset_utf8_general_ci)
|
cs ? cs : &my_charset_utf8_general_ci)
|
||||||
{ name=(char*) header; max_length= length * collation.collation->mbmaxlen; }
|
{ name=(char*) header; max_length= length * collation.collation->mbmaxlen; }
|
||||||
void make_field(Send_field *field);
|
void make_field(THD *thd, Send_field *field);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -3890,7 +3892,7 @@ public:
|
|||||||
bool val_bool_result();
|
bool val_bool_result();
|
||||||
bool is_null_result();
|
bool is_null_result();
|
||||||
bool send(Protocol *prot, String *tmp);
|
bool send(Protocol *prot, String *tmp);
|
||||||
void make_field(Send_field *field);
|
void make_field(THD *thd, Send_field *field);
|
||||||
bool fix_fields(THD *, Item **);
|
bool fix_fields(THD *, Item **);
|
||||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
|
||||||
int save_in_field(Field *field, bool no_conversions);
|
int save_in_field(Field *field, bool no_conversions);
|
||||||
@@ -4155,7 +4157,8 @@ public:
|
|||||||
|
|
||||||
virtual void print(String *str, enum_query_type query_type);
|
virtual void print(String *str, enum_query_type query_type);
|
||||||
virtual const char *full_name() const { return orig_item->full_name(); }
|
virtual const char *full_name() const { return orig_item->full_name(); }
|
||||||
virtual void make_field(Send_field *field) { orig_item->make_field(field); }
|
virtual void make_field(THD *thd, Send_field *field)
|
||||||
|
{ orig_item->make_field(thd, field); }
|
||||||
bool eq(const Item *item, bool binary_cmp) const
|
bool eq(const Item *item, bool binary_cmp) const
|
||||||
{
|
{
|
||||||
Item *it= ((Item *) item)->real_item();
|
Item *it= ((Item *) item)->real_item();
|
||||||
@@ -4586,7 +4589,7 @@ public:
|
|||||||
enum_field_types field_type() const { return cached_field_type; }
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
enum Item_result result_type () const { return cached_result_type; }
|
enum Item_result result_type () const { return cached_result_type; }
|
||||||
|
|
||||||
void make_field(Send_field *field) { item->make_field(field); }
|
void make_field(THD *thd, Send_field *field) { item->make_field(thd, field); }
|
||||||
table_map used_tables() const { return (table_map) 1L; }
|
table_map used_tables() const { return (table_map) 1L; }
|
||||||
bool const_item() const { return 0; }
|
bool const_item() const { return 0; }
|
||||||
bool is_null() { return null_value; }
|
bool is_null() { return null_value; }
|
||||||
@@ -5196,7 +5199,7 @@ public:
|
|||||||
bool setup(THD *thd, Item *item);
|
bool setup(THD *thd, Item *item);
|
||||||
void store(Item *item);
|
void store(Item *item);
|
||||||
void illegal_method_call(const char *);
|
void illegal_method_call(const char *);
|
||||||
void make_field(Send_field *)
|
void make_field(THD *thd, Send_field *)
|
||||||
{
|
{
|
||||||
illegal_method_call((const char*)"make_field");
|
illegal_method_call((const char*)"make_field");
|
||||||
};
|
};
|
||||||
|
@@ -5345,7 +5345,7 @@ bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg)
|
|||||||
return Item::send(protocol, str_arg);
|
return Item::send(protocol, str_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_func_set_user_var::make_field(Send_field *tmp_field)
|
void Item_func_set_user_var::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
if (result_field)
|
if (result_field)
|
||||||
{
|
{
|
||||||
@@ -5355,7 +5355,7 @@ void Item_func_set_user_var::make_field(Send_field *tmp_field)
|
|||||||
tmp_field->col_name=Item::name; // Use user supplied name
|
tmp_field->col_name=Item::name; // Use user supplied name
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Item::make_field(tmp_field);
|
Item::make_field(thd, tmp_field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5811,7 +5811,7 @@ Item_func_get_system_var(THD *thd, sys_var *var_arg, enum_var_type var_type_arg,
|
|||||||
orig_var_type(var_type_arg), component(*component_arg), cache_present(0)
|
orig_var_type(var_type_arg), component(*component_arg), cache_present(0)
|
||||||
{
|
{
|
||||||
/* set_name() will allocate the name */
|
/* set_name() will allocate the name */
|
||||||
set_name(name_arg, (uint) name_len_arg, system_charset_info);
|
set_name(thd, name_arg, (uint) name_len_arg, system_charset_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6768,7 +6768,7 @@ error:
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Item_func_sp::make_field(Send_field *tmp_field)
|
Item_func_sp::make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Item_func_sp::make_field");
|
DBUG_ENTER("Item_func_sp::make_field");
|
||||||
DBUG_ASSERT(sp_result_field);
|
DBUG_ASSERT(sp_result_field);
|
||||||
|
@@ -1753,7 +1753,7 @@ public:
|
|||||||
bool update_hash(void *ptr, uint length, enum Item_result type,
|
bool update_hash(void *ptr, uint length, enum Item_result type,
|
||||||
CHARSET_INFO *cs, bool unsigned_arg);
|
CHARSET_INFO *cs, bool unsigned_arg);
|
||||||
bool send(Protocol *protocol, String *str_arg);
|
bool send(Protocol *protocol, String *str_arg);
|
||||||
void make_field(Send_field *tmp_field);
|
void make_field(THD *thd, Send_field *tmp_field);
|
||||||
bool check(bool use_result_field);
|
bool check(bool use_result_field);
|
||||||
void save_item_result(Item *item);
|
void save_item_result(Item *item);
|
||||||
bool update();
|
bool update();
|
||||||
@@ -1839,7 +1839,7 @@ class Item_user_var_as_out_param :public Item
|
|||||||
user_var_entry *entry;
|
user_var_entry *entry;
|
||||||
public:
|
public:
|
||||||
Item_user_var_as_out_param(THD *thd, LEX_STRING a): Item(thd), name(a)
|
Item_user_var_as_out_param(THD *thd, LEX_STRING a): Item(thd), name(a)
|
||||||
{ set_name(a.str, 0, system_charset_info); }
|
{ set_name(thd, a.str, 0, system_charset_info); }
|
||||||
/* We should return something different from FIELD_ITEM here */
|
/* We should return something different from FIELD_ITEM here */
|
||||||
enum Type type() const { return STRING_ITEM;}
|
enum Type type() const { return STRING_ITEM;}
|
||||||
double val_real();
|
double val_real();
|
||||||
@@ -2132,7 +2132,7 @@ public:
|
|||||||
|
|
||||||
Field *tmp_table_field(TABLE *t_arg);
|
Field *tmp_table_field(TABLE *t_arg);
|
||||||
|
|
||||||
void make_field(Send_field *tmp_field);
|
void make_field(THD *thd, Send_field *tmp_field);
|
||||||
|
|
||||||
Item_result result_type() const;
|
Item_result result_type() const;
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ public:
|
|||||||
enum Type type() const { return ROW_ITEM; };
|
enum Type type() const { return ROW_ITEM; };
|
||||||
void illegal_method_call(const char *);
|
void illegal_method_call(const char *);
|
||||||
bool is_null() { return null_value; }
|
bool is_null() { return null_value; }
|
||||||
void make_field(Send_field *)
|
void make_field(THD *thd, Send_field *)
|
||||||
{
|
{
|
||||||
illegal_method_call((const char*)"make_field");
|
illegal_method_call((const char*)"make_field");
|
||||||
};
|
};
|
||||||
|
@@ -4312,7 +4312,7 @@ void Item_func_dyncol_create::fix_length_and_dec()
|
|||||||
decimals= 0;
|
decimals= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
|
bool Item_func_dyncol_create::prepare_arguments(THD *thd, bool force_names_arg)
|
||||||
{
|
{
|
||||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||||
String *res, tmp(buff, sizeof(buff), &my_charset_bin);
|
String *res, tmp(buff, sizeof(buff), &my_charset_bin);
|
||||||
@@ -4432,7 +4432,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
|
|||||||
if (my_charset_same(res->charset(), &my_charset_utf8_general_ci))
|
if (my_charset_same(res->charset(), &my_charset_utf8_general_ci))
|
||||||
{
|
{
|
||||||
keys_str[i].length= res->length();
|
keys_str[i].length= res->length();
|
||||||
keys_str[i].str= sql_strmake(res->ptr(), res->length());
|
keys_str[i].str= thd->strmake(res->ptr(), res->length());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4487,7 +4487,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
|
|||||||
case DYN_COL_STRING:
|
case DYN_COL_STRING:
|
||||||
res= args[valpos]->val_str(&tmp);
|
res= args[valpos]->val_str(&tmp);
|
||||||
if (res &&
|
if (res &&
|
||||||
(vals[i].x.string.value.str= sql_strmake(res->ptr(), res->length())))
|
(vals[i].x.string.value.str= thd->strmake(res->ptr(), res->length())))
|
||||||
{
|
{
|
||||||
vals[i].x.string.value.length= res->length();
|
vals[i].x.string.value.length= res->length();
|
||||||
vals[i].x.string.charset= res->charset();
|
vals[i].x.string.charset= res->charset();
|
||||||
@@ -4519,7 +4519,7 @@ bool Item_func_dyncol_create::prepare_arguments(bool force_names_arg)
|
|||||||
case DYN_COL_DATETIME:
|
case DYN_COL_DATETIME:
|
||||||
case DYN_COL_DATE:
|
case DYN_COL_DATE:
|
||||||
args[valpos]->get_date(&vals[i].x.time_value,
|
args[valpos]->get_date(&vals[i].x.time_value,
|
||||||
sql_mode_for_dates(current_thd));
|
sql_mode_for_dates(thd));
|
||||||
break;
|
break;
|
||||||
case DYN_COL_TIME:
|
case DYN_COL_TIME:
|
||||||
args[valpos]->get_time(&vals[i].x.time_value);
|
args[valpos]->get_time(&vals[i].x.time_value);
|
||||||
@@ -4545,7 +4545,8 @@ String *Item_func_dyncol_create::val_str(String *str)
|
|||||||
enum enum_dyncol_func_result rc;
|
enum enum_dyncol_func_result rc;
|
||||||
DBUG_ASSERT((arg_count & 0x1) == 0); // even number of arguments
|
DBUG_ASSERT((arg_count & 0x1) == 0); // even number of arguments
|
||||||
|
|
||||||
if (prepare_arguments(FALSE))
|
/* FIXME: add thd argument to Item::val_str() */
|
||||||
|
if (prepare_arguments(current_thd, FALSE))
|
||||||
{
|
{
|
||||||
res= NULL;
|
res= NULL;
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
@@ -4690,7 +4691,8 @@ String *Item_func_dyncol_add::val_str(String *str)
|
|||||||
col.length= res->length();
|
col.length= res->length();
|
||||||
memcpy(col.str, res->ptr(), col.length);
|
memcpy(col.str, res->ptr(), col.length);
|
||||||
|
|
||||||
if (prepare_arguments(mariadb_dyncol_has_names(&col)))
|
/* FIXME: add thd argument to Item::val_str() */
|
||||||
|
if (prepare_arguments(current_thd, mariadb_dyncol_has_names(&col)))
|
||||||
goto null;
|
goto null;
|
||||||
|
|
||||||
if ((rc= ((names || force_names) ?
|
if ((rc= ((names || force_names) ?
|
||||||
|
@@ -1195,7 +1195,7 @@ protected:
|
|||||||
uint *keys_num;
|
uint *keys_num;
|
||||||
LEX_STRING *keys_str;
|
LEX_STRING *keys_str;
|
||||||
bool names, force_names;
|
bool names, force_names;
|
||||||
bool prepare_arguments(bool force_names);
|
bool prepare_arguments(THD *thd, bool force_names);
|
||||||
void print_arguments(String *str, enum_query_type query_type);
|
void print_arguments(String *str, enum_query_type query_type);
|
||||||
public:
|
public:
|
||||||
Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
|
Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual void set(longlong nr)=0;
|
virtual void set(longlong nr)=0;
|
||||||
virtual enum_field_types field_type() const=0;
|
virtual enum_field_types field_type() const=0;
|
||||||
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
|
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
|
||||||
void make_field(Send_field *tmp_field)
|
void make_field(THD *thd, Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
init_make_field(tmp_field,field_type());
|
init_make_field(tmp_field,field_type());
|
||||||
}
|
}
|
||||||
|
@@ -754,7 +754,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
|||||||
char *pos;
|
char *pos;
|
||||||
CHARSET_INFO *cs= system_charset_info;
|
CHARSET_INFO *cs= system_charset_info;
|
||||||
Send_field field;
|
Send_field field;
|
||||||
item->make_field(&field);
|
item->make_field(thd, &field);
|
||||||
|
|
||||||
/* Keep things compatible for old clients */
|
/* Keep things compatible for old clients */
|
||||||
if (field.type == MYSQL_TYPE_VARCHAR)
|
if (field.type == MYSQL_TYPE_VARCHAR)
|
||||||
|
@@ -2148,7 +2148,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Send_field *out_param_info= new (thd->mem_root) Send_field();
|
Send_field *out_param_info= new (thd->mem_root) Send_field();
|
||||||
nctx->get_item(i)->make_field(out_param_info);
|
nctx->get_item(i)->make_field(thd, out_param_info);
|
||||||
out_param_info->db_name= m_db.str;
|
out_param_info->db_name= m_db.str;
|
||||||
out_param_info->table_name= m_name.str;
|
out_param_info->table_name= m_name.str;
|
||||||
out_param_info->org_table_name= m_name.str;
|
out_param_info->org_table_name= m_name.str;
|
||||||
|
@@ -6137,9 +6137,9 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item->set_name((*ref)->name, (*ref)->name_length,
|
item->set_name(thd, (*ref)->name, (*ref)->name_length,
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
item->real_item()->set_name((*ref)->name, (*ref)->name_length,
|
item->real_item()->set_name(thd, (*ref)->name, (*ref)->name_length,
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6233,9 +6233,9 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
|
|||||||
*/
|
*/
|
||||||
if (*ref && !(*ref)->is_autogenerated_name)
|
if (*ref && !(*ref)->is_autogenerated_name)
|
||||||
{
|
{
|
||||||
item->set_name((*ref)->name, (*ref)->name_length,
|
item->set_name(thd, (*ref)->name, (*ref)->name_length,
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
item->real_item()->set_name((*ref)->name, (*ref)->name_length,
|
item->real_item()->set_name(thd, (*ref)->name, (*ref)->name_length,
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
}
|
}
|
||||||
if (register_tree_change && arena)
|
if (register_tree_change && arena)
|
||||||
|
@@ -277,7 +277,7 @@ int Materialized_cursor::send_result_set_metadata(
|
|||||||
{
|
{
|
||||||
Send_field send_field;
|
Send_field send_field;
|
||||||
Item_ident *ident= static_cast<Item_ident *>(item_dst);
|
Item_ident *ident= static_cast<Item_ident *>(item_dst);
|
||||||
item_org->make_field(&send_field);
|
item_org->make_field(thd, &send_field);
|
||||||
|
|
||||||
ident->db_name= thd->strdup(send_field.db_name);
|
ident->db_name= thd->strdup(send_field.db_name);
|
||||||
ident->table_name= thd->strdup(send_field.table_name);
|
ident->table_name= thd->strdup(send_field.table_name);
|
||||||
|
@@ -671,7 +671,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
|
|||||||
if ((res= unit->prepare(thd, derived->derived_result, 0)))
|
if ((res= unit->prepare(thd, derived->derived_result, 0)))
|
||||||
goto exit;
|
goto exit;
|
||||||
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED;
|
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_DERIVED;
|
||||||
if ((res= check_duplicate_names(unit->types, 0)))
|
if ((res= check_duplicate_names(thd, unit->types, 0)))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -7083,7 +7083,7 @@ void create_select_for_variable(const char *var_name)
|
|||||||
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_str)))
|
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_str)))
|
||||||
{
|
{
|
||||||
end= strxmov(buff, "@@session.", var_name, NullS);
|
end= strxmov(buff, "@@session.", var_name, NullS);
|
||||||
var->set_name(buff, end-buff, system_charset_info);
|
var->set_name(thd, buff, end-buff, system_charset_info);
|
||||||
add_item_to_list(thd, var);
|
add_item_to_list(thd, var);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
@@ -124,7 +124,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
NullS, NullS, field_info->field_name);
|
NullS, NullS, field_info->field_name);
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
field->set_name(field_info->old_name,
|
field->set_name(thd, field_info->old_name,
|
||||||
(uint) strlen(field_info->old_name),
|
(uint) strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
|
@@ -22857,7 +22857,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
|||||||
str.length(0);
|
str.length(0);
|
||||||
str.extra_allocation(1024);
|
str.extra_allocation(1024);
|
||||||
item->print(&str, QT_ORDINARY);
|
item->print(&str, QT_ORDINARY);
|
||||||
item_field->name= sql_strmake(str.ptr(),str.length());
|
item_field->name= thd->strmake(str.ptr(),str.length());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -7447,7 +7447,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
|||||||
item->max_length+= 1;
|
item->max_length+= 1;
|
||||||
if (item->decimals > 0)
|
if (item->decimals > 0)
|
||||||
item->max_length+= 1;
|
item->max_length+= 1;
|
||||||
item->set_name(fields_info->field_name,
|
item->set_name(thd, fields_info->field_name,
|
||||||
strlen(fields_info->field_name), cs);
|
strlen(fields_info->field_name), cs);
|
||||||
break;
|
break;
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
@@ -7470,7 +7470,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
|||||||
{
|
{
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
item->set_name(fields_info->field_name,
|
item->set_name(thd, fields_info->field_name,
|
||||||
strlen(fields_info->field_name), cs);
|
strlen(fields_info->field_name), cs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -7529,7 +7529,7 @@ static int make_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
Item_field(thd, context, NullS, NullS, field_info->field_name);
|
Item_field(thd, context, NullS, NullS, field_info->field_name);
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
field->set_name(field_info->old_name,
|
field->set_name(thd, field_info->old_name,
|
||||||
strlen(field_info->old_name),
|
strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
@@ -7564,7 +7564,7 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
buffer.append(lex->wild->ptr());
|
buffer.append(lex->wild->ptr());
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
}
|
}
|
||||||
field->set_name(buffer.ptr(), buffer.length(), system_charset_info);
|
field->set_name(thd, buffer.ptr(), buffer.length(), system_charset_info);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -7591,15 +7591,15 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
NullS, NullS, field_info->field_name);
|
NullS, NullS, field_info->field_name);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
return 1;
|
return 1;
|
||||||
field->set_name(buffer.ptr(), buffer.length(), system_charset_info);
|
field->set_name(thd, buffer.ptr(), buffer.length(), system_charset_info);
|
||||||
if (thd->lex->verbose)
|
if (thd->lex->verbose)
|
||||||
{
|
{
|
||||||
field->set_name(buffer.ptr(), buffer.length(), system_charset_info);
|
field->set_name(thd, buffer.ptr(), buffer.length(), system_charset_info);
|
||||||
field_info= &schema_table->fields_info[3];
|
field_info= &schema_table->fields_info[3];
|
||||||
field= new (thd->mem_root) Item_field(thd, context, NullS, NullS, field_info->field_name);
|
field= new (thd->mem_root) Item_field(thd, context, NullS, NullS, field_info->field_name);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
return 1;
|
return 1;
|
||||||
field->set_name(field_info->old_name, strlen(field_info->old_name),
|
field->set_name(thd, field_info->old_name, strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -7624,7 +7624,7 @@ int make_columns_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
NullS, NullS, field_info->field_name);
|
NullS, NullS, field_info->field_name);
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
field->set_name(field_info->old_name,
|
field->set_name(thd, field_info->old_name,
|
||||||
strlen(field_info->old_name),
|
strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
@@ -7649,7 +7649,7 @@ int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
NullS, NullS, field_info->field_name);
|
NullS, NullS, field_info->field_name);
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
field->set_name(field_info->old_name,
|
field->set_name(thd, field_info->old_name,
|
||||||
strlen(field_info->old_name),
|
strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
@@ -7674,7 +7674,7 @@ int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
NullS, NullS, field_info->field_name);
|
NullS, NullS, field_info->field_name);
|
||||||
if (field)
|
if (field)
|
||||||
{
|
{
|
||||||
field->set_name(field_info->old_name,
|
field->set_name(thd, field_info->old_name,
|
||||||
strlen(field_info->old_name),
|
strlen(field_info->old_name),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
|
@@ -58,7 +58,7 @@ static int mysql_register_view(THD *, TABLE_LIST *, enum_view_create_mode);
|
|||||||
NAME_LEN, it is truncated.
|
NAME_LEN, it is truncated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void make_unique_view_field_name(Item *target,
|
static void make_unique_view_field_name(THD *thd, Item *target,
|
||||||
List<Item> &item_list,
|
List<Item> &item_list,
|
||||||
Item *last_element)
|
Item *last_element)
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ static void make_unique_view_field_name(Item *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
target->orig_name= target->name;
|
target->orig_name= target->name;
|
||||||
target->set_name(buff, name_len, system_charset_info);
|
target->set_name(thd, buff, name_len, system_charset_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ static void make_unique_view_field_name(Item *target,
|
|||||||
isn't allowed
|
isn't allowed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool check_duplicate_names(List<Item> &item_list, bool gen_unique_view_name)
|
bool check_duplicate_names(THD *thd, List<Item> &item_list, bool gen_unique_view_name)
|
||||||
{
|
{
|
||||||
Item *item;
|
Item *item;
|
||||||
List_iterator_fast<Item> it(item_list);
|
List_iterator_fast<Item> it(item_list);
|
||||||
@@ -144,9 +144,9 @@ bool check_duplicate_names(List<Item> &item_list, bool gen_unique_view_name)
|
|||||||
if (!gen_unique_view_name)
|
if (!gen_unique_view_name)
|
||||||
goto err;
|
goto err;
|
||||||
if (item->is_autogenerated_name)
|
if (item->is_autogenerated_name)
|
||||||
make_unique_view_field_name(item, item_list, item);
|
make_unique_view_field_name(thd, item, item_list, item);
|
||||||
else if (check->is_autogenerated_name)
|
else if (check->is_autogenerated_name)
|
||||||
make_unique_view_field_name(check, item_list, item);
|
make_unique_view_field_name(thd, check, item_list, item);
|
||||||
else
|
else
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ err:
|
|||||||
@param item_list List of Items which should be checked
|
@param item_list List of Items which should be checked
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void make_valid_column_names(List<Item> &item_list)
|
static void make_valid_column_names(THD *thd, List<Item> &item_list)
|
||||||
{
|
{
|
||||||
Item *item;
|
Item *item;
|
||||||
uint name_len;
|
uint name_len;
|
||||||
@@ -181,7 +181,7 @@ static void make_valid_column_names(List<Item> &item_list)
|
|||||||
continue;
|
continue;
|
||||||
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
|
name_len= my_snprintf(buff, NAME_LEN, "Name_exp_%u", column_no);
|
||||||
item->orig_name= item->name;
|
item->orig_name= item->name;
|
||||||
item->set_name(buff, name_len, system_charset_info);
|
item->set_name(thd, buff, name_len, system_charset_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@@ -539,16 +539,16 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||||||
}
|
}
|
||||||
while ((item= it++, name= nm++))
|
while ((item= it++, name= nm++))
|
||||||
{
|
{
|
||||||
item->set_name(name->str, (uint) name->length, system_charset_info);
|
item->set_name(thd, name->str, (uint) name->length, system_charset_info);
|
||||||
item->is_autogenerated_name= FALSE;
|
item->is_autogenerated_name= FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the auto generated column names are conforming. */
|
/* Check if the auto generated column names are conforming. */
|
||||||
for (sl= select_lex; sl; sl= sl->next_select())
|
for (sl= select_lex; sl; sl= sl->next_select())
|
||||||
make_valid_column_names(sl->item_list);
|
make_valid_column_names(thd, sl->item_list);
|
||||||
|
|
||||||
if (check_duplicate_names(select_lex->item_list, 1))
|
if (check_duplicate_names(thd, select_lex->item_list, 1))
|
||||||
{
|
{
|
||||||
res= TRUE;
|
res= TRUE;
|
||||||
goto err;
|
goto err;
|
||||||
|
@@ -51,7 +51,8 @@ int view_repair(THD *thd, TABLE_LIST *view, HA_CHECK_OPT *check_opt);
|
|||||||
|
|
||||||
extern TYPELIB updatable_views_with_limit_typelib;
|
extern TYPELIB updatable_views_with_limit_typelib;
|
||||||
|
|
||||||
bool check_duplicate_names(List<Item>& item_list, bool gen_unique_view_names);
|
bool check_duplicate_names(THD *thd, List<Item>& item_list,
|
||||||
|
bool gen_unique_view_names);
|
||||||
bool mysql_rename_view(THD *thd, const char *new_db, const char *new_name,
|
bool mysql_rename_view(THD *thd, const char *new_db, const char *new_name,
|
||||||
TABLE_LIST *view);
|
TABLE_LIST *view);
|
||||||
|
|
||||||
|
@@ -8659,11 +8659,11 @@ select_item:
|
|||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
$2->is_autogenerated_name= FALSE;
|
$2->is_autogenerated_name= FALSE;
|
||||||
$2->set_name($4.str, $4.length, system_charset_info);
|
$2->set_name(thd, $4.str, $4.length, system_charset_info);
|
||||||
}
|
}
|
||||||
else if (!$2->name)
|
else if (!$2->name)
|
||||||
{
|
{
|
||||||
$2->set_name($1, (uint) ($3 - $1), thd->charset());
|
$2->set_name(thd, $1, (uint) ($3 - $1), thd->charset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -9917,7 +9917,7 @@ function_call_conflict:
|
|||||||
if (!(i1= get_system_var(thd, OPT_SESSION,
|
if (!(i1= get_system_var(thd, OPT_SESSION,
|
||||||
name, null_lex_str)))
|
name, null_lex_str)))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
i1->set_name((const char *)
|
i1->set_name(thd, (const char *)
|
||||||
STRING_WITH_LEN("@@default_week_format"),
|
STRING_WITH_LEN("@@default_week_format"),
|
||||||
system_charset_info);
|
system_charset_info);
|
||||||
$$= new (thd->mem_root) Item_func_week(thd, $3, i1);
|
$$= new (thd->mem_root) Item_func_week(thd, $3, i1);
|
||||||
@@ -10204,7 +10204,7 @@ udf_expr:
|
|||||||
if ($4.str)
|
if ($4.str)
|
||||||
{
|
{
|
||||||
$2->is_autogenerated_name= FALSE;
|
$2->is_autogenerated_name= FALSE;
|
||||||
$2->set_name($4.str, $4.length, system_charset_info);
|
$2->set_name(thd, $4.str, $4.length, system_charset_info);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
A field has to have its proper name in order for name
|
A field has to have its proper name in order for name
|
||||||
@@ -10214,7 +10214,7 @@ udf_expr:
|
|||||||
*/
|
*/
|
||||||
else if ($2->type() != Item::FIELD_ITEM &&
|
else if ($2->type() != Item::FIELD_ITEM &&
|
||||||
$2->type() != Item::REF_ITEM /* For HAVING */ )
|
$2->type() != Item::REF_ITEM /* For HAVING */ )
|
||||||
$2->set_name($1, (uint) ($3 - $1), thd->charset());
|
$2->set_name(thd, $1, (uint) ($3 - $1), thd->charset());
|
||||||
$$= $2;
|
$$= $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -11643,7 +11643,7 @@ procedure_item:
|
|||||||
if (add_proc_to_list(thd, $2))
|
if (add_proc_to_list(thd, $2))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
if (!$2->name)
|
if (!$2->name)
|
||||||
$2->set_name($1, (uint) ($3 - $1), thd->charset());
|
$2->set_name(thd, $1, (uint) ($3 - $1), thd->charset());
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -13369,7 +13369,7 @@ load_data_set_elem:
|
|||||||
if (lex->update_list.push_back($1, thd->mem_root) ||
|
if (lex->update_list.push_back($1, thd->mem_root) ||
|
||||||
lex->value_list.push_back($4, thd->mem_root))
|
lex->value_list.push_back($4, thd->mem_root))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
$4->set_name_no_truncate($3, (uint) ($5 - $3), thd->charset());
|
$4->set_name_no_truncate(thd, $3, (uint) ($5 - $3), thd->charset());
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@@ -84,18 +84,6 @@ void *sql_calloc(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *sql_strmake(const char *str, size_t len)
|
|
||||||
{
|
|
||||||
char *pos;
|
|
||||||
if ((pos= (char*) sql_alloc(len+1)))
|
|
||||||
{
|
|
||||||
memcpy(pos,str,len);
|
|
||||||
pos[len]=0;
|
|
||||||
}
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
size_t max_res_length,
|
size_t max_res_length,
|
||||||
|
@@ -24,7 +24,6 @@ void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size,
|
|||||||
myf my_flags);
|
myf my_flags);
|
||||||
void *sql_alloc(size_t);
|
void *sql_alloc(size_t);
|
||||||
void *sql_calloc(size_t);
|
void *sql_calloc(size_t);
|
||||||
char *sql_strmake(const char *str, size_t len);
|
|
||||||
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
char *sql_strmake_with_convert(const char *str, size_t arg_length,
|
||||||
CHARSET_INFO *from_cs,
|
CHARSET_INFO *from_cs,
|
||||||
size_t max_res_length,
|
size_t max_res_length,
|
||||||
|
Reference in New Issue
Block a user