Skip to content

Commit 1956340

Browse files
author
Alexander Barkov
committed
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.
1 parent f727fb4 commit 1956340

File tree

3 files changed

+35
-39
lines changed

3 files changed

+35
-39
lines changed

sql/item.h

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,16 +2162,6 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
21622162
bool agg_item_charsets(DTCollation &c, const char *name,
21632163
Item **items, uint nitems, uint flags, int item_sep);
21642164
inline bool
2165-
agg_item_charsets_for_string_result(DTCollation &c, const char *name,
2166-
Item **items, uint nitems,
2167-
int item_sep= 1)
2168-
{
2169-
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
2170-
MY_COLL_ALLOW_COERCIBLE_CONV |
2171-
MY_COLL_ALLOW_NUMERIC_CONV;
2172-
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
2173-
}
2174-
inline bool
21752165
agg_item_charsets_for_comparison(DTCollation &c, const char *name,
21762166
Item **items, uint nitems,
21772167
int item_sep= 1)
@@ -3626,6 +3616,39 @@ class Used_tables_and_const_cache
36263616
*/
36273617
class Item_func_or_sum: public Item_result_field, public Item_args
36283618
{
3619+
protected:
3620+
/*
3621+
Aggregate arguments for string result, e.g: CONCAT(a,b)
3622+
- convert to @@character_set_connection if all arguments are numbers
3623+
- allow DERIVATION_NONE
3624+
*/
3625+
bool agg_arg_charsets_for_string_result(DTCollation &c,
3626+
Item **items, uint nitems,
3627+
int item_sep= 1)
3628+
{
3629+
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
3630+
MY_COLL_ALLOW_COERCIBLE_CONV |
3631+
MY_COLL_ALLOW_NUMERIC_CONV;
3632+
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
3633+
}
3634+
/*
3635+
Aggregate arguments for string result, when some comparison
3636+
is involved internally, e.g: REPLACE(a,b,c)
3637+
- convert to @@character_set_connection if all arguments are numbers
3638+
- disallow DERIVATION_NONE
3639+
*/
3640+
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
3641+
Item **items,
3642+
uint nitems,
3643+
int item_sep= 1)
3644+
{
3645+
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
3646+
MY_COLL_ALLOW_COERCIBLE_CONV |
3647+
MY_COLL_ALLOW_NUMERIC_CONV |
3648+
MY_COLL_DISALLOW_NONE;
3649+
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
3650+
}
3651+
36293652
public:
36303653
Item_func_or_sum(THD *thd): Item_result_field(thd), Item_args() {}
36313654
Item_func_or_sum(THD *thd, Item *a): Item_result_field(thd), Item_args(a) { }

sql/item_func.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,6 @@ class Item_func :public Item_func_or_sum, public Used_tables_and_const_cache
192192
{
193193
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
194194
}
195-
/*
196-
Aggregate arguments for string result, e.g: CONCAT(a,b)
197-
- convert to @@character_set_connection if all arguments are numbers
198-
- allow DERIVATION_NONE
199-
*/
200-
bool agg_arg_charsets_for_string_result(DTCollation &c,
201-
Item **items, uint nitems,
202-
int item_sep= 1)
203-
{
204-
return agg_item_charsets_for_string_result(c, func_name(),
205-
items, nitems, item_sep);
206-
}
207195
/*
208196
Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b
209197
- 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
216204
return agg_item_charsets_for_comparison(c, func_name(),
217205
items, nitems, item_sep);
218206
}
219-
/*
220-
Aggregate arguments for string result, when some comparison
221-
is involved internally, e.g: REPLACE(a,b,c)
222-
- convert to @@character_set_connection if all arguments are numbers
223-
- disallow DERIVATION_NONE
224-
*/
225-
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
226-
Item **items,
227-
uint nitems,
228-
int item_sep= 1)
229-
{
230-
return agg_item_charsets_for_string_result_with_comparison(c, func_name(),
231-
items, nitems,
232-
item_sep);
233-
}
234207
Item *transform(THD *thd, Item_transformer transformer, uchar *arg);
235208
Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p,
236209
Item_transformer transformer, uchar *arg_t);

sql/item_sum.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3448,8 +3448,8 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
34483448
}
34493449

34503450
/* skip charset aggregation for order columns */
3451-
if (agg_item_charsets_for_string_result(collation, func_name(),
3452-
args, arg_count - arg_count_order))
3451+
if (agg_arg_charsets_for_string_result(collation,
3452+
args, arg_count - arg_count_order))
34533453
return 1;
34543454

34553455
result.set_charset(collation.collation);

0 commit comments

Comments
 (0)