diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-01-31 14:01:49 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-01-31 14:01:49 +0400 |
commit | 2bce5e57096ed1adc59fc5cb1a9ff71630fd9fe2 (patch) | |
tree | c1ce580dbfb4cff8f121d5c0dad1be4befca3e69 | |
parent | a6438797a9ee27ae80dfaf817c4198fb84a91566 (diff) | |
download | mariadb-git-2bce5e57096ed1adc59fc5cb1a9ff71630fd9fe2.tar.gz |
sql_string.cc:
Use of new CHARSET_INFO function
sql/sql_string.cc:
Use of new CHARSET_INFO function
-rw-r--r-- | sql/sql_string.cc | 64 |
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()); } |