summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2004-08-24 17:29:08 +0400
committerunknown <gluh@gluh.mysql.r18.ru>2004-08-24 17:29:08 +0400
commitb758a6d142a3c2a96c6744c9cf28e444180caa19 (patch)
treeec19864e831406b3c58ccbe4faa5688c2bcb36b3 /sql/item_func.cc
parent696a303547eef73d5f58c1f8b68189e38913cf37 (diff)
downloadmariadb-git-b758a6d142a3c2a96c6744c9cf28e444180caa19.tar.gz
Fix for bug #4340: find_in_set is case insensitive even on binary operators(2nd version)
mysql-test/r/func_set.result: Fix for bug #4340: find_in_set is case insensitive even on binary operators mysql-test/t/func_set.test: Fix for bug #4340: find_in_set is case insensitive even on binary operators sql/item_func.cc: Fix for bug #4340: find_in_set is case insensitive even on binary operators
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc24
1 files changed, 19 insertions, 5 deletions
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;