Loading mysql-test/r/func_set.result +9 −0 Original line number Diff line number Diff line Loading @@ -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 mysql-test/t/func_set.test +8 −0 Original line number Diff line number Diff line Loading @@ -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'); sql/item_func.cc +19 −5 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -1103,6 +1104,18 @@ longlong Item_func_find_in_set::val_int() do { const char *pos= f_pos; if (binary_cmp) { while (pos != f_end) { if (*str != *pos) goto not_found; str++; pos++; } } else { while (pos != f_end) { if (toupper(*str) != toupper(*pos)) Loading @@ -1110,6 +1123,7 @@ longlong Item_func_find_in_set::val_int() str++; pos++; } } if (str == real_end || str[0] == separator) return (longlong) position; not_found: Loading Loading
mysql-test/r/func_set.result +9 −0 Original line number Diff line number Diff line Loading @@ -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
mysql-test/t/func_set.test +8 −0 Original line number Diff line number Diff line Loading @@ -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');
sql/item_func.cc +19 −5 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -1103,6 +1104,18 @@ longlong Item_func_find_in_set::val_int() do { const char *pos= f_pos; if (binary_cmp) { while (pos != f_end) { if (*str != *pos) goto not_found; str++; pos++; } } else { while (pos != f_end) { if (toupper(*str) != toupper(*pos)) Loading @@ -1110,6 +1123,7 @@ longlong Item_func_find_in_set::val_int() str++; pos++; } } if (str == real_end || str[0] == separator) return (longlong) position; not_found: Loading