This commit is contained in:
Georgi Kodinov 2010-11-26 17:34:33 +02:00
commit edf1641ce4
25 changed files with 3592 additions and 352 deletions

View file

@ -1456,8 +1456,8 @@ static struct my_option my_long_options[] =
&opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Only update the default database. This is useful for skipping updates "
"to other database in the update log.",
"Ignore statements except those that occur while the default "
"database is the one named at the command line.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_POPEN
{"pager", OPT_PAGER,
@ -2692,6 +2692,10 @@ static void get_current_db()
{
MYSQL_RES *res;
/* If one_database is set, current_db is not supposed to change. */
if (one_database)
return;
my_free(current_db);
current_db= NULL;
/* In case of error below current_db will be NULL */

View file

@ -356,6 +356,32 @@ extern CHARSET_INFO my_charset_utf8mb4_unicode_ci;
#define MY_UTF8MB4 "utf8mb4"
/* Helper functions to handle contraction */
static inline my_bool
my_cs_have_contractions(CHARSET_INFO *cs)
{
return cs->contractions != NULL;
}
static inline my_bool
my_cs_can_be_contraction_head(CHARSET_INFO *cs, my_wc_t wc)
{
return ((const char *)cs->contractions)[0x40*0x40 + (wc & 0xFF)];
}
static inline my_bool
my_cs_can_be_contraction_tail(CHARSET_INFO *cs, my_wc_t wc)
{
return ((const char *)cs->contractions)[0x40*0x40 + (wc & 0xFF)];
}
static inline uint16*
my_cs_contraction2_weight(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
{
return &cs->contractions[(wc1 - 0x40) * 0x40 + wc2 - 0x40];
}
/* declarations for simple charsets */
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
const uchar *, size_t);
@ -430,6 +456,7 @@ ulonglong my_strntoull10rnd_ucs2(CHARSET_INFO *cs,
void my_fill_8bit(CHARSET_INFO *cs, char* to, size_t l, int fill);
/* For 8-bit character set */
my_bool my_like_range_simple(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
@ -437,6 +464,7 @@ my_bool my_like_range_simple(CHARSET_INFO *cs,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
/* For ASCII-based multi-byte character sets with mbminlen=1 */
my_bool my_like_range_mb(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
@ -444,26 +472,13 @@ my_bool my_like_range_mb(CHARSET_INFO *cs,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
my_bool my_like_range_ucs2(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
my_bool my_like_range_utf16(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
my_bool my_like_range_utf32(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
/* For other character sets, with arbitrary mbminlen and mbmaxlen numbers */
my_bool my_like_range_generic(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str, char *max_str,
size_t *min_length, size_t *max_length);
int my_wildcmp_8bit(CHARSET_INFO *,
const char *str,const char *str_end,

View file

@ -0,0 +1,46 @@
#
# Test Unicode conversion, upper, lower
#
SELECT @@collation_connection;
CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0;
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
SELECT
HEX(a) AS chr,
HEX(LOWER(a)) AS upper,
HEX(LOWER(a)) AS lower,
HEX(@utf8:=CONVERT(a USING utf8)) AS utf8,
HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip,
if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe
FROM t1 ORDER BY chr;
DROP TABLE t1;

View file

@ -0,0 +1,12 @@
SELECT @@collation_connection;
--echo #
--echo # Bug#57737 Character sets: search fails with like, contraction, index
--echo #
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
SELECT * FROM t1 WHERE s1 LIKE 'c%';
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT * FROM t1 WHERE s1 LIKE 'c%';
ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
SELECT * FROM t1 WHERE s1 LIKE 'ch';
DROP TABLE t1;

View file

@ -0,0 +1,11 @@
SELECT @@collation_connection;
--echo #
--echo # Bug#57737 Character sets: search fails with like, contraction, index
--echo # Part#2 - ignorable characters
--echo #
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
DROP TABLE t1;

View file

@ -82,6 +82,314 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
DROP TABLE t1;
#
# Start of 5.1 tests
#
SELECT @@collation_connection;
@@collation_connection
cp1251_general_ci
CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0;
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
SELECT
HEX(a) AS chr,
HEX(LOWER(a)) AS upper,
HEX(LOWER(a)) AS lower,
HEX(@utf8:=CONVERT(a USING utf8)) AS utf8,
HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip,
if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe
FROM t1 ORDER BY chr;
chr upper lower utf8 roundtrip issafe
00 00 00 00 00
01 01 01 01 01
02 02 02 02 02
03 03 03 03 03
04 04 04 04 04
05 05 05 05 05
06 06 06 06 06
07 07 07 07 07
08 08 08 08 08
09 09 09 09 09
0A 0A 0A 0A 0A
0B 0B 0B 0B 0B
0C 0C 0C 0C 0C
0D 0D 0D 0D 0D
0E 0E 0E 0E 0E
0F 0F 0F 0F 0F
10 10 10 10 10
11 11 11 11 11
12 12 12 12 12
13 13 13 13 13
14 14 14 14 14
15 15 15 15 15
16 16 16 16 16
17 17 17 17 17
18 18 18 18 18
19 19 19 19 19
1A 1A 1A 1A 1A
1B 1B 1B 1B 1B
1C 1C 1C 1C 1C
1D 1D 1D 1D 1D
1E 1E 1E 1E 1E
1F 1F 1F 1F 1F
20 20 20 20 20
21 21 21 21 21
22 22 22 22 22
23 23 23 23 23
24 24 24 24 24
25 25 25 25 25
26 26 26 26 26
27 27 27 27 27
28 28 28 28 28
29 29 29 29 29
2A 2A 2A 2A 2A
2B 2B 2B 2B 2B
2C 2C 2C 2C 2C
2D 2D 2D 2D 2D
2E 2E 2E 2E 2E
2F 2F 2F 2F 2F
30 30 30 30 30
31 31 31 31 31
32 32 32 32 32
33 33 33 33 33
34 34 34 34 34
35 35 35 35 35
36 36 36 36 36
37 37 37 37 37
38 38 38 38 38
39 39 39 39 39
3A 3A 3A 3A 3A
3B 3B 3B 3B 3B
3C 3C 3C 3C 3C
3D 3D 3D 3D 3D
3E 3E 3E 3E 3E
3F 3F 3F 3F 3F
40 40 40 40 40
41 61 61 41 41
42 62 62 42 42
43 63 63 43 43
44 64 64 44 44
45 65 65 45 45
46 66 66 46 46
47 67 67 47 47
48 68 68 48 48
49 69 69 49 49
4A 6A 6A 4A 4A
4B 6B 6B 4B 4B
4C 6C 6C 4C 4C
4D 6D 6D 4D 4D
4E 6E 6E 4E 4E
4F 6F 6F 4F 4F
50 70 70 50 50
51 71 71 51 51
52 72 72 52 52
53 73 73 53 53
54 74 74 54 54
55 75 75 55 55
56 76 76 56 56
57 77 77 57 57
58 78 78 58 58
59 79 79 59 59
5A 7A 7A 5A 5A
5B 5B 5B 5B 5B
5C 5C 5C 5C 5C
5D 5D 5D 5D 5D
5E 5E 5E 5E 5E
5F 5F 5F 5F 5F
60 60 60 60 60
61 61 61 61 61
62 62 62 62 62
63 63 63 63 63
64 64 64 64 64
65 65 65 65 65
66 66 66 66 66
67 67 67 67 67
68 68 68 68 68
69 69 69 69 69
6A 6A 6A 6A 6A
6B 6B 6B 6B 6B
6C 6C 6C 6C 6C
6D 6D 6D 6D 6D
6E 6E 6E 6E 6E
6F 6F 6F 6F 6F
70 70 70 70 70
71 71 71 71 71
72 72 72 72 72
73 73 73 73 73
74 74 74 74 74
75 75 75 75 75
76 76 76 76 76
77 77 77 77 77
78 78 78 78 78
79 79 79 79 79
7A 7A 7A 7A 7A
7B 7B 7B 7B 7B
7C 7C 7C 7C 7C
7D 7D 7D 7D 7D
7E 7E 7E 7E 7E
7F 7F 7F 7F 7F
80 90 90 D082 80
81 83 83 D083 81
82 82 82 E2809A 82
83 83 83 D193 83
84 84 84 E2809E 84
85 85 85 E280A6 85
86 86 86 E280A0 86
87 87 87 E280A1 87
88 88 88 E282AC 88
89 89 89 E280B0 89
8A 9A 9A D089 8A
8B 8B 8B E280B9 8B
8C 9C 9C D08A 8C
8D 9D 9D D08C 8D
8E 9E 9E D08B 8E
8F 9F 9F D08F 8F
90 90 90 D192 90
91 91 91 E28098 91
92 92 92 E28099 92
93 93 93 E2809C 93
94 94 94 E2809D 94
95 95 95 E280A2 95
96 96 96 E28093 96
97 97 97 E28094 97
98 98 98 3F 3F Round trip unsafe
99 99 99 E284A2 99
9A 9A 9A D199 9A
9B 9B 9B E280BA 9B
9C 9C 9C D19A 9C
9D 9D 9D D19C 9D
9E 9E 9E D19B 9E
9F 9F 9F D19F 9F
A0 A0 A0 C2A0 A0
A1 A2 A2 D08E A1
A2 A2 A2 D19E A2
A3 BC BC D088 A3
A4 A4 A4 C2A4 A4
A5 B4 B4 D290 A5
A6 A6 A6 C2A6 A6
A7 A7 A7 C2A7 A7
A8 B8 B8 D081 A8
A9 A9 A9 C2A9 A9
AA BA BA D084 AA
AB AB AB C2AB AB
AC AC AC C2AC AC
AD AD AD C2AD AD
AE AE AE C2AE AE
AF BF BF D087 AF
B0 B0 B0 C2B0 B0
B1 B1 B1 C2B1 B1
B2 B3 B3 D086 B2
B3 B3 B3 D196 B3
B4 B4 B4 D291 B4
B5 B5 B5 C2B5 B5
B6 B6 B6 C2B6 B6
B7 B7 B7 C2B7 B7
B8 B8 B8 D191 B8
B9 B9 B9 E28496 B9
BA BA BA D194 BA
BB BB BB C2BB BB
BC BC BC D198 BC
BD BE BE D085 BD
BE BE BE D195 BE
BF BF BF D197 BF
C0 E0 E0 D090 C0
C1 E1 E1 D091 C1
C2 E2 E2 D092 C2
C3 E3 E3 D093 C3
C4 E4 E4 D094 C4
C5 E5 E5 D095 C5
C6 E6 E6 D096 C6
C7 E7 E7 D097 C7
C8 E8 E8 D098 C8
C9 E9 E9 D099 C9
CA EA EA D09A CA
CB EB EB D09B CB
CC EC EC D09C CC
CD ED ED D09D CD
CE EE EE D09E CE
CF EF EF D09F CF
D0 F0 F0 D0A0 D0
D1 F1 F1 D0A1 D1
D2 F2 F2 D0A2 D2
D3 F3 F3 D0A3 D3
D4 F4 F4 D0A4 D4
D5 F5 F5 D0A5 D5
D6 F6 F6 D0A6 D6
D7 F7 F7 D0A7 D7
D8 F8 F8 D0A8 D8
D9 F9 F9 D0A9 D9
DA FA FA D0AA DA
DB FB FB D0AB DB
DC FC FC D0AC DC
DD FD FD D0AD DD
DE FE FE D0AE DE
DF FF FF D0AF DF
E0 E0 E0 D0B0 E0
E1 E1 E1 D0B1 E1
E2 E2 E2 D0B2 E2
E3 E3 E3 D0B3 E3
E4 E4 E4 D0B4 E4
E5 E5 E5 D0B5 E5
E6 E6 E6 D0B6 E6
E7 E7 E7 D0B7 E7
E8 E8 E8 D0B8 E8
E9 E9 E9 D0B9 E9
EA EA EA D0BA EA
EB EB EB D0BB EB
EC EC EC D0BC EC
ED ED ED D0BD ED
EE EE EE D0BE EE
EF EF EF D0BF EF
F0 F0 F0 D180 F0
F1 F1 F1 D181 F1
F2 F2 F2 D182 F2
F3 F3 F3 D183 F3
F4 F4 F4 D184 F4
F5 F5 F5 D185 F5
F6 F6 F6 D186 F6
F7 F7 F7 D187 F7
F8 F8 F8 D188 F8
F9 F9 F9 D189 F9
FA FA FA D18A FA
FB FB FB D18B FB
FC FC FC D18C FC
FD FD FD D18D FD
FE FE FE D18E FE
FF FF FF D18F FF
DROP TABLE t1;
#
# End of 5.1 tests
#
#
# Start of 5.5 tests
#
#

File diff suppressed because it is too large Load diff

View file

@ -2888,3 +2888,101 @@ a hex(b) c
DROP TABLE t1;
set names utf8;
End for 5.0 tests
#
# Start of 5.5 tests
#
SET collation_connection=utf8_czech_ci;
SELECT @@collation_connection;
@@collation_connection
utf8_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
SELECT * FROM t1 WHERE s1 LIKE 'ch';
s1
ch
DROP TABLE t1;
SELECT @@collation_connection;
@@collation_connection
utf8_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
# Part#2 - ignorable characters
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
61000000000009
61
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
61000000000009
61
DROP TABLE t1;
SET collation_connection=ucs2_czech_ci;
SELECT @@collation_connection;
@@collation_connection
ucs2_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
SELECT * FROM t1 WHERE s1 LIKE 'ch';
s1
ch
DROP TABLE t1;
SELECT @@collation_connection;
@@collation_connection
ucs2_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
# Part#2 - ignorable characters
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
0061000000000000000000000009
0061
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
0061000000000000000000000009
0061
DROP TABLE t1;
#
# End of 5.5 tests
#

View file

@ -2368,6 +2368,52 @@ NULL
NULL
NULL
drop table t1;
SET collation_connection=utf16_czech_ci;
SELECT @@collation_connection;
@@collation_connection
utf16_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
SELECT * FROM t1 WHERE s1 LIKE 'ch';
s1
ch
DROP TABLE t1;
SELECT @@collation_connection;
@@collation_connection
utf16_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
# Part#2 - ignorable characters
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
0061000000000000000000000009
0061
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
0061000000000000000000000009
0061
DROP TABLE t1;
#
# End of 5.5 tests
#

View file

@ -2368,6 +2368,52 @@ NULL
NULL
NULL
drop table t1;
SET collation_connection=utf32_czech_ci;
SELECT @@collation_connection;
@@collation_connection
utf32_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch');
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT * FROM t1 WHERE s1 LIKE 'c%';
s1
c
ce
ch
ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1));
SELECT * FROM t1 WHERE s1 LIKE 'ch';
s1
ch
DROP TABLE t1;
SELECT @@collation_connection;
@@collation_connection
utf32_czech_ci
#
# Bug#57737 Character sets: search fails with like, contraction, index
# Part#2 - ignorable characters
#
CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0;
INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e');
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
00000061000000000000000000000000000000000000000000000009
00000061
ALTER TABLE t1 ADD KEY s1 (s1);
SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%';
HEX(s1)
00000061000000000000000000000000000000000000000000000009
00000061
DROP TABLE t1;
#
# End of 5.5 tests
#

View file

@ -433,4 +433,75 @@ Bug #47147: mysql client option --skip-column-names does not apply to vertical o
*************************** 1. row ***************************
1
#
# Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE
# commands.
#
CREATE DATABASE connected_db;
USE connected_db;
SHOW TABLES;
Tables_in_connected_db
table_in_connected_db
DROP DATABASE connected_db;
#
# Testing --one-database option
#
CREATE DATABASE connected_db;
SHOW TABLES IN connected_db;
Tables_in_connected_db
t1
SHOW TABLES IN test;
Tables_in_test
t1
USE test;
DROP TABLE t1;
DROP DATABASE connected_db;
SHOW TABLES IN test;
Tables_in_test
SHOW TABLES IN test1;
Tables_in_test1
DROP DATABASE test1;
#
# Checking --one-database option followed by the execution of
# connect command.
#
CREATE DATABASE connected_db;
SHOW TABLES IN connected_db;
Tables_in_connected_db
t1
t2
SHOW TABLES IN test;
Tables_in_test
t1
t2
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP DATABASE connected_db;
#
# Checking --one-database option with no database specified
# at command-line.
#
SHOW TABLES IN test;
Tables_in_test
#
# Checking --one-database option with non_existent_db
# specified with USE command
#
SHOW TABLES IN test;
Tables_in_test
table_in_test
DROP DATABASE test;
CREATE DATABASE test;
SHOW TABLES IN test;
Tables_in_test
table_in_test
DROP DATABASE test;
CREATE DATABASE test;
End of tests

View file

@ -59,6 +59,16 @@ DROP TABLE t1;
# End of 4.1 tests
--echo #
--echo # Start of 5.1 tests
--echo #
--source include/ctype_8bit.inc
--echo #
--echo # End of 5.1 tests
--echo #
--echo #
--echo # Start of 5.5 tests
--echo #

View file

@ -0,0 +1,87 @@
--source include/have_debug.inc
--source include/have_ucs2.inc
--source include/have_utf16.inc
--source include/have_utf32.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
--enable_warnings
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, a VARBINARY(32));
INSERT INTO t1 (a) VALUES (''),('_'),('%'),('\_'),('\%'),('\\');
INSERT INTO t1 (a) VALUES ('a'),('c');
INSERT INTO t1 (a) VALUES ('a_'),('c_');
INSERT INTO t1 (a) VALUES ('a%'),('c%');
INSERT INTO t1 (a) VALUES ('aa'),('cc'),('ch');
INSERT INTO t1 (a) VALUES ('aa_'),('cc_'),('ch_');
INSERT INTO t1 (a) VALUES ('aa%'),('cc%'),('ch%');
INSERT INTO t1 (a) VALUES ('aaa'),('ccc'),('cch');
INSERT INTO t1 (a) VALUES ('aaa_'),('ccc_'),('cch_');
INSERT INTO t1 (a) VALUES ('aaa%'),('ccc%'),('cch%');
INSERT INTO t1 (a) VALUES ('aaaaaaaaaaaaaaaaaaaa');
CREATE VIEW v1 AS
SELECT id, 'a' AS name, a AS val FROM t1
UNION
SELECT id, 'mn', HEX(LIKE_RANGE_MIN(a, 16)) AS min FROM t1
UNION
SELECT id, 'mx', HEX(LIKE_RANGE_MAX(a, 16)) AS max FROM t1
UNION
SELECT id, 'sp', REPEAT('-', 32) AS sep FROM t1
ORDER BY id, name;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET latin1;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_czech_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_danish_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_czech_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_danish_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_czech_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_danish_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_czech_ci;
SELECT * FROM v1;
ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_danish_ci;
SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;

View file

@ -545,3 +545,19 @@ set collation_connection=ucs2_unicode_ci;
set names utf8;
-- echo End for 5.0 tests
--echo #
--echo # Start of 5.5 tests
--echo #
#
# Test my_like_range and contractions
#
SET collation_connection=utf8_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc
SET collation_connection=ucs2_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc
--echo #
--echo # End of 5.5 tests
--echo #

View file

@ -284,6 +284,13 @@ DROP TABLE IF EXISTS t1;
set collation_connection=utf16_unicode_ci;
--source include/ctype_regex.inc
#
# Test my_like_range and contractions
#
SET collation_connection=utf16_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc
--echo #
--echo # End of 5.5 tests

View file

@ -286,6 +286,14 @@ set collation_connection=utf32_unicode_ci;
--source include/ctype_regex.inc
#
# Test my_like_range and contractions
#
SET collation_connection=utf32_czech_ci;
--source include/ctype_czech.inc
--source include/ctype_like_ignorable.inc
--echo #
--echo # End of 5.5 tests
--echo #

View file

@ -425,5 +425,149 @@ drop table t1;
--echo
--exec $MYSQL --skip-column-names --vertical test -e "select 1 as a"
--echo
--echo #
--echo # Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE
--echo # commands.
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
DROP DATABASE connected_db;
CREATE DATABASE connected_db;
USE connected_db;
CREATE TABLE `table_in_connected_db`(a INT);
EOF
CREATE DATABASE connected_db;
--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/bug54899.sql
USE connected_db;
SHOW TABLES;
DROP DATABASE connected_db;
--remove_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
--echo
--echo #
--echo # Testing --one-database option
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
CREATE TABLE t1 (i INT);
CREATE TABLE test.t1 (i INT);
USE test;
# Following statements should be filtered.
CREATE TABLE connected_db.t2 (i INT);
CREATE TABLE t2 (i INT);
EOF
CREATE DATABASE connected_db;
--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
SHOW TABLES IN connected_db;
SHOW TABLES IN test;
USE test;
DROP TABLE t1;
DROP DATABASE connected_db;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
--echo
--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
CREATE DATABASE test1;
USE test1;
USE test1;
# Following statements should be filtered.
CREATE TABLE connected_db.t1 (i INT);
EOF
--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db.sql
SHOW TABLES IN test;
SHOW TABLES IN test1;
DROP DATABASE test1;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
--echo
--echo #
--echo # Checking --one-database option followed by the execution of
--echo # connect command.
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
CREATE TABLE t1 (i INT);
CREATE TABLE test.t1 (i INT);
CONNECT test;
CREATE TABLE connected_db.t2 (i INT);
CREATE TABLE t2 (i INT);
USE connected_db;
# Following statements should be filtered.
CREATE TABLE connected_db.t3 (i INT);
CREATE TABLE t3 (i INT);
EOF
CREATE DATABASE connected_db;
--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
SHOW TABLES IN connected_db;
SHOW TABLES IN test;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP DATABASE connected_db;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
--echo
--echo #
--echo # Checking --one-database option with no database specified
--echo # at command-line.
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
# All following statements should be filtered.
CREATE TABLE t1 (i INT);
CREATE TABLE test.t1 (i INT);
USE test;
CREATE TABLE test.t2 (i INT);
CREATE TABLE t2 (i INT);
EOF
--exec $MYSQL --one-database < $MYSQLTEST_VARDIR/tmp/one_db.sql
SHOW TABLES IN test;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
--echo
--echo #
--echo # Checking --one-database option with non_existent_db
--echo # specified with USE command
--echo #
# CASE 1 : When 'test' database exists and passed at commandline.
--write_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
CREATE TABLE `table_in_test`(i INT);
USE non_existent_db;
# Following statement should be filtered out.
CREATE TABLE `table_in_non_existent_db`(i INT);
EOF
# CASE 2 : When 'test' database exists but dropped and recreated in load file.
--write_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
DROP DATABASE test;
CREATE DATABASE test;
USE non_existent_db;
# Following statements should be filtered out.
CREATE TABLE `table_in_non_existent_db`(i INT);
USE test;
# Following statements should not be filtered out.
CREATE TABLE `table_in_test`(i INT);
EOF
--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db_1.sql
SHOW TABLES IN test;
DROP DATABASE test;
--echo
CREATE DATABASE test;
--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db_2.sql
SHOW TABLES IN test;
DROP DATABASE test;
CREATE DATABASE test;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
--echo
--echo End of tests

View file

@ -1330,6 +1330,34 @@ protected:
};
#ifndef DBUG_OFF
class Create_func_like_range_min : public Create_func_arg2
{
public:
virtual Item *create(THD *thd, Item *arg1, Item *arg2);
static Create_func_like_range_min s_singleton;
protected:
Create_func_like_range_min() {}
virtual ~Create_func_like_range_min() {}
};
class Create_func_like_range_max : public Create_func_arg2
{
public:
virtual Item *create(THD *thd, Item *arg1, Item *arg2);
static Create_func_like_range_max s_singleton;
protected:
Create_func_like_range_max() {}
virtual ~Create_func_like_range_max() {}
};
#endif
class Create_func_ln : public Create_func_arg1
{
public:
@ -3836,6 +3864,26 @@ Create_func_length::create(THD *thd, Item *arg1)
}
#ifndef DBUG_OFF
Create_func_like_range_min Create_func_like_range_min::s_singleton;
Item*
Create_func_like_range_min::create(THD *thd, Item *arg1, Item *arg2)
{
return new (thd->mem_root) Item_func_like_range_min(arg1, arg2);
}
Create_func_like_range_max Create_func_like_range_max::s_singleton;
Item*
Create_func_like_range_max::create(THD *thd, Item *arg1, Item *arg2)
{
return new (thd->mem_root) Item_func_like_range_max(arg1, arg2);
}
#endif
Create_func_ln Create_func_ln::s_singleton;
Item*
@ -4924,6 +4972,10 @@ static Native_func_registry func_array[] =
{ { C_STRING_WITH_LEN("LCASE") }, BUILDER(Create_func_lcase)},
{ { C_STRING_WITH_LEN("LEAST") }, BUILDER(Create_func_least)},
{ { C_STRING_WITH_LEN("LENGTH") }, BUILDER(Create_func_length)},
#ifndef DBUG_OFF
{ { C_STRING_WITH_LEN("LIKE_RANGE_MIN") }, BUILDER(Create_func_like_range_min)},
{ { C_STRING_WITH_LEN("LIKE_RANGE_MAX") }, BUILDER(Create_func_like_range_max)},
#endif
{ { C_STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
{ { C_STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
{ { C_STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},

View file

@ -3170,6 +3170,41 @@ String *Item_func_unhex::val_str(String *str)
}
#ifndef DBUG_OFF
String *Item_func_like_range::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
longlong nbytes= args[1]->val_int();
String *res= args[0]->val_str(str);
size_t min_len, max_len;
CHARSET_INFO *cs= collation.collation;
if (!res || args[0]->null_value || args[1]->null_value ||
nbytes < 0 || nbytes > MAX_BLOB_WIDTH ||
min_str.alloc(nbytes) || max_str.alloc(nbytes))
goto err;
null_value=0;
if (cs->coll->like_range(cs, res->ptr(), res->length(),
'\\', '_', '%', nbytes,
(char*) min_str.ptr(), (char*) max_str.ptr(),
&min_len, &max_len))
goto err;
min_str.set_charset(collation.collation);
max_str.set_charset(collation.collation);
min_str.length(min_len);
max_str.length(max_len);
return is_min ? &min_str : &max_str;
err:
null_value= 1;
return 0;
}
#endif
void Item_func_binary::print(String *str, enum_query_type query_type)
{
str->append(STRING_WITH_LEN("cast("));

View file

@ -657,6 +657,46 @@ public:
};
#ifndef DBUG_OFF
class Item_func_like_range :public Item_str_func
{
protected:
String min_str;
String max_str;
const bool is_min;
public:
Item_func_like_range(Item *a, Item *b, bool is_min_arg)
:Item_str_func(a, b), is_min(is_min_arg)
{ maybe_null= 1; }
String *val_str(String *);
void fix_length_and_dec()
{
collation.set(args[0]->collation);
decimals=0;
max_length= MAX_BLOB_WIDTH;
}
};
class Item_func_like_range_min :public Item_func_like_range
{
public:
Item_func_like_range_min(Item *a, Item *b)
:Item_func_like_range(a, b, true) { }
const char *func_name() const { return "like_range_min"; }
};
class Item_func_like_range_max :public Item_func_like_range
{
public:
Item_func_like_range_max(Item *a, Item *b)
:Item_func_like_range(a, b, false) { }
const char *func_name() const { return "like_range_max"; }
};
#endif
class Item_func_binary :public Item_str_func
{
public:

View file

@ -98,7 +98,7 @@
0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
0402 0403 201A 0453 201E 2026 2020 2021 20AC 2030 0409 2039 040A 040C 040B 040F
0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457

View file

@ -1040,7 +1040,7 @@ uint16 to_uni_cp1251_bulgarian_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@ -1730,7 +1730,7 @@ uint16 to_uni_cp1251_ukrainian_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@ -3762,7 +3762,7 @@ uint16 to_uni_cp1251_bin[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@ -3877,7 +3877,7 @@ uint16 to_uni_cp1251_general_ci[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
@ -3992,7 +3992,7 @@ uint16 to_uni_cp1251_general_cs[] = {
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
0x0000,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
0x0000,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,

View file

@ -636,7 +636,7 @@ static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
DBUG_ASSERT(buflen > 0);
do
{
if ((str + buflen) < end)
if ((str + buflen) <= end)
{
/* Enough space for the characer */
memcpy(str, buf, buflen);
@ -802,6 +802,192 @@ fill_max_and_min:
}
/**
Calculate min_str and max_str that ranges a LIKE string.
Generic function, currently used for ucs2, utf16, utf32,
but should be suitable for any other character sets with
cs->min_sort_char and cs->max_sort_char represented in
Unicode code points.
@param cs Character set and collation pointer
@param ptr Pointer to LIKE pattern.
@param ptr_length Length of LIKE pattern.
@param escape Escape character pattern, typically '\'.
@param w_one 'One character' pattern, typically '_'.
@param w_many 'Many characters' pattern, typically '%'.
@param res_length Length of min_str and max_str.
@param[out] min_str Smallest string that ranges LIKE.
@param[out] max_str Largest string that ranges LIKE.
@param[out] min_len Length of min_str
@param[out] max_len Length of max_str
@return Optimization status.
@retval FALSE if LIKE pattern can be optimized
@rerval TRUE if LIKE can't be optimized.
*/
my_bool
my_like_range_generic(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str,char *max_str,
size_t *min_length,size_t *max_length)
{
const char *end= ptr + ptr_length;
const char *min_org= min_str;
const char *max_org= max_str;
char *min_end= min_str + res_length;
char *max_end= max_str + res_length;
size_t charlen= res_length / cs->mbmaxlen;
size_t res_length_diff;
my_bool have_contractions= my_cs_have_contractions(cs);
for ( ; charlen > 0; charlen--)
{
my_wc_t wc, wc2;
int res;
if ((res= cs->cset->mb_wc(cs, &wc, (uchar*) ptr, (uchar*) end)) <= 0)
{
if (res == MY_CS_ILSEQ) /* Bad sequence */
return TRUE; /* min_length and max_length are not important */
break; /* End of the string */
}
ptr+= res;
if (wc == (my_wc_t) escape)
{
if ((res= cs->cset->mb_wc(cs, &wc, (uchar*) ptr, (uchar*) end)) <= 0)
{
if (res == MY_CS_ILSEQ)
return TRUE; /* min_length and max_length are not important */
/*
End of the string: Escape is the last character.
Put escape as a normal character.
We'll will leave the loop on the next iteration.
*/
}
else
ptr+= res;
/* Put escape character to min_str and max_str */
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) min_str, (uchar*) min_end)) <= 0)
goto pad_set_lengths; /* No space */
min_str+= res;
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) max_str, (uchar*) max_end)) <= 0)
goto pad_set_lengths; /* No space */
max_str+= res;
continue;
}
else if (wc == (my_wc_t) w_one)
{
if ((res= cs->cset->wc_mb(cs, cs->min_sort_char,
(uchar*) min_str, (uchar*) min_end)) <= 0)
goto pad_set_lengths;
min_str+= res;
if ((res= cs->cset->wc_mb(cs, cs->max_sort_char,
(uchar*) max_str, (uchar*) max_end)) <= 0)
goto pad_set_lengths;
max_str+= res;
continue;
}
else if (wc == (my_wc_t) w_many)
{
/*
Calculate length of keys:
a\min\min... is the smallest possible string
a\max\max... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ?
(size_t) (min_str - min_org) :
res_length);
*max_length= res_length;
goto pad_min_max;
}
if (have_contractions &&
my_cs_can_be_contraction_head(cs, wc) &&
(res= cs->cset->mb_wc(cs, &wc2, (uchar*) ptr, (uchar*) end)) > 0)
{
uint16 *weight;
if ((wc2 == (my_wc_t) w_one || wc2 == (my_wc_t) w_many))
{
/* Contraction head followed by a wildcard */
*min_length= *max_length= res_length;
goto pad_min_max;
}
if (my_cs_can_be_contraction_tail(cs, wc2) &&
(weight= my_cs_contraction2_weight(cs, wc, wc2)) && weight[0])
{
/* Contraction found */
if (charlen == 1)
{
/* contraction does not fit to result */
*min_length= *max_length= res_length;
goto pad_min_max;
}
ptr+= res;
charlen--;
/* Put contraction head */
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) min_str, (uchar*) min_end)) <= 0)
goto pad_set_lengths;
min_str+= res;
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) max_str, (uchar*) max_end)) <= 0)
goto pad_set_lengths;
max_str+= res;
wc= wc2; /* Prepare to put contraction tail */
}
}
/* Normal character, or contraction tail */
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) min_str, (uchar*) min_end)) <= 0)
goto pad_set_lengths;
min_str+= res;
if ((res= cs->cset->wc_mb(cs, wc,
(uchar*) max_str, (uchar*) max_end)) <= 0)
goto pad_set_lengths;
max_str+= res;
}
pad_set_lengths:
*min_length= (size_t) (min_str - min_org);
*max_length= (size_t) (max_str - max_org);
pad_min_max:
/*
Fill up max_str and min_str to res_length.
fill() cannot set incomplete characters and
requires that "length" argument is divisible to mbminlen.
Make sure to call fill() with proper "length" argument.
*/
res_length_diff= res_length % cs->mbminlen;
cs->cset->fill(cs, min_str, min_end - min_str - res_length_diff,
cs->min_sort_char);
cs->cset->fill(cs, max_str, max_end - max_str - res_length_diff,
cs->max_sort_char);
/* In case of incomplete characters set the remainder to 0x00's */
if (res_length_diff)
{
/* Example: odd res_length for ucs2 */
memset(min_end - res_length_diff, 0, res_length_diff);
memset(max_end - res_length_diff, 0, res_length_diff);
}
return FALSE;
}
int
my_wildcmp_mb_bin(CHARSET_INFO *cs,
const char *str,const char *str_end,

View file

@ -8127,7 +8127,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_strnncollsp_ucs2_uca,
my_strnxfrm_ucs2_uca,
my_strnxfrmlen_simple,
my_like_range_ucs2,
my_like_range_generic,
my_wildcmp_uca,
NULL,
my_instr_mb,
@ -10134,7 +10134,7 @@ MY_COLLATION_HANDLER my_collation_utf32_uca_handler =
my_strnncollsp_any_uca,
my_strnxfrm_any_uca,
my_strnxfrmlen_simple,
my_like_range_utf32,
my_like_range_generic,
my_wildcmp_uca,
NULL,
my_instr_mb,
@ -10801,7 +10801,7 @@ MY_COLLATION_HANDLER my_collation_utf16_uca_handler =
my_strnncollsp_any_uca,
my_strnxfrm_any_uca,
my_strnxfrmlen_simple,
my_like_range_utf16,
my_like_range_generic,
my_wildcmp_uca,
NULL,
my_instr_mb,

View file

@ -903,7 +903,8 @@ static void
my_fill_mb2(CHARSET_INFO *cs __attribute__((unused)),
char *s, size_t l, int fill)
{
for ( ; l >= 2; s[0]= 0, s[1]= fill, s+= 2, l-= 2);
DBUG_ASSERT(fill <= 0xFFFF);
for ( ; l >= 2; s[0]= (fill >> 8), s[1]= (fill & 0xFF), s+= 2, l-= 2);
}
@ -1563,98 +1564,6 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs __attribute__((unused)),
}
/**
Calculate min_str and max_str that ranges a LIKE string.
@param ptr Pointer to LIKE pattern.
@param ptr_length Length of LIKE pattern.
@param escape Escape character in LIKE. (Normally '\').
All escape characters should be removed
from min_str and max_str.
@param res_length Length of min_str and max_str.
@param min_str Smallest case sensitive string that ranges LIKE.
Should be space padded to res_length.
@param max_str Largest case sensitive string that ranges LIKE.
Normally padded with the biggest character sort value.
@return Optimization status.
@retval FALSE if LIKE pattern can be optimized
@rerval TRUE if LIKE can't be optimized.
*/
my_bool
my_like_range_utf16(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str,char *max_str,
size_t *min_length,size_t *max_length)
{
const char *end=ptr+ptr_length;
char *min_org=min_str;
char *min_end=min_str+res_length;
size_t charlen= res_length / cs->mbmaxlen;
for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0
; ptr+=2, charlen--)
{
if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end)
{
ptr+=2; /* Skip escape */
*min_str++= *max_str++ = ptr[0];
*min_str++= *max_str++ = ptr[1];
continue;
}
if (ptr[0] == '\0' && ptr[1] == w_one) /* '_' in SQL */
{
*min_str++= (char) (cs->min_sort_char >> 8);
*min_str++= (char) (cs->min_sort_char & 255);
*max_str++= (char) (cs->max_sort_char >> 8);
*max_str++= (char) (cs->max_sort_char & 255);
continue;
}
if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */
{
/*
Calculate length of keys:
'a\0\0... is the smallest possible string when we have space expand
a\ff\ff... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
res_length);
*max_length= res_length;
do {
*min_str++ = 0;
*min_str++ = 0;
*max_str++ = (char) (cs->max_sort_char >> 8);
*max_str++ = (char) (cs->max_sort_char & 255);
} while (min_str + 1 < min_end);
return FALSE;
}
*min_str++= *max_str++ = ptr[0];
*min_str++= *max_str++ = ptr[1];
}
/* Temporary fix for handling w_one at end of string (key compression) */
{
char *tmp;
for (tmp= min_str ; tmp-1 > min_org && tmp[-1] == '\0' && tmp[-2]=='\0';)
{
*--tmp=' ';
*--tmp='\0';
}
}
*min_length= *max_length = (size_t) (min_str - min_org);
while (min_str + 1 < min_end)
{
*min_str++ = *max_str++ = '\0';
*min_str++ = *max_str++ = ' '; /* Because if key compression */
}
return FALSE;
}
static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler =
{
NULL, /* init */
@ -1662,7 +1571,7 @@ static MY_COLLATION_HANDLER my_collation_utf16_general_ci_handler =
my_strnncollsp_utf16,
my_strnxfrm_unicode,
my_strnxfrmlen_simple,
my_like_range_utf16,
my_like_range_generic,
my_wildcmp_utf16_ci,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,
@ -1678,7 +1587,7 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler =
my_strnncollsp_utf16_bin,
my_strnxfrm_unicode_full_bin,
my_strnxfrmlen_unicode_full_bin,
my_like_range_utf16,
my_like_range_generic,
my_wildcmp_utf16_bin,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,
@ -2551,113 +2460,6 @@ my_strnncollsp_utf32_bin(CHARSET_INFO *cs __attribute__((unused)),
}
/**
Calculate min_str and max_str that ranges a LIKE string.
@param ptr Pointer to LIKE pattern.
@param ptr_length Length of LIKE pattern.
@param escape Escape character in LIKE. (Normally '\').
All escape characters should be removed
from min_str and max_str.
@param res_length Length of min_str and max_str.
@param min_str Smallest case sensitive string that ranges LIKE.
Should be space padded to res_length.
@param max_str Largest case sensitive string that ranges LIKE.
Normally padded with the biggest character sort value.
@return Optimization status.
@retval FALSE if LIKE pattern can be optimized
@rerval TRUE if LIKE can't be optimized.
*/
my_bool
my_like_range_utf32(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str,char *max_str,
size_t *min_length,size_t *max_length)
{
const char *end= ptr + ptr_length;
char *min_org= min_str;
char *min_end= min_str + res_length;
char *max_end= max_str + res_length;
size_t charlen= res_length / cs->mbmaxlen;
DBUG_ASSERT((res_length % 4) == 0);
for ( ; charlen > 0; ptr+= 4, charlen--)
{
my_wc_t wc;
int res;
if ((res= my_utf32_uni(cs, &wc, (uchar*) ptr, (uchar*) end)) < 0)
{
my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char);
my_fill_utf32(cs, max_str, min_end - min_str, cs->max_sort_char);
/* min_length and max_legnth are not important */
return TRUE;
}
if (wc == (my_wc_t) escape)
{
ptr+= 4; /* Skip escape */
if ((res= my_utf32_uni(cs, &wc, (uchar*) ptr, (uchar*) end)) < 0)
{
my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char);
my_fill_utf32(cs, max_str, max_end - min_str, cs->max_sort_char);
/* min_length and max_length are not important */
return TRUE;
}
if (my_uni_utf32(cs, wc, (uchar*) min_str, (uchar*) min_end) != 4 ||
my_uni_utf32(cs, wc, (uchar*) max_str, (uchar*) max_end) != 4)
goto pad_set_lengths;
*min_str++= 4;
*max_str++= 4;
continue;
}
if (wc == (my_wc_t) w_one)
{
if (my_uni_utf32(cs, cs->min_sort_char, (uchar*) min_str, (uchar*) min_end) != 4 ||
my_uni_utf32(cs, cs->max_sort_char, (uchar*) max_str, (uchar*) max_end) != 4)
goto pad_set_lengths;
min_str+= 4;
max_str+= 4;
continue;
}
if (wc == (my_wc_t) w_many)
{
/*
Calculate length of keys:
'a\0\0... is the smallest possible string when we have space expand
a\ff\ff... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ?
(size_t) (min_str - min_org) :
res_length);
*max_length= res_length;
goto pad_min_max;
}
/* Normal character */
if (my_uni_utf32(cs, wc, (uchar*) min_str, (uchar*) min_end) != 4 ||
my_uni_utf32(cs, wc, (uchar*) max_str, (uchar*) max_end) != 4)
goto pad_set_lengths;
min_str+= 4;
max_str+= 4;
}
pad_set_lengths:
*min_length= *max_length= (size_t) (min_str - min_org);
pad_min_max:
my_fill_utf32(cs, min_str, min_end - min_str, cs->min_sort_char);
my_fill_utf32(cs, max_str, max_end - max_str, cs->max_sort_char);
return FALSE;
}
static size_t
my_scan_utf32(CHARSET_INFO *cs,
const char *str, const char *end, int sequence_type)
@ -2689,7 +2491,7 @@ static MY_COLLATION_HANDLER my_collation_utf32_general_ci_handler =
my_strnncollsp_utf32,
my_strnxfrm_unicode,
my_strnxfrmlen_utf32,
my_like_range_utf32,
my_like_range_generic,
my_wildcmp_utf32_ci,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,
@ -2705,7 +2507,7 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler =
my_strnncollsp_utf32_bin,
my_strnxfrm_unicode_full_bin,
my_strnxfrmlen_unicode_full_bin,
my_like_range_utf32,
my_like_range_generic,
my_wildcmp_utf32_bin,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,
@ -3252,120 +3054,6 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)),
}
}
/*
** Calculate min_str and max_str that ranges a LIKE string.
** Arguments:
** ptr Pointer to LIKE string.
** ptr_length Length of LIKE string.
** escape Escape character in LIKE. (Normally '\').
** All escape characters should be removed from min_str and max_str
** res_length Length of min_str and max_str.
** min_str Smallest case sensitive string that ranges LIKE.
** Should be space padded to res_length.
** max_str Largest case sensitive string that ranges LIKE.
** Normally padded with the biggest character sort value.
**
** The function should return 0 if ok and 1 if the LIKE string can't be
** optimized !
*/
my_bool my_like_range_ucs2(CHARSET_INFO *cs,
const char *ptr, size_t ptr_length,
pbool escape, pbool w_one, pbool w_many,
size_t res_length,
char *min_str,char *max_str,
size_t *min_length,size_t *max_length)
{
const char *end=ptr+ptr_length;
char *min_org=min_str;
char *min_end=min_str+res_length;
size_t charlen= res_length / cs->mbmaxlen;
const char *contraction_flags= cs->contractions ?
((const char*) cs->contractions) + 0x40*0x40 : NULL;
for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0
; ptr+=2, charlen--)
{
if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end)
{
ptr+=2; /* Skip escape */
*min_str++= *max_str++ = ptr[0];
*min_str++= *max_str++ = ptr[1];
continue;
}
if (ptr[0] == '\0' && ptr[1] == w_one) /* '_' in SQL */
{
*min_str++= (char) (cs->min_sort_char >> 8);
*min_str++= (char) (cs->min_sort_char & 255);
*max_str++= (char) (cs->max_sort_char >> 8);
*max_str++= (char) (cs->max_sort_char & 255);
continue;
}
if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */
{
fill_max_and_min:
/*
Calculate length of keys:
'a\0\0... is the smallest possible string when we have space expand
a\ff\ff... is the biggest possible string
*/
*min_length= ((cs->state & MY_CS_BINSORT) ? (size_t) (min_str - min_org) :
res_length);
*max_length= res_length;
do {
*min_str++ = 0;
*min_str++ = 0;
*max_str++ = (char) (cs->max_sort_char >> 8);
*max_str++ = (char) (cs->max_sort_char & 255);
} while (min_str + 1 < min_end);
return 0;
}
if (contraction_flags && ptr + 3 < end &&
ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]])
{
/* Contraction head found */
if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many))
{
/* Contraction head followed by a wildcard, quit */
goto fill_max_and_min;
}
/*
Check if the second letter can be contraction part,
and if two letters really produce a contraction.
*/
if (ptr[2] == '\0' && contraction_flags[(uchar) ptr[3]] &&
cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40])
{
/* Contraction found */
if (charlen == 1 || min_str + 2 >= min_end)
{
/* Full contraction doesn't fit, quit */
goto fill_max_and_min;
}
/* Put contraction head */
*min_str++= *max_str++= *ptr++;
*min_str++= *max_str++= *ptr++;
charlen--;
}
}
/* Put contraction tail, or a single character */
*min_str++= *max_str++ = ptr[0];
*min_str++= *max_str++ = ptr[1];
}
*min_length= *max_length = (size_t) (min_str - min_org);
while (min_str + 1 < min_end)
{
*min_str++ = *max_str++ = '\0';
*min_str++ = *max_str++ = ' '; /* Because if key compression */
}
return 0;
}
static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
{
@ -3374,7 +3062,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
my_strnncollsp_ucs2,
my_strnxfrm_unicode,
my_strnxfrmlen_simple,
my_like_range_ucs2,
my_like_range_generic,
my_wildcmp_ucs2_ci,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,
@ -3390,7 +3078,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
my_strnncollsp_ucs2_bin,
my_strnxfrm_unicode,
my_strnxfrmlen_simple,
my_like_range_ucs2,
my_like_range_generic,
my_wildcmp_ucs2_bin,
my_strcasecmp_mb2_or_mb4,
my_instr_mb,