Commit 19563402 authored by Alexander Barkov's avatar Alexander Barkov

Removing global function agg_item_charsets_for_string_result().

Moving agg_arg_charsets_for_string_result() and
agg_arg_charsets_for_string_result_with_comparison() inside
"protected" section in Item_func_or_sum.
parent f727fb45
......@@ -2162,16 +2162,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
bool agg_item_charsets(DTCollation &c, const char *name,
Item **items, uint nitems, uint flags, int item_sep);
inline bool
agg_item_charsets_for_string_result(DTCollation &c, const char *name,
Item **items, uint nitems,
int item_sep= 1)
{
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
MY_COLL_ALLOW_COERCIBLE_CONV |
MY_COLL_ALLOW_NUMERIC_CONV;
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
}
inline bool
agg_item_charsets_for_comparison(DTCollation &c, const char *name,
Item **items, uint nitems,
int item_sep= 1)
......@@ -3626,6 +3616,39 @@ class Used_tables_and_const_cache
*/
class Item_func_or_sum: public Item_result_field, public Item_args
{
protected:
/*
Aggregate arguments for string result, e.g: CONCAT(a,b)
- convert to @@character_set_connection if all arguments are numbers
- allow DERIVATION_NONE
*/
bool agg_arg_charsets_for_string_result(DTCollation &c,
Item **items, uint nitems,
int item_sep= 1)
{
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
MY_COLL_ALLOW_COERCIBLE_CONV |
MY_COLL_ALLOW_NUMERIC_CONV;
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
}
/*
Aggregate arguments for string result, when some comparison
is involved internally, e.g: REPLACE(a,b,c)
- convert to @@character_set_connection if all arguments are numbers
- disallow DERIVATION_NONE
*/
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
Item **items,
uint nitems,
int item_sep= 1)
{
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
MY_COLL_ALLOW_COERCIBLE_CONV |
MY_COLL_ALLOW_NUMERIC_CONV |
MY_COLL_DISALLOW_NONE;
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
}
public:
Item_func_or_sum(THD *thd): Item_result_field(thd), Item_args() {}
Item_func_or_sum(THD *thd, Item *a): Item_result_field(thd), Item_args(a) { }
......
......@@ -192,18 +192,6 @@ class Item_func :public Item_func_or_sum, public Used_tables_and_const_cache
{
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
}
/*
Aggregate arguments for string result, e.g: CONCAT(a,b)
- convert to @@character_set_connection if all arguments are numbers
- allow DERIVATION_NONE
*/
bool agg_arg_charsets_for_string_result(DTCollation &c,
Item **items, uint nitems,
int item_sep= 1)
{
return agg_item_charsets_for_string_result(c, func_name(),
items, nitems, item_sep);
}
/*
Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b
- don't convert to @@character_set_connection if all arguments are numbers
......@@ -216,21 +204,6 @@ class Item_func :public Item_func_or_sum, public Used_tables_and_const_cache
return agg_item_charsets_for_comparison(c, func_name(),
items, nitems, item_sep);
}
/*
Aggregate arguments for string result, when some comparison
is involved internally, e.g: REPLACE(a,b,c)
- convert to @@character_set_connection if all arguments are numbers
- disallow DERIVATION_NONE
*/
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
Item **items,
uint nitems,
int item_sep= 1)
{
return agg_item_charsets_for_string_result_with_comparison(c, func_name(),
items, nitems,
item_sep);
}
Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
Item_transformer transformer, uchar *arg_t);
......
......@@ -3448,8 +3448,8 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
}
/* skip charset aggregation for order columns */
if (agg_item_charsets_for_string_result(collation, func_name(),
args, arg_count - arg_count_order))
if (agg_arg_charsets_for_string_result(collation,
args, arg_count - arg_count_order))
return 1;
result.set_charset(collation.collation);
......
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