summaryrefslogtreecommitdiff
path: root/sql/item.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.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.cc')
-rw-r--r--sql/item.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 2c98aad2074..e9ef3b6a763 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -265,8 +265,9 @@ CHARSET_INFO *Item::default_charset()
return current_thd->variables.collation_connection;
}
-bool DTCollation::aggregate(DTCollation &dt)
+bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion)
{
+ nagg++;
if (!my_charset_same(collation, dt.collation))
{
/*
@@ -280,15 +281,39 @@ bool DTCollation::aggregate(DTCollation &dt)
if (derivation <= dt.derivation)
; // Do nothing
else
- set(dt);
+ {
+ set(dt);
+ strong= nagg;
+ }
}
else if (dt.collation == &my_charset_bin)
{
if (dt.derivation <= derivation)
+ {
set(dt);
+ strong= nagg;
+ }
else
; // Do nothing
}
+ else if (superset_conversion)
+ {
+ if (derivation < dt.derivation &&
+ collation->state & MY_CS_UNICODE)
+ ; // Do nothing
+ else if (dt.derivation < derivation &&
+ dt.collation->state & MY_CS_UNICODE)
+ {
+ set(dt);
+ strong= nagg;
+ }
+ else
+ {
+ // Cannot convert to superset
+ set(0, DERIVATION_NONE);
+ return 1;
+ }
+ }
else
{
set(0, DERIVATION_NONE);
@@ -302,6 +327,7 @@ bool DTCollation::aggregate(DTCollation &dt)
else if (dt.derivation < derivation)
{
set(dt);
+ strong= nagg;
}
else
{