summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-01-22 18:05:47 +0400
committerunknown <ram@gw.mysql.r18.ru>2004-01-22 18:05:47 +0400
commit79f6e16d5e8b5edeb76d97b5d9886306e000ae87 (patch)
treee54fe0db01fe767dff386d9f648bc7f6557511f8 /sql/sql_string.cc
parent2ff0016df35be813d335178cab2df0c99e6cbeff (diff)
downloadmariadb-git-79f6e16d5e8b5edeb76d97b5d9886306e000ae87.tar.gz
a proper fix for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause.
<monty> ramil, in MySQL/MyISAM we should only strip end space, not 'space-like' characters. <monty> This is according to SQL; When doing a comparision end space and only end space are ignored. myisam/mi_key.c: a proper fix for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause. myisam/mi_search.c: a proper fix for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause. mysql-test/r/select.result: test case for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause. mysql-test/t/select.test: test case for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause. sql/sql_string.cc: a proper fix for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause.
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 2dcda2d40c2..658cd6d2411 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -467,9 +467,9 @@ int sortcmp(const String *x,const String *y)
if (use_strcoll(default_charset_info))
{
#ifndef CMP_ENDSPACE
- while (x_len && isspace(s[x_len-1]))
+ while (x_len && s[x_len-1] == ' ')
x_len--;
- while (y_len && isspace(t[y_len-1]))
+ while (y_len && t[y_len-1] == ' ')
y_len--;
#endif
return my_strnncoll(default_charset_info,
@@ -493,14 +493,14 @@ int sortcmp(const String *x,const String *y)
{
const char *end=t+y_len;
for (; t != end ; t++)
- if (!isspace(*t))
+ if (*t != ' ')
return -1;
}
else
{
const char *end=s+x_len;
for (; s != end ; s++)
- if (!isspace(*s))
+ if (*s != ' ')
return 1;
}
return 0;