summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2003-06-20 18:45:28 +0500
committerunknown <bar@bar.mysql.r18.ru>2003-06-20 18:45:28 +0500
commit1bc2349ec6bcf2c1c95402f58e52cddc6ef1a17a (patch)
tree6eef6af3efe131a9b8ec20bd45a80c8f54124afd
parent75689220fac09f19531e53402dd1736f11b003c8 (diff)
downloadmariadb-git-1bc2349ec6bcf2c1c95402f58e52cddc6ef1a17a.tar.gz
item_cmpfunc.cc:
Rewritten in nicer way , sql/item_cmpfunc.cc: Rewritten in nicer way ,
-rw-r--r--sql/item_cmpfunc.cc61
1 files changed, 37 insertions, 24 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index d4997f78a9e..e67c742928e 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -90,38 +90,51 @@ static bool convert_constant_item(Field *field, Item **item)
bool Item_bool_func2::set_cmp_charset(CHARSET_INFO *cs1, enum coercion co1,
CHARSET_INFO *cs2, enum coercion co2)
{
- if ((cs1 == &my_charset_bin) || (cs2 == &my_charset_bin))
+ if (!my_charset_same(cs1, cs2))
{
- cmp_charset= &my_charset_bin;
- return 0;
+ /*
+ We do allow to use BLOBS together with character strings
+ BLOBS have more precedance
+ */
+ if ((co1 <= co2) && (cs1==&my_charset_bin))
+ {
+ cmp_charset= cs1;
+ coercibility= co1;
+ }
+ else if ((co2 <= co1) && (cs2==&my_charset_bin))
+ {
+ cmp_charset= cs2;
+ coercibility= co2;
+ }
+ else
+ {
+ cmp_charset= 0;
+ coercibility= COER_NOCOLL;
+ return 1;
+ }
}
-
- if ((co1 == COER_NOCOLL) || (co2 == COER_NOCOLL))
- return 1;
-
- if (!my_charset_same(cs1,cs2))
- return 1;
-
- if (co1 < co2)
+ else if (co1 < co2)
+ {
cmp_charset= cs1;
+ coercibility= co1;
+ }
else if (co2 < co1)
- cmp_charset= cs2;
- else // co1==co2
{
+ cmp_charset= cs2;
+ coercibility= co1;
+ }
+ else
+ {
if (cs1 == cs2)
+ {
cmp_charset= cs1;
- else
+ coercibility= co1;
+ }
+ else
{
- if (co1 == COER_COERCIBLE)
- {
- CHARSET_INFO *c;
- if ((c= get_charset_by_csname(cs1->csname, MY_CS_PRIMARY, MYF(0))))
- {
- cmp_charset= c;
- return 0;
- }
- }
- return 1;
+ coercibility= COER_NOCOLL;
+ cmp_charset= 0;
+ return (co1 == COER_EXPLICIT) ? 1 : 0;
}
}
return 0;