summaryrefslogtreecommitdiff
path: root/strings/ctype-bin.c
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-10-13 19:16:19 +0500
committerunknown <bar@mysql.com>2005-10-13 19:16:19 +0500
commit60e411eb32fd31135cf805202a302bc7a050b757 (patch)
tree6f8df603e9e49a74a1d1b20940188bc9f42cc7fd /strings/ctype-bin.c
parentd471e9de7d66b2b45ccfe77e07aa1ef1022e1f6d (diff)
downloadmariadb-git-60e411eb32fd31135cf805202a302bc7a050b757.tar.gz
type_binary.result, type_binary.test:
new file mysql_fix_privilege_tables.sql, mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. Many files: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. Adding true BINARY/VARBINARY: new pad_char structure member. ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. field.cc: Adding true BINARY/VARBINARY. sql/field.cc: Adding true BINARY/VARBINARY. strings/ctype-big5.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-bin.c: Adding true BINARY/VARBINARY: new pad_char structure member. New strnxfrm, with two trailing length bytes. strings/ctype-cp932.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-czech.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-euc_kr.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-eucjpms.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-extra.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gb2312.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-gbk.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-latin1.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-simple.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-sjis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-tis620.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-uca.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ucs2.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-ujis.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-utf8.c: Adding true BINARY/VARBINARY: new pad_char structure member. strings/ctype-win1250ch.c: Adding true BINARY/VARBINARY: new pad_char structure member. include/m_ctype.h: Adding true BINARY/VARBINARY: new pad_char structure member. mysql-test/t/alter_table.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/binary.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/cast.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_cp1251.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ctype_many.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/federated.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/func_in.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_condition_pushdown.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/ndb_types.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/sp.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/t/type_blob.test: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/alter_table.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/binary.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/cast.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_cp1251.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ctype_many.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/federated.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/func_in.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_condition_pushdown.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/ndb_types.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/sp.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/system_mysql_db.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. mysql-test/r/type_blob.result: Adding true BINARY/VARBINARY: fixing tests not to output 0x00 bytes. scripts/mysql_create_system_tables.sh: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding. scripts/mysql_fix_privilege_tables.sql: Adding true BINARY/VARBINARY: fixing "password" type, not to be 0x00-padding.
Diffstat (limited to 'strings/ctype-bin.c')
-rw-r--r--strings/ctype-bin.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 0fcd9021c4b..a931c6412b3 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -86,6 +86,14 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
}
+uint my_lengthsp_binary(CHARSET_INFO *cs __attribute__((unused)),
+ const char *ptr __attribute__((unused)),
+ uint length)
+{
+ return length;
+}
+
+
/*
Compare two strings. Result is sign(first_argument - second_argument)
@@ -365,14 +373,29 @@ 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)
+
+ 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)
bfill(dest + srclen, dstlen - srclen, 0);
+
return dstlen;
}
@@ -473,7 +496,7 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
my_strnncoll_binary,
my_strnncollsp_binary,
my_strnxfrm_bin,
- my_strnxfrmlen_simple,
+ my_strnxfrmlen_bin,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
@@ -491,7 +514,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
my_numchars_8bit,
my_charpos_8bit,
my_well_formed_len_8bit,
- my_lengthsp_8bit,
+ my_lengthsp_binary,
my_numcells_8bit,
my_mb_wc_bin,
my_wc_mb_bin,
@@ -516,7 +539,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,/* state */
+ MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY|MY_CS_STRNXFRM,/* state */
"binary", /* cs name */
"binary", /* name */
"", /* comment */
@@ -539,6 +562,7 @@ CHARSET_INFO my_charset_bin =
1, /* mbmaxlen */
0, /* min_sort_char */
255, /* max_sort_char */
+ 0, /* pad char */
0, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_binary_handler