summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2004-08-24 17:40:19 +0400
committerunknown <gluh@gluh.mysql.r18.ru>2004-08-24 17:40:19 +0400
commit6212c6e7f5104e558065688cd2b3bafc31e0c487 (patch)
tree6b95683f50bc858656a9dc95f6344c137b379147
parent8b11e715bb4128e9b0fc31f3390f9d96189c4ff0 (diff)
parentb758a6d142a3c2a96c6744c9cf28e444180caa19 (diff)
downloadmariadb-git-6212c6e7f5104e558065688cd2b3bafc31e0c487.tar.gz
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.0
into gluh.mysql.r18.ru:/home/gluh/MySQL-BUGS/mysql-4.0
-rw-r--r--mysql-test/r/func_set.result9
-rw-r--r--mysql-test/t/func_set.test8
-rw-r--r--sql/item_func.cc24
3 files changed, 36 insertions, 5 deletions
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index eeeb216d142..9181fe9e54d 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -28,3 +28,12 @@ find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc")
select interval(null, 1, 10, 100);
interval(null, 1, 10, 100)
-1
+select find_in_set(binary 'a',binary 'A,B,C');
+find_in_set(binary 'a',binary 'A,B,C')
+0
+select find_in_set('a',binary 'A,B,C');
+find_in_set('a',binary 'A,B,C')
+0
+select find_in_set(binary 'a', 'A,B,C');
+find_in_set(binary 'a', 'A,B,C')
+0
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index 81f561989d5..a1ee293ae05 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -16,3 +16,11 @@ select elt(2,1),field(NULL,"a","b","c");
select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
select interval(null, 1, 10, 100);
+
+#
+# Bug4340: find_in_set is case insensitive even on binary operators
+#
+
+select find_in_set(binary 'a',binary 'A,B,C');
+select find_in_set('a',binary 'A,B,C');
+select find_in_set(binary 'a', 'A,B,C');
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 237db890abb..334be48dc9a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1071,6 +1071,7 @@ static const char separator=',';
longlong Item_func_find_in_set::val_int()
{
+ bool binary_cmp= args[0]->binary || args[1]->binary;
if (enum_value)
{
ulonglong tmp=(ulonglong) args[1]->val_int();
@@ -1103,12 +1104,25 @@ longlong Item_func_find_in_set::val_int()
do
{
const char *pos= f_pos;
- while (pos != f_end)
+ if (binary_cmp)
{
- if (toupper(*str) != toupper(*pos))
- goto not_found;
- str++;
- pos++;
+ while (pos != f_end)
+ {
+ if (*str != *pos)
+ goto not_found;
+ str++;
+ pos++;
+ }
+ }
+ else
+ {
+ while (pos != f_end)
+ {
+ if (toupper(*str) != toupper(*pos))
+ goto not_found;
+ str++;
+ pos++;
+ }
}
if (str == real_end || str[0] == separator)
return (longlong) position;