From ef325a4704e9aabe09f773528f6496a94298396f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Jan 2004 18:05:47 +0400 Subject: a proper fix for the bug #2298 Trailing whitespace inconsistently handled in WHERE clause. ramil, in MySQL/MyISAM we should only strip end space, not 'space-like' characters. 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. --- sql/sql_string.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/sql_string.cc') 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; -- cgit v1.2.1