|
|
|
@ -1641,48 +1641,11 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Collect arguments' character sets together. |
|
|
|
|
|
|
|
We allow to apply automatic character set conversion in some cases. |
|
|
|
The conditions when conversion is possible are: |
|
|
|
- arguments A and B have different charsets |
|
|
|
- A wins according to coercibility rules |
|
|
|
(i.e. a column is stronger than a string constant, |
|
|
|
an explicit COLLATE clause is stronger than a column) |
|
|
|
- character set of A is either superset for character set of B, |
|
|
|
or B is a string constant which can be converted into the |
|
|
|
character set of A without data loss. |
|
|
|
|
|
|
|
If all of the above is true, then it's possible to convert |
|
|
|
B into the character set of A, and then compare according |
|
|
|
to the collation of A. |
|
|
|
|
|
|
|
For functions with more than two arguments: |
|
|
|
@code |
|
|
|
collect(A,B,C) ::= collect(collect(A,B),C) |
|
|
|
@endcode |
|
|
|
Since this function calls THD::change_item_tree() on the passed Item ** |
|
|
|
pointers, it is necessary to pass the original Item **'s, not copies. |
|
|
|
Otherwise their values will not be properly restored (see BUG#20769). |
|
|
|
If the items are not consecutive (eg. args[2] and args[5]), use the |
|
|
|
item_sep argument, ie. |
|
|
|
@code |
|
|
|
agg_item_charsets(coll, fname, &args[2], 2, flags, 3) |
|
|
|
@endcode |
|
|
|
*/ |
|
|
|
|
|
|
|
bool agg_item_charsets(DTCollation &coll, const char *fname, |
|
|
|
Item **args, uint nargs, uint flags, int item_sep) |
|
|
|
bool agg_item_set_converter(DTCollation &coll, const char *fname, |
|
|
|
Item **args, uint nargs, uint flags, int item_sep) |
|
|
|
{ |
|
|
|
Item **arg, *safe_args[2]; |
|
|
|
|
|
|
|
LINT_INIT(safe_args[0]); |
|
|
|
LINT_INIT(safe_args[1]); |
|
|
|
|
|
|
|
if (agg_item_collations(coll, fname, args, nargs, flags, item_sep)) |
|
|
|
return TRUE; |
|
|
|
|
|
|
|
/*
|
|
|
|
For better error reporting: save the first and the second argument. |
|
|
|
We need this only if the the number of args is 3 or 2: |
|
|
|
@ -1762,6 +1725,47 @@ bool agg_item_charsets(DTCollation &coll, const char *fname, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Collect arguments' character sets together. |
|
|
|
We allow to apply automatic character set conversion in some cases. |
|
|
|
The conditions when conversion is possible are: |
|
|
|
- arguments A and B have different charsets |
|
|
|
- A wins according to coercibility rules |
|
|
|
(i.e. a column is stronger than a string constant, |
|
|
|
an explicit COLLATE clause is stronger than a column) |
|
|
|
- character set of A is either superset for character set of B, |
|
|
|
or B is a string constant which can be converted into the |
|
|
|
character set of A without data loss. |
|
|
|
|
|
|
|
If all of the above is true, then it's possible to convert |
|
|
|
B into the character set of A, and then compare according |
|
|
|
to the collation of A. |
|
|
|
|
|
|
|
For functions with more than two arguments: |
|
|
|
|
|
|
|
collect(A,B,C) ::= collect(collect(A,B),C) |
|
|
|
|
|
|
|
Since this function calls THD::change_item_tree() on the passed Item ** |
|
|
|
pointers, it is necessary to pass the original Item **'s, not copies. |
|
|
|
Otherwise their values will not be properly restored (see BUG#20769). |
|
|
|
If the items are not consecutive (eg. args[2] and args[5]), use the |
|
|
|
item_sep argument, ie. |
|
|
|
|
|
|
|
agg_item_charsets(coll, fname, &args[2], 2, flags, 3) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
bool agg_item_charsets(DTCollation &coll, const char *fname, |
|
|
|
Item **args, uint nargs, uint flags, int item_sep) |
|
|
|
{ |
|
|
|
Item **arg, *safe_args[2]; |
|
|
|
if (agg_item_collations(coll, fname, args, nargs, flags, item_sep)) |
|
|
|
return TRUE; |
|
|
|
|
|
|
|
return agg_item_set_converter(coll, fname, args, nargs, flags, item_sep); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Item_ident_for_show::make_field(Send_field *tmp_field) |
|
|
|
{ |
|
|
|
tmp_field->table_name= tmp_field->org_table_name= table_name; |
|
|
|
|