summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-21 12:21:46 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-21 12:21:46 +0400
commit1956340247eaa14138e2af0b0e2db29cc6bd14e8 (patch)
tree3f6ee5c3f69fc343bfcd8412fa7f1c8568429806
parentf727fb45d4aa6cb3b483366f7b6ab7bbb2a5923c (diff)
downloadmariadb-git-1956340247eaa14138e2af0b0e2db29cc6bd14e8.tar.gz
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.
-rw-r--r--sql/item.h43
-rw-r--r--sql/item_func.h27
-rw-r--r--sql/item_sum.cc4
3 files changed, 35 insertions, 39 deletions
diff --git a/sql/item.h b/sql/item.h
index 45f19b860be..9142b3ef447 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -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 @@ public:
*/
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) { }
diff --git a/sql/item_func.h b/sql/item_func.h
index f8fd26d129c..b7c653d1ced 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -193,18 +193,6 @@ public:
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
- don't allow DERIVATION_NONE
@@ -216,21 +204,6 @@ public:
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);
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 79471bb6d50..1a97a086a16 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -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);