summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-10-14 00:04:52 +0300
committerunknown <monty@mysql.com>2005-10-14 00:04:52 +0300
commitb896d3343bd5794e2cb2ad763e289728c85bd02e (patch)
tree7187bdc049ca6658481e5d41b54214c1a5998a6f /strings
parent08d459188135c28553b43c57c929b5a2b6ebba64 (diff)
downloadmariadb-git-b896d3343bd5794e2cb2ad763e289728c85bd02e.tar.gz
Move handling of suffix_length from strnxfrm_bin() to filesort to ensure proper sorting of all kind of binary objects
field::sort_key() now adds length last for varbinary/blob VARBINARY/BLOB is now sorted by filesort so that shorter strings comes before longer ones Fixed issues in test cases from last merge mysql-test/r/select.result: Change column name in test to get GROUP BY to use the alias mysql-test/r/type_blob.result: Test BLOB and VARCHAR sorting mysql-test/t/select.test: Change column name in test to get GROUP BY to use the alias Drop used tables at start of test Don't use table names 'a', 'b' or 'c' mysql-test/t/type_blob.test: Test BLOB and VARCHAR sorting sql/field.cc: Store length last in VARBINARY() and BLOB() columns to get shorter strings sorted before longer onces sql/field.h: Added method 'sort_length()' to allow one to have length bytes last for VARBINARY/BLOB to get these to sort properly sql/filesort.cc: Use 'sort_length()' instead of 'pack_length()' to get length of field. Store suffix_length last for varbinary (blob) objects. The above ensures that BLOB/VARBINARY are correctly sorted (shorter strings before longer ones) sql/sql_class.h: Added sort suffix length (to get varbinary/blob to sort correctly) sql/sql_select.cc: Use sort_length() instead of pack_lengths() strings/ctype-bin.c: Don't let strnxfrm_bin store length last Better to do it in MySQL field object to ensure it's done properly for all cases
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-bin.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index a931c6412b3..973a6ebf12a 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -373,29 +373,14 @@ static int my_wildcmp_bin(CHARSET_INFO *cs,
}
-uint my_strnxfrmlen_bin(CHARSET_INFO *cs __attribute__((unused)), uint len)
-{
- return len + 2;
-}
-
-
static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint dstlen,
const uchar *src, uint srclen)
{
if (dest != src)
memcpy(dest, src, min(dstlen,srclen));
-
- if (dstlen >= srclen + 2)
- {
- if (dstlen > srclen + 2)
- bfill(dest + srclen, dstlen - srclen - 2, 0);
- dest[dstlen-2]= srclen >> 8;
- dest[dstlen-1]= srclen & 0xFF;
- }
- else if (dstlen > srclen)
+ if (dstlen > srclen)
bfill(dest + srclen, dstlen - srclen, 0);
-
return dstlen;
}
@@ -496,7 +481,7 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
my_strnncoll_binary,
my_strnncollsp_binary,
my_strnxfrm_bin,
- my_strnxfrmlen_bin,
+ my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
@@ -539,7 +524,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
CHARSET_INFO my_charset_bin =
{
63,0,0, /* number */
- MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY|MY_CS_STRNXFRM,/* state */
+ MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */
"binary", /* cs name */
"binary", /* name */
"", /* comment */