1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.
This commit is contained in:
ram@gw.mysql.r18.ru
2004-01-22 18:05:47 +04:00
parent a0bbfbf4a3
commit e515d7018f
5 changed files with 46 additions and 10 deletions

View File

@ -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;