summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
diff options
context:
space:
mode:
authorbar@bar.mysql.r18.ru <>2003-01-31 14:01:49 +0400
committerbar@bar.mysql.r18.ru <>2003-01-31 14:01:49 +0400
commit22564bc91e937a799647f92f0843482b045dc666 (patch)
treec1ce580dbfb4cff8f121d5c0dad1be4befca3e69 /sql/sql_string.cc
parent41eb85658d49a2b7cb326c4e8c99e5842faa8c18 (diff)
downloadmariadb-git-22564bc91e937a799647f92f0843482b045dc666.tar.gz
sql_string.cc:
Use of new CHARSET_INFO function
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r--sql/sql_string.cc64
1 files changed, 4 insertions, 60 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 8c12261f949..62b347b672d 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -573,66 +573,10 @@ void String::qs_append(const char &c)
int sortcmp(const String *x,const String *y)
{
- const char *s= x->ptr();
- const char *t= y->ptr();
- uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
-
- 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 */
- }
+ CHARSET_INFO *cs= x->str_charset;
+ return cs->strnncollsp(cs,
+ (unsigned char *) x->ptr(),x->length(),
+ (unsigned char *) y->ptr(),y->length());
}