mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
field.cc:
strnxfrm for binary and simple charsets sql/field.cc: strnxfrm for binary and simple charsets
This commit is contained in:
parent
80d2517412
commit
df1a1075dd
1 changed files with 8 additions and 27 deletions
35
sql/field.cc
35
sql/field.cc
|
@ -4591,38 +4591,19 @@ void Field_blob::sort_string(char *to,uint length)
|
|||
{
|
||||
char *blob;
|
||||
uint blob_length=get_length();
|
||||
#ifdef USE_STRCOLL
|
||||
uint blob_org_length=blob_length;
|
||||
#endif
|
||||
|
||||
if (!blob_length)
|
||||
bzero(to,length);
|
||||
else
|
||||
{
|
||||
if (blob_length > length)
|
||||
blob_length=length;
|
||||
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
|
||||
if (binary())
|
||||
{
|
||||
memcpy(to,blob,blob_length);
|
||||
to+=blob_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_STRCOLL
|
||||
if (use_strnxfrm(field_charset))
|
||||
{
|
||||
blob_length=my_strnxfrm(field_charset,
|
||||
(unsigned char *)to, length,
|
||||
(unsigned char *)blob, blob_org_length);
|
||||
if (blob_length >= length)
|
||||
return;
|
||||
to+=blob_length;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for (char *end=blob+blob_length ; blob != end ;)
|
||||
*to++=(char) field_charset->sort_order[(uint) (uchar) *blob++];
|
||||
}
|
||||
|
||||
blob_length=my_strnxfrm(field_charset,
|
||||
(unsigned char *)to, length,
|
||||
(unsigned char *)blob, blob_length);
|
||||
if (blob_length >= length)
|
||||
return;
|
||||
to+=blob_length;
|
||||
bzero(to,length-blob_length);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue