summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorbar@bar.mysql.r18.ru <>2003-01-16 15:20:38 +0400
committerbar@bar.mysql.r18.ru <>2003-01-16 15:20:38 +0400
commit4b9d29c83b3d04eaf82f4272a32f7e72d5686afa (patch)
tree6a5f65a82d5008ef4c50535a2936322712835eb6 /sql
parente79ed81d11001ef107a3b0eddf032ddf27be99d8 (diff)
downloadmariadb-git-4b9d29c83b3d04eaf82f4272a32f7e72d5686afa.tar.gz
strnxfrm() for simple and binary charsets fixes
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc38
1 files changed, 4 insertions, 34 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 68717ee51a1..31ec6bf4a46 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3964,23 +3964,11 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void Field_string::sort_string(char *to,uint length)
{
- if (binary())
- memcpy((byte*) to,(byte*) ptr,(size_t) length);
- else
- {
-#ifdef USE_STRCOLL
- if (use_strnxfrm(field_charset)) {
- uint tmp=my_strnxfrm(field_charset,
+ uint tmp=my_strnxfrm(field_charset,
(unsigned char *)to, length,
(unsigned char *) ptr, field_length);
- if (tmp < length)
- bzero(to + tmp, length - tmp);
- }
- else
-#endif
- for (char *from=ptr,*end=ptr+length ; from != end ;)
- *to++=(char) field_charset->sort_order[(uint) (uchar) *from++];
- }
+ if (tmp < length)
+ bzero(to + tmp, length - tmp);
}
@@ -4145,27 +4133,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
void Field_varstring::sort_string(char *to,uint length)
{
uint tot_length=uint2korr(ptr);
- if (binary())
- memcpy((byte*) to,(byte*) ptr+2,(size_t) tot_length);
- else
- {
-#ifdef USE_STRCOLL
- if (use_strnxfrm(field_charset))
- tot_length=my_strnxfrm(field_charset,
+ tot_length=my_strnxfrm(field_charset,
(unsigned char *) to, length,
(unsigned char *)ptr+2, tot_length);
- else
- {
-#endif
- char *tmp=to;
- if (tot_length > length)
- tot_length=length;
- for (char *from=ptr+2,*end=from+tot_length ; from != end ;)
- *tmp++=(char) field_charset->sort_order[(uint) (uchar) *from++];
-#ifdef USE_STRCOLL
- }
-#endif
- }
if (tot_length < length)
bzero(to+tot_length,length-tot_length);
}