summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-09-01 13:56:33 +0500
committerunknown <bar@mysql.com>2004-09-01 13:56:33 +0500
commit705d50660de96fd7d20d585348ace0d2eb512baf (patch)
tree275ae574e7d962db51a28715002c4d7736abeb4c /sql/item_cmpfunc.cc
parentacd13219560b811862d86f0c295b47827a66a2ac (diff)
downloadmariadb-git-705d50660de96fd7d20d585348ace0d2eb512baf.tar.gz
Move collation aggregation with superset conversion code
from Item_bool_func2 into DTCollation to make it reusable for other types of items.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 53ec17fd59d..f91bc5c4bc5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -188,25 +188,17 @@ void Item_bool_func2::fix_length_and_dec()
{
uint strong= 0;
uint weak= 0;
+ DTCollation coll;
- if ((args[0]->collation.derivation < args[1]->collation.derivation) &&
- !my_charset_same(args[0]->collation.collation,
- args[1]->collation.collation) &&
- (args[0]->collation.collation->state & MY_CS_UNICODE))
- {
- weak= 1;
- }
- else if ((args[1]->collation.derivation < args[0]->collation.derivation) &&
- !my_charset_same(args[0]->collation.collation,
- args[1]->collation.collation) &&
- (args[1]->collation.collation->state & MY_CS_UNICODE))
- {
- strong= 1;
- }
-
- if (strong || weak)
+ if (args[0]->result_type() == STRING_RESULT &&
+ args[1]->result_type() == STRING_RESULT &&
+ !my_charset_same(args[0]->collation.collation,
+ args[1]->collation.collation) &&
+ !coll.set(args[0]->collation, args[1]->collation, TRUE))
{
Item* conv= 0;
+ strong= coll.strong;
+ weak= strong ? 0 : 1;
if (args[weak]->type() == STRING_ITEM)
{
String tmp, cstr;