sql_string.cc:
Use of new CHARSET_INFO function sql/sql_string.cc: Use of new CHARSET_INFO function
This commit is contained in:
parent
a6438797a9
commit
2bce5e5709
@ -573,66 +573,10 @@ void String::qs_append(const char &c)
|
|||||||
|
|
||||||
int sortcmp(const String *x,const String *y)
|
int sortcmp(const String *x,const String *y)
|
||||||
{
|
{
|
||||||
const char *s= x->ptr();
|
CHARSET_INFO *cs= x->str_charset;
|
||||||
const char *t= y->ptr();
|
return cs->strnncollsp(cs,
|
||||||
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
|
(unsigned char *) x->ptr(),x->length(),
|
||||||
|
(unsigned char *) y->ptr(),y->length());
|
||||||
if (use_strnxfrm(x->str_charset))
|
|
||||||
{
|
|
||||||
#ifndef CMP_ENDSPACE
|
|
||||||
while (x_len && my_isspace(x->str_charset,s[x_len-1]))
|
|
||||||
x_len--;
|
|
||||||
while (y_len && my_isspace(x->str_charset,t[y_len-1]))
|
|
||||||
y_len--;
|
|
||||||
#endif
|
|
||||||
return my_strnncoll(x->str_charset,
|
|
||||||
(unsigned char *)s,x_len,(unsigned char *)t,y_len);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x_len-=len; // For easy end space test
|
|
||||||
y_len-=len;
|
|
||||||
if (x->str_charset->sort_order)
|
|
||||||
{
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
if (x->str_charset->sort_order[(uchar) *s++] !=
|
|
||||||
x->str_charset->sort_order[(uchar) *t++])
|
|
||||||
return ((int) x->str_charset->sort_order[(uchar) s[-1]] -
|
|
||||||
(int) x->str_charset->sort_order[(uchar) t[-1]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
if (*s++ != *t++)
|
|
||||||
return ((int) s[-1] - (int) t[-1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifndef CMP_ENDSPACE
|
|
||||||
/* Don't compare end space in strings */
|
|
||||||
{
|
|
||||||
if (y_len)
|
|
||||||
{
|
|
||||||
const char *end=t+y_len;
|
|
||||||
for (; t != end ; t++)
|
|
||||||
if (!my_isspace(x->str_charset,*t))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *end=s+x_len;
|
|
||||||
for (; s != end ; s++)
|
|
||||||
if (!my_isspace(x->str_charset,*s))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return (int) (x_len-y_len);
|
|
||||||
#endif /* CMP_ENDSPACE */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user