summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2021-09-08 11:42:42 +0400
committerAlexander Barkov <bar@mariadb.com>2021-09-13 08:03:25 +0400
commit0629711db43ec489a360d8f689b72fac66a2470b (patch)
treeca6e5515ff30c819c0cf305f24f981f0a26e18c8
parent4be366111b5bca25643574737b6a0ee17c05cce3 (diff)
downloadmariadb-git-bb-10.7-bar-MDEV-26572.tar.gz
MDEV-26572 Improve simple multibyte collation performance on the ASCII rangebb-10.7-bar-MDEV-26572
-rw-r--r--mysql-test/include/ctype_ascii_order.inc7
-rw-r--r--mysql-test/main/ctype_big5.result194
-rw-r--r--mysql-test/main/ctype_big5.test1
-rw-r--r--mysql-test/main/ctype_cp932.result275
-rw-r--r--mysql-test/main/ctype_cp932.test9
-rw-r--r--mysql-test/main/ctype_eucjpms.result275
-rw-r--r--mysql-test/main/ctype_eucjpms.test8
-rw-r--r--mysql-test/main/ctype_euckr.result270
-rw-r--r--mysql-test/main/ctype_euckr.test2
-rw-r--r--mysql-test/main/ctype_gb2312.result194
-rw-r--r--mysql-test/main/ctype_gb2312.test1
-rw-r--r--mysql-test/main/ctype_gbk.result194
-rw-r--r--mysql-test/main/ctype_gbk.test1
-rw-r--r--mysql-test/main/ctype_sjis.result270
-rw-r--r--mysql-test/main/ctype_sjis.test2
-rw-r--r--mysql-test/main/ctype_tis620.result46
-rw-r--r--mysql-test/main/ctype_ujis.result276
-rw-r--r--mysql-test/main/ctype_ujis.test10
-rw-r--r--strings/ctype-ascii.h189
-rw-r--r--strings/ctype-big5.c2
-rw-r--r--strings/ctype-cp932.c4
-rw-r--r--strings/ctype-euc_kr.c4
-rw-r--r--strings/ctype-eucjpms.c4
-rw-r--r--strings/ctype-gb2312.c2
-rw-r--r--strings/ctype-gbk.c2
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-ujis.c4
-rw-r--r--strings/ctype-utf8.c297
-rw-r--r--strings/strcoll.ic96
29 files changed, 2621 insertions, 22 deletions
diff --git a/mysql-test/include/ctype_ascii_order.inc b/mysql-test/include/ctype_ascii_order.inc
index 93127a7195f..b85cab687ae 100644
--- a/mysql-test/include/ctype_ascii_order.inc
+++ b/mysql-test/include/ctype_ascii_order.inc
@@ -4,11 +4,16 @@ drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
drop table t1;
+drop view v1;
diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result
index 66d4bb54023..2bea9cd2619 100644
--- a/mysql-test/main/ctype_big5.result
+++ b/mysql-test/main/ctype_big5.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 big5_chinese_ci
+name big5_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -321,8 +360,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
@@ -479,6 +519,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 big5_bin
+name big5_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SELECT strcmp('a','a '), strcmp('a ','a');
strcmp('a','a ') strcmp('a ','a')
0 0
diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test
index 41991258886..385f1c21439 100644
--- a/mysql-test/main/ctype_big5.test
+++ b/mysql-test/main/ctype_big5.test
@@ -24,6 +24,7 @@ SET collation_connection='big5_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
-- source include/ctype_pad_space.inc
#
diff --git a/mysql-test/main/ctype_cp932.result b/mysql-test/main/ctype_cp932.result
index 952130cf11c..ff1dd814970 100644
--- a/mysql-test/main/ctype_cp932.result
+++ b/mysql-test/main/ctype_cp932.result
@@ -598,6 +598,281 @@ SET DEFAULT_STORAGE_ENGINE=Default;
# End of 10.2 tests
#
#
+# General tests
+#
+SET NAMES cp932;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 cp932_japanese_ci
+name cp932_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES cp932 COLLATE cp932_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 cp932_bin
+name cp932_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+#
# Start of 10.5 tests
#
#
diff --git a/mysql-test/main/ctype_cp932.test b/mysql-test/main/ctype_cp932.test
index 0f5ff437d33..2ccbe8f1582 100644
--- a/mysql-test/main/ctype_cp932.test
+++ b/mysql-test/main/ctype_cp932.test
@@ -50,6 +50,15 @@ let $coll_pad='cp932_bin';
--echo #
+--echo # General tests
+--echo #
+SET NAMES cp932;
+-- source include/ctype_ascii_order.inc
+SET NAMES cp932 COLLATE cp932_bin;
+-- source include/ctype_ascii_order.inc
+
+
+--echo #
--echo # Start of 10.5 tests
--echo #
diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result
index db445838102..a7688be6ad0 100644
--- a/mysql-test/main/ctype_eucjpms.result
+++ b/mysql-test/main/ctype_eucjpms.result
@@ -2,6 +2,281 @@ drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
drop table if exists t4;
+#
+# General tests
+#
+SET NAMES eucjpms;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 eucjpms_japanese_ci
+name eucjpms_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES eucjpms COLLATE eucjpms_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 eucjpms_bin
+name eucjpms_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
set names eucjpms;
set character_set_database = eucjpms;
CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
diff --git a/mysql-test/main/ctype_eucjpms.test b/mysql-test/main/ctype_eucjpms.test
index 6af72270853..393534182dc 100644
--- a/mysql-test/main/ctype_eucjpms.test
+++ b/mysql-test/main/ctype_eucjpms.test
@@ -8,6 +8,14 @@ drop table if exists t3;
drop table if exists t4;
--enable_warnings
+--echo #
+--echo # General tests
+--echo #
+SET NAMES eucjpms;
+-- source include/ctype_ascii_order.inc
+SET NAMES eucjpms COLLATE eucjpms_bin;
+-- source include/ctype_ascii_order.inc
+
set names eucjpms;
set character_set_database = eucjpms;
diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result
index 37b7e86543f..f349b9c25e0 100644
--- a/mysql-test/main/ctype_euckr.result
+++ b/mysql-test/main/ctype_euckr.result
@@ -243,6 +243,128 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 euckr_korean_ci
+name euckr_korean_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET collation_connection='euckr_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -384,6 +506,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 euckr_bin
+name euckr_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES euckr;
CREATE TABLE t1 (a text) character set euckr;
INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
diff --git a/mysql-test/main/ctype_euckr.test b/mysql-test/main/ctype_euckr.test
index 1154047fdb0..e4f07081dba 100644
--- a/mysql-test/main/ctype_euckr.test
+++ b/mysql-test/main/ctype_euckr.test
@@ -17,11 +17,13 @@ SET collation_connection='euckr_korean_ci';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
SET collation_connection='euckr_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#15377 Valid multibyte sequences are truncated on INSERT
diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result
index 42a837b37e1..cdfe6370784 100644
--- a/mysql-test/main/ctype_gb2312.result
+++ b/mysql-test/main/ctype_gb2312.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gb2312_chinese_ci
+name gb2312_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -322,8 +361,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SET collation_connection='gb2312_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -465,6 +505,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gb2312_bin
+name gb2312_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES gb2312;
CREATE TABLE t1 (a text) character set gb2312;
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
diff --git a/mysql-test/main/ctype_gb2312.test b/mysql-test/main/ctype_gb2312.test
index 07460116ade..6224b8c1cf1 100644
--- a/mysql-test/main/ctype_gb2312.test
+++ b/mysql-test/main/ctype_gb2312.test
@@ -23,6 +23,7 @@ SET collation_connection='gb2312_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#15377 Valid multibyte sequences are truncated on INSERT
diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result
index 23ca646da9a..39c31882387 100644
--- a/mysql-test/main/ctype_gbk.result
+++ b/mysql-test/main/ctype_gbk.result
@@ -246,14 +246,53 @@ DROP TABLE t1;
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gbk_chinese_ci
+name gbk_chinese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
! 21
" 22
@@ -322,8 +361,9 @@ _ 5F
{ 7B
| 7C
} 7D
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
SET collation_connection='gbk_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -465,6 +505,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 gbk_bin
+name gbk_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES gbk;
CREATE TABLE t1 (a text) character set gbk;
INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test
index d68b78f847c..808bea53e42 100644
--- a/mysql-test/main/ctype_gbk.test
+++ b/mysql-test/main/ctype_gbk.test
@@ -23,6 +23,7 @@ SET collation_connection='gbk_bin';
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
#
# Bug#11987 mysql will truncate the text when
diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result
index 36411914e86..8f21e87c507 100644
--- a/mysql-test/main/ctype_sjis.result
+++ b/mysql-test/main/ctype_sjis.result
@@ -231,6 +231,128 @@ SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1;
HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern)
323030318180303181803031 25598180256D81802564 2001-01-01 00:00:00.000000
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 sjis_japanese_ci
+name sjis_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET collation_connection='sjis_bin';
create table t1 select repeat('a',4000) a;
delete from t1;
@@ -372,6 +494,154 @@ a hex(b) c
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL
DROP TABLE t1;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 sjis_bin
+name sjis_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
SET NAMES sjis;
SELECT HEX('²“‘@Œ\') FROM DUAL;
HEX('²“‘@Œ\')
diff --git a/mysql-test/main/ctype_sjis.test b/mysql-test/main/ctype_sjis.test
index 8ca423bb7c1..d255b6267fd 100644
--- a/mysql-test/main/ctype_sjis.test
+++ b/mysql-test/main/ctype_sjis.test
@@ -70,11 +70,13 @@ SET collation_connection='sjis_japanese_ci';
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
-- source include/ctype_str_to_date.inc
+-- source include/ctype_ascii_order.inc
SET collation_connection='sjis_bin';
-- source include/ctype_filesort.inc
-- source include/ctype_innodb_like.inc
-- source include/ctype_like_escape.inc
-- source include/ctype_like_range_f1f2.inc
+-- source include/ctype_ascii_order.inc
# Check parsing of string literals in SJIS with multibyte characters that
# have an embedded \ in them. (Bug #8303)
diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result
index 7e0c255c756..ff1d5927651 100644
--- a/mysql-test/main/ctype_tis620.result
+++ b/mysql-test/main/ctype_tis620.result
@@ -3042,15 +3042,54 @@ SELECT '\%b' LIKE '%\%';
drop table if exists t1;
create table t1 select repeat('a',10) as c1;
delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1;
-GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 tis620_thai_ci
+name tis620_thai_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
20
+<00> 00
! 21
" 22
# 23
@@ -3119,8 +3158,9 @@ Zz 5A,7A
| 7C
} 7D
~ 7E
- 7F
+<7F> 7F
drop table t1;
+drop view v1;
#
# MDEV-7149 Constant condition propagation erroneously applied for LIKE
#
diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result
index 8895770191d..bebe962fca4 100644
--- a/mysql-test/main/ctype_ujis.result
+++ b/mysql-test/main/ctype_ujis.result
@@ -1,5 +1,281 @@
drop table if exists t1;
set names ujis;
+#
+# General tests
+#
+SET NAMES ujis;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 ujis_japanese_ci
+name ujis_japanese_ci
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+Aa 41,61
+Bb 42,62
+Cc 43,63
+Dd 44,64
+Ee 45,65
+Ff 46,66
+Gg 47,67
+Hh 48,68
+Ii 49,69
+Jj 4A,6A
+Kk 4B,6B
+Ll 4C,6C
+Mm 4D,6D
+Nn 4E,6E
+Oo 4F,6F
+Pp 50,70
+Qq 51,71
+Rr 52,72
+Ss 53,73
+Tt 54,74
+Uu 55,75
+Vv 56,76
+Ww 57,77
+Xx 58,78
+Yy 59,79
+Zz 5A,7A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES ujis COLLATE ujis_bin;
+drop table if exists t1;
+create table t1 select repeat('a',10) as c1;
+delete from t1;
+insert into t1 values (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07),(0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
+insert into t1 values (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17),(0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
+insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
+insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
+insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
+insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
+insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
+insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
+create view v1 as select c1, if(c1 < 0x20 OR c1=0x7F, concat('<',hex(c1),'>'),c1) as name from t1;
+select column_name, collation_name from information_schema.columns where table_schema=database() and table_name='v1';
+column_name collation_name
+c1 ujis_bin
+name ujis_bin
+SELECT GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM v1 GROUP BY c1;
+GROUP_CONCAT(name ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1)
+<00> 00
+<01> 01
+<02> 02
+<03> 03
+<04> 04
+<05> 05
+<06> 06
+<07> 07
+<08> 08
+<09> 09
+<0A> 0A
+<0B> 0B
+<0C> 0C
+<0D> 0D
+<0E> 0E
+<0F> 0F
+<10> 10
+<11> 11
+<12> 12
+<13> 13
+<14> 14
+<15> 15
+<16> 16
+<17> 17
+<18> 18
+<19> 19
+<1A> 1A
+<1B> 1B
+<1C> 1C
+<1D> 1D
+<1E> 1E
+<1F> 1F
+ 20
+! 21
+" 22
+# 23
+$ 24
+% 25
+& 26
+' 27
+( 28
+) 29
+* 2A
++ 2B
+, 2C
+- 2D
+. 2E
+/ 2F
+0 30
+1 31
+2 32
+3 33
+4 34
+5 35
+6 36
+7 37
+8 38
+9 39
+: 3A
+; 3B
+< 3C
+= 3D
+> 3E
+? 3F
+@ 40
+A 41
+B 42
+C 43
+D 44
+E 45
+F 46
+G 47
+H 48
+I 49
+J 4A
+K 4B
+L 4C
+M 4D
+N 4E
+O 4F
+P 50
+Q 51
+R 52
+S 53
+T 54
+U 55
+V 56
+W 57
+X 58
+Y 59
+Z 5A
+[ 5B
+\ 5C
+] 5D
+^ 5E
+_ 5F
+` 60
+a 61
+b 62
+c 63
+d 64
+e 65
+f 66
+g 67
+h 68
+i 69
+j 6A
+k 6B
+l 6C
+m 6D
+n 6E
+o 6F
+p 70
+q 71
+r 72
+s 73
+t 74
+u 75
+v 76
+w 77
+x 78
+y 79
+z 7A
+{ 7B
+| 7C
+} 7D
+~ 7E
+<7F> 7F
+drop table t1;
+drop view v1;
+SET NAMES ujis;
create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
diff --git a/mysql-test/main/ctype_ujis.test b/mysql-test/main/ctype_ujis.test
index 72a609edf39..7b77232738b 100644
--- a/mysql-test/main/ctype_ujis.test
+++ b/mysql-test/main/ctype_ujis.test
@@ -9,10 +9,20 @@ drop table if exists t1;
set names ujis;
+--echo #
+--echo # General tests
+--echo #
+
+SET NAMES ujis;
+-- source include/ctype_ascii_order.inc
+SET NAMES ujis COLLATE ujis_bin;
+-- source include/ctype_ascii_order.inc
+
#
# Test problem with LEFT()
#
+SET NAMES ujis;
create table t1 (c text character set ujis);
insert into t1 values (0xa4a2),(0xa4a3);
select hex(left(c,1)) from t1 group by c;
diff --git a/strings/ctype-ascii.h b/strings/ctype-ascii.h
new file mode 100644
index 00000000000..540d01b1a0d
--- /dev/null
+++ b/strings/ctype-ascii.h
@@ -0,0 +1,189 @@
+#ifndef CTYPE_ASCII_INCLUDED
+#define CTYPE_ASCII_INCLUDED
+
+#include "myisampack.h"
+
+/*
+ Magic expression. It uses the fact that for any byte value X in
+ the range 0..31 (0x00..0x1F) the expression (X+31)*5 returns
+ the 7th bit (0x80) set only for the following six (out of 32) values:
+ 0x00, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F.
+ These values correspond to offsets of non-letter characters
+ in the ASCII table:
+
+ The following macro sets the bit 0x20 for the following characters:
+ ---------------- --------------------------------
+ Magic bit 10000000000000000000000000011111
+ ASCII 0x00..0x1F ................................ Control
+ ASCII 0x20..0x3F ................................ Punctuation, digits
+ ASCII 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
+ ASCII 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~.
+ ---------------- --------------------------------
+ We shift the magic bit 0x80 right twice to make it 0x20.
+ So on the ranges [40..5F] and [60..7F] the expression
+ has the bit 0x20 set for all non-letter characters.
+ Note, other bits contain garbage.
+
+ Requirements:
+ All bytes must be in the range [00..7F],
+ to avoid overflow and carry to the next byte.
+*/
+#define MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC(i) \
+ (((((i)+0x1F1F1F1F1F1F1F1FULL) & 0x1F1F1F1F1F1F1F1F) * 5) >> 2)
+
+
+/*
+ The following macro returns the bit 0x20 set to:
+ - 1 for input bytes in the ranges [60..7F] or [E0..FF]
+ - 0 otherwise
+ Bytes in the ranges [40..7F] and [C0..FF] have the bit 0x40 set.
+ Bytes in the ranges [60..7F] and [E0..FF] have the bit 0x20 set.
+ Hex BinHi BinLo
+ ---- -1-- ----
+ 0x[4C]X .10. ....
+ 0x[5D]X .10. ....
+ 0x[6E]X .11. ....
+ 0x[7F]X .11. ....
+*/
+#define MY_ASCII_20_IS_SET_IF_RANGE_60_7F_OR_E0_FF(i) (((i) >> 1) & ((i)))
+
+
+/*
+ The following macro evaluates to exactly 0x20 for all
+ lower case ASCII letters [a-z], and to 0x00 otherwise:
+
+ Value Range Character range Subrange
+ -------- -------- -------------------------------- -------
+ 00000000 0x00..0x3F Control, punctuation, digits
+ 00100000 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ letters A-Z
+ 00000000 0x40..0x5F @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ non-letters
+ 00100000 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~. letters a-z
+ 00000000 0x60..0x7F `abcdefghijklmnopqrstuvwxyz{|}~. non-letters
+
+ Requirements:
+ All bytes must be in the range [00..7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC().
+*/
+
+#define MY_ASCII_20_IF_IS_LOWER_LETTER(i) \
+ (MY_ASCII_20_IS_SET_IF_RANGE_60_7F_OR_E0_FF(i) & \
+ ~MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC(i) & \
+ 0x2020202020202020)
+
+/*
+ Convert lower case ASCII letters to upper case by unsetting
+ the bit 0x20 with help of the magic expression.
+
+ Requirements:
+ All bytes must be in the range [00..7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC()
+*/
+#define MY_ASCII_TOUPPER_MAGIC(i) \
+ (i ^ MY_ASCII_20_IF_IS_LOWER_LETTER(i))
+
+
+/*
+ Convert a string (consisting of 8 bytes stored in uint64)
+ to upper case algorithmically.
+
+ Requirements:
+ All bytes must be in the range [00..0x7F].
+ See the comments in MY_ASCII_20_IS_SET_IF_NOT_LETTER_MAGIC().
+ The result on 8bit data is unpredictable!!!
+ The caller should make sure not to pass 8bit data.
+*/
+static inline ulonglong my_ascii_to_upper_magic_uint64(ulonglong i)
+{
+ return MY_ASCII_TOUPPER_MAGIC(i);
+}
+
+
+/*
+ Check if:
+ - both strings "a" and "b" have at least 4 bytes, and
+ - both strings have only 7bit data.
+*/
+static inline int
+my_strcoll_ascii_4bytes_found(const uchar *a, const uchar *ae,
+ const uchar *b, const uchar *be)
+{
+ return a + 4 <= ae && b + 4 <= be &&
+ (uint4korr(b) & 0x80808080) == 0 &&
+ (uint4korr(a) & 0x80808080) == 0;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings case insensitively
+ by converting letters [a-z] to upper case [A-Z].
+
+ Requirements:
+ - The input strings must have at least four bytes, and
+ - The leading four bytes in both strings must be 7bit ASCII.
+ The caller must make sure to provide only strings that meet
+ these requirements. The result on 8-bit data is unpredictable
+ as 8-bit bytes may cause overflow in my_ascii_to_upper_magic_uint64().
+ See comments above.
+*/
+static inline int
+my_strcoll_ascii_toupper_4bytes(const uchar *a, const uchar *b)
+{
+ ulonglong abn= (((ulonglong) mi_uint4korr(a)) << 32) | mi_uint4korr(b);
+ abn= my_ascii_to_upper_magic_uint64(abn);
+ if ((uint32) (abn >> 32) == (uint32) abn)
+ return 0;
+ return ((uint32) (abn >> 32)) < ((uint32) abn) ? -1 : + 1;
+}
+
+
+/*
+ Compare the leading eight 7bit ASCII bytes in two strings case insensitively
+ by converting letters [a-z] to upper case [A-Z].
+
+ Requirements:
+ - The input strings must have at least eight bytes, and
+ - The leading eight bytes in both strings must be 7bit ASCII.
+ See comments in my_strcoll_ascii_toupper_4bytes().
+*/
+static inline int
+my_strcoll_ascii_toupper_8bytes(const uchar *a, const uchar *b)
+{
+ /*
+ TODO:
+ Try to get advantage of SIMD instructions by massive comparison
+ (16 bytes at a time) of characters against (x>='a' && x<='z') using:
+ - either explicit intrinsics
+ - or a loop that can get vectorized automatically by some compilers.
+ */
+ ulonglong an= mi_uint8korr(a);
+ ulonglong bn= mi_uint8korr(b);
+ an= my_ascii_to_upper_magic_uint64(an);
+ bn= my_ascii_to_upper_magic_uint64(bn);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings in binary style.
+*/
+static inline int
+my_strcoll_mb7_bin_4bytes(const uchar *a, const uchar *b)
+{
+ uint32 an= mi_uint4korr(a);
+ uint32 bn= mi_uint4korr(b);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+
+/*
+ Compare the leading four 7bit ASCII bytes in two strings in binary style.
+*/
+static inline int
+my_strcoll_mb7_bin_8bytes(const uchar *a, const uchar *b)
+{
+ ulonglong an= mi_uint8korr(a);
+ ulonglong bn= mi_uint8korr(b);
+ return an == bn ? 0 : an < bn ? -1 : +1;
+}
+
+#endif /* CTYPE_ASCII_INCLUDED */
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 73e3d8ea306..9821584f074 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6690,6 +6690,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (big5code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -6706,6 +6707,7 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _big5_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (big5code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 859fd029744..8cf2757c6b2 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -34638,6 +34638,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)])
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -34645,6 +34646,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -34653,6 +34655,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_cp932[(uchar) (x)])
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -34661,6 +34664,7 @@ size_t my_numcells_cp932(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (cp932code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c
index e152862c0ef..c3e8a2121ed 100644
--- a/strings/ctype-euc_kr.c
+++ b/strings/ctype-euc_kr.c
@@ -9931,12 +9931,14 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_ci
#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)])
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -9944,6 +9946,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_korean_nopad_ci
#define WEIGHT_MB1(x) (sort_order_euc_kr[(uchar) (x)])
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -9951,6 +9954,7 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _euckr_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (euckrcode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c
index 4c365b4ff6a..331fb68a72e 100644
--- a/strings/ctype-eucjpms.c
+++ b/strings/ctype-eucjpms.c
@@ -211,6 +211,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -220,6 +221,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -230,6 +232,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -240,6 +243,7 @@ static const uchar sort_order_eucjpms[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 56709b06bf7..f801ea285b7 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -6343,6 +6343,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -6357,6 +6358,7 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gb2312_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gb2312code(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 95f59a18d99..5ede3520f3a 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -10624,6 +10624,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gbkcode(x,y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -10639,6 +10640,7 @@ my_mb_wc_gbk(CHARSET_INFO *cs __attribute__((unused)),
#define MY_FUNCTION_NAME(x) my_ ## x ## _gbk_nopad_bin
#define WEIGHT_MB1(x) ((uchar) (x))
#define WEIGHT_MB2(x,y) (gbkcode(x,y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index b6b212f2c0d..5cef7126b07 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -34026,6 +34026,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)])
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -34033,6 +34034,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -34041,6 +34043,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) sort_order_sjis[(uchar) (x)])
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -34049,6 +34052,7 @@ my_wc_to_printable_sjis(CHARSET_INFO *cs, my_wc_t wc,
#define WEIGHT_PAD_SPACE (256 * (int) ' ')
#define WEIGHT_MB1(x) (256 * (int) (uchar) (x))
#define WEIGHT_MB2(x,y) (sjiscode(x, y))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c
index fa5856ebc0d..8664ea3f757 100644
--- a/strings/ctype-ujis.c
+++ b/strings/ctype-ujis.c
@@ -210,6 +210,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -219,6 +220,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -229,6 +231,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -239,6 +242,7 @@ static const uchar sort_order_ujis[]=
#define WEIGHT_MB2(x,y) ((((uint) (uchar)(x)) << 16) | \
(((uint) (uchar) (y)) << 8))
#define WEIGHT_MB3(x,y,z) (WEIGHT_MB2(x,y) | ((uint) (uchar) z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index ee50d53829e..74b50a1ec2f 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1035,6 +1035,268 @@ static MY_UNICASE_CHARACTER plane05[]={
{0x05FE,0x05FE,0x05FE}, {0x05FF,0x05FF,0x05FF}
};
+static MY_UNICASE_CHARACTER plane06[]={ /* This page is dummy */
+ {0x0600,0x0600,0x0600}, {0x0601,0x0601,0x0601}, /* 0600 */
+ {0x0602,0x0602,0x0602}, {0x0603,0x0603,0x0603}, /* 0602 */
+ {0x0604,0x0604,0x0604}, {0x0605,0x0605,0x0605}, /* 0604 */
+ {0x0606,0x0606,0x0606}, {0x0607,0x0607,0x0607}, /* 0606 */
+ {0x0608,0x0608,0x0608}, {0x0609,0x0609,0x0609}, /* 0608 */
+ {0x060A,0x060A,0x060A}, {0x060B,0x060B,0x060B}, /* 060A */
+ {0x060C,0x060C,0x060C}, {0x060D,0x060D,0x060D}, /* 060C */
+ {0x060E,0x060E,0x060E}, {0x060F,0x060F,0x060F}, /* 060E */
+ {0x0610,0x0610,0x0610}, {0x0611,0x0611,0x0611}, /* 0610 */
+ {0x0612,0x0612,0x0612}, {0x0613,0x0613,0x0613}, /* 0612 */
+ {0x0614,0x0614,0x0614}, {0x0615,0x0615,0x0615}, /* 0614 */
+ {0x0616,0x0616,0x0616}, {0x0617,0x0617,0x0617}, /* 0616 */
+ {0x0618,0x0618,0x0618}, {0x0619,0x0619,0x0619}, /* 0618 */
+ {0x061A,0x061A,0x061A}, {0x061B,0x061B,0x061B}, /* 061A */
+ {0x061C,0x061C,0x061C}, {0x061D,0x061D,0x061D}, /* 061C */
+ {0x061E,0x061E,0x061E}, {0x061F,0x061F,0x061F}, /* 061E */
+ {0x0620,0x0620,0x0620}, {0x0621,0x0621,0x0621}, /* 0620 */
+ {0x0622,0x0622,0x0622}, {0x0623,0x0623,0x0623}, /* 0622 */
+ {0x0624,0x0624,0x0624}, {0x0625,0x0625,0x0625}, /* 0624 */
+ {0x0626,0x0626,0x0626}, {0x0627,0x0627,0x0627}, /* 0626 */
+ {0x0628,0x0628,0x0628}, {0x0629,0x0629,0x0629}, /* 0628 */
+ {0x062A,0x062A,0x062A}, {0x062B,0x062B,0x062B}, /* 062A */
+ {0x062C,0x062C,0x062C}, {0x062D,0x062D,0x062D}, /* 062C */
+ {0x062E,0x062E,0x062E}, {0x062F,0x062F,0x062F}, /* 062E */
+ {0x0630,0x0630,0x0630}, {0x0631,0x0631,0x0631}, /* 0630 */
+ {0x0632,0x0632,0x0632}, {0x0633,0x0633,0x0633}, /* 0632 */
+ {0x0634,0x0634,0x0634}, {0x0635,0x0635,0x0635}, /* 0634 */
+ {0x0636,0x0636,0x0636}, {0x0637,0x0637,0x0637}, /* 0636 */
+ {0x0638,0x0638,0x0638}, {0x0639,0x0639,0x0639}, /* 0638 */
+ {0x063A,0x063A,0x063A}, {0x063B,0x063B,0x063B}, /* 063A */
+ {0x063C,0x063C,0x063C}, {0x063D,0x063D,0x063D}, /* 063C */
+ {0x063E,0x063E,0x063E}, {0x063F,0x063F,0x063F}, /* 063E */
+ {0x0640,0x0640,0x0640}, {0x0641,0x0641,0x0641}, /* 0640 */
+ {0x0642,0x0642,0x0642}, {0x0643,0x0643,0x0643}, /* 0642 */
+ {0x0644,0x0644,0x0644}, {0x0645,0x0645,0x0645}, /* 0644 */
+ {0x0646,0x0646,0x0646}, {0x0647,0x0647,0x0647}, /* 0646 */
+ {0x0648,0x0648,0x0648}, {0x0649,0x0649,0x0649}, /* 0648 */
+ {0x064A,0x064A,0x064A}, {0x064B,0x064B,0x064B}, /* 064A */
+ {0x064C,0x064C,0x064C}, {0x064D,0x064D,0x064D}, /* 064C */
+ {0x064E,0x064E,0x064E}, {0x064F,0x064F,0x064F}, /* 064E */
+ {0x0650,0x0650,0x0650}, {0x0651,0x0651,0x0651}, /* 0650 */
+ {0x0652,0x0652,0x0652}, {0x0653,0x0653,0x0653}, /* 0652 */
+ {0x0654,0x0654,0x0654}, {0x0655,0x0655,0x0655}, /* 0654 */
+ {0x0656,0x0656,0x0656}, {0x0657,0x0657,0x0657}, /* 0656 */
+ {0x0658,0x0658,0x0658}, {0x0659,0x0659,0x0659}, /* 0658 */
+ {0x065A,0x065A,0x065A}, {0x065B,0x065B,0x065B}, /* 065A */
+ {0x065C,0x065C,0x065C}, {0x065D,0x065D,0x065D}, /* 065C */
+ {0x065E,0x065E,0x065E}, {0x065F,0x065F,0x065F}, /* 065E */
+ {0x0660,0x0660,0x0660}, {0x0661,0x0661,0x0661}, /* 0660 */
+ {0x0662,0x0662,0x0662}, {0x0663,0x0663,0x0663}, /* 0662 */
+ {0x0664,0x0664,0x0664}, {0x0665,0x0665,0x0665}, /* 0664 */
+ {0x0666,0x0666,0x0666}, {0x0667,0x0667,0x0667}, /* 0666 */
+ {0x0668,0x0668,0x0668}, {0x0669,0x0669,0x0669}, /* 0668 */
+ {0x066A,0x066A,0x066A}, {0x066B,0x066B,0x066B}, /* 066A */
+ {0x066C,0x066C,0x066C}, {0x066D,0x066D,0x066D}, /* 066C */
+ {0x066E,0x066E,0x066E}, {0x066F,0x066F,0x066F}, /* 066E */
+ {0x0670,0x0670,0x0670}, {0x0671,0x0671,0x0671}, /* 0670 */
+ {0x0672,0x0672,0x0672}, {0x0673,0x0673,0x0673}, /* 0672 */
+ {0x0674,0x0674,0x0674}, {0x0675,0x0675,0x0675}, /* 0674 */
+ {0x0676,0x0676,0x0676}, {0x0677,0x0677,0x0677}, /* 0676 */
+ {0x0678,0x0678,0x0678}, {0x0679,0x0679,0x0679}, /* 0678 */
+ {0x067A,0x067A,0x067A}, {0x067B,0x067B,0x067B}, /* 067A */
+ {0x067C,0x067C,0x067C}, {0x067D,0x067D,0x067D}, /* 067C */
+ {0x067E,0x067E,0x067E}, {0x067F,0x067F,0x067F}, /* 067E */
+ {0x0680,0x0680,0x0680}, {0x0681,0x0681,0x0681}, /* 0680 */
+ {0x0682,0x0682,0x0682}, {0x0683,0x0683,0x0683}, /* 0682 */
+ {0x0684,0x0684,0x0684}, {0x0685,0x0685,0x0685}, /* 0684 */
+ {0x0686,0x0686,0x0686}, {0x0687,0x0687,0x0687}, /* 0686 */
+ {0x0688,0x0688,0x0688}, {0x0689,0x0689,0x0689}, /* 0688 */
+ {0x068A,0x068A,0x068A}, {0x068B,0x068B,0x068B}, /* 068A */
+ {0x068C,0x068C,0x068C}, {0x068D,0x068D,0x068D}, /* 068C */
+ {0x068E,0x068E,0x068E}, {0x068F,0x068F,0x068F}, /* 068E */
+ {0x0690,0x0690,0x0690}, {0x0691,0x0691,0x0691}, /* 0690 */
+ {0x0692,0x0692,0x0692}, {0x0693,0x0693,0x0693}, /* 0692 */
+ {0x0694,0x0694,0x0694}, {0x0695,0x0695,0x0695}, /* 0694 */
+ {0x0696,0x0696,0x0696}, {0x0697,0x0697,0x0697}, /* 0696 */
+ {0x0698,0x0698,0x0698}, {0x0699,0x0699,0x0699}, /* 0698 */
+ {0x069A,0x069A,0x069A}, {0x069B,0x069B,0x069B}, /* 069A */
+ {0x069C,0x069C,0x069C}, {0x069D,0x069D,0x069D}, /* 069C */
+ {0x069E,0x069E,0x069E}, {0x069F,0x069F,0x069F}, /* 069E */
+ {0x06A0,0x06A0,0x06A0}, {0x06A1,0x06A1,0x06A1}, /* 06A0 */
+ {0x06A2,0x06A2,0x06A2}, {0x06A3,0x06A3,0x06A3}, /* 06A2 */
+ {0x06A4,0x06A4,0x06A4}, {0x06A5,0x06A5,0x06A5}, /* 06A4 */
+ {0x06A6,0x06A6,0x06A6}, {0x06A7,0x06A7,0x06A7}, /* 06A6 */
+ {0x06A8,0x06A8,0x06A8}, {0x06A9,0x06A9,0x06A9}, /* 06A8 */
+ {0x06AA,0x06AA,0x06AA}, {0x06AB,0x06AB,0x06AB}, /* 06AA */
+ {0x06AC,0x06AC,0x06AC}, {0x06AD,0x06AD,0x06AD}, /* 06AC */
+ {0x06AE,0x06AE,0x06AE}, {0x06AF,0x06AF,0x06AF}, /* 06AE */
+ {0x06B0,0x06B0,0x06B0}, {0x06B1,0x06B1,0x06B1}, /* 06B0 */
+ {0x06B2,0x06B2,0x06B2}, {0x06B3,0x06B3,0x06B3}, /* 06B2 */
+ {0x06B4,0x06B4,0x06B4}, {0x06B5,0x06B5,0x06B5}, /* 06B4 */
+ {0x06B6,0x06B6,0x06B6}, {0x06B7,0x06B7,0x06B7}, /* 06B6 */
+ {0x06B8,0x06B8,0x06B8}, {0x06B9,0x06B9,0x06B9}, /* 06B8 */
+ {0x06BA,0x06BA,0x06BA}, {0x06BB,0x06BB,0x06BB}, /* 06BA */
+ {0x06BC,0x06BC,0x06BC}, {0x06BD,0x06BD,0x06BD}, /* 06BC */
+ {0x06BE,0x06BE,0x06BE}, {0x06BF,0x06BF,0x06BF}, /* 06BE */
+ {0x06C0,0x06C0,0x06C0}, {0x06C1,0x06C1,0x06C1}, /* 06C0 */
+ {0x06C2,0x06C2,0x06C2}, {0x06C3,0x06C3,0x06C3}, /* 06C2 */
+ {0x06C4,0x06C4,0x06C4}, {0x06C5,0x06C5,0x06C5}, /* 06C4 */
+ {0x06C6,0x06C6,0x06C6}, {0x06C7,0x06C7,0x06C7}, /* 06C6 */
+ {0x06C8,0x06C8,0x06C8}, {0x06C9,0x06C9,0x06C9}, /* 06C8 */
+ {0x06CA,0x06CA,0x06CA}, {0x06CB,0x06CB,0x06CB}, /* 06CA */
+ {0x06CC,0x06CC,0x06CC}, {0x06CD,0x06CD,0x06CD}, /* 06CC */
+ {0x06CE,0x06CE,0x06CE}, {0x06CF,0x06CF,0x06CF}, /* 06CE */
+ {0x06D0,0x06D0,0x06D0}, {0x06D1,0x06D1,0x06D1}, /* 06D0 */
+ {0x06D2,0x06D2,0x06D2}, {0x06D3,0x06D3,0x06D3}, /* 06D2 */
+ {0x06D4,0x06D4,0x06D4}, {0x06D5,0x06D5,0x06D5}, /* 06D4 */
+ {0x06D6,0x06D6,0x06D6}, {0x06D7,0x06D7,0x06D7}, /* 06D6 */
+ {0x06D8,0x06D8,0x06D8}, {0x06D9,0x06D9,0x06D9}, /* 06D8 */
+ {0x06DA,0x06DA,0x06DA}, {0x06DB,0x06DB,0x06DB}, /* 06DA */
+ {0x06DC,0x06DC,0x06DC}, {0x06DD,0x06DD,0x06DD}, /* 06DC */
+ {0x06DE,0x06DE,0x06DE}, {0x06DF,0x06DF,0x06DF}, /* 06DE */
+ {0x06E0,0x06E0,0x06E0}, {0x06E1,0x06E1,0x06E1}, /* 06E0 */
+ {0x06E2,0x06E2,0x06E2}, {0x06E3,0x06E3,0x06E3}, /* 06E2 */
+ {0x06E4,0x06E4,0x06E4}, {0x06E5,0x06E5,0x06E5}, /* 06E4 */
+ {0x06E6,0x06E6,0x06E6}, {0x06E7,0x06E7,0x06E7}, /* 06E6 */
+ {0x06E8,0x06E8,0x06E8}, {0x06E9,0x06E9,0x06E9}, /* 06E8 */
+ {0x06EA,0x06EA,0x06EA}, {0x06EB,0x06EB,0x06EB}, /* 06EA */
+ {0x06EC,0x06EC,0x06EC}, {0x06ED,0x06ED,0x06ED}, /* 06EC */
+ {0x06EE,0x06EE,0x06EE}, {0x06EF,0x06EF,0x06EF}, /* 06EE */
+ {0x06F0,0x06F0,0x06F0}, {0x06F1,0x06F1,0x06F1}, /* 06F0 */
+ {0x06F2,0x06F2,0x06F2}, {0x06F3,0x06F3,0x06F3}, /* 06F2 */
+ {0x06F4,0x06F4,0x06F4}, {0x06F5,0x06F5,0x06F5}, /* 06F4 */
+ {0x06F6,0x06F6,0x06F6}, {0x06F7,0x06F7,0x06F7}, /* 06F6 */
+ {0x06F8,0x06F8,0x06F8}, {0x06F9,0x06F9,0x06F9}, /* 06F8 */
+ {0x06FA,0x06FA,0x06FA}, {0x06FB,0x06FB,0x06FB}, /* 06FA */
+ {0x06FC,0x06FC,0x06FC}, {0x06FD,0x06FD,0x06FD}, /* 06FC */
+ {0x06FE,0x06FE,0x06FE}, {0x06FF,0x06FF,0x06FF} /* 06FE */
+};
+
+static MY_UNICASE_CHARACTER plane07[]={ /* This page is dummy */
+ {0x0700,0x0700,0x0700}, {0x0701,0x0701,0x0701}, /* 0700 */
+ {0x0702,0x0702,0x0702}, {0x0703,0x0703,0x0703}, /* 0702 */
+ {0x0704,0x0704,0x0704}, {0x0705,0x0705,0x0705}, /* 0704 */
+ {0x0706,0x0706,0x0706}, {0x0707,0x0707,0x0707}, /* 0706 */
+ {0x0708,0x0708,0x0708}, {0x0709,0x0709,0x0709}, /* 0708 */
+ {0x070A,0x070A,0x070A}, {0x070B,0x070B,0x070B}, /* 070A */
+ {0x070C,0x070C,0x070C}, {0x070D,0x070D,0x070D}, /* 070C */
+ {0x070E,0x070E,0x070E}, {0x070F,0x070F,0x070F}, /* 070E */
+ {0x0710,0x0710,0x0710}, {0x0711,0x0711,0x0711}, /* 0710 */
+ {0x0712,0x0712,0x0712}, {0x0713,0x0713,0x0713}, /* 0712 */
+ {0x0714,0x0714,0x0714}, {0x0715,0x0715,0x0715}, /* 0714 */
+ {0x0716,0x0716,0x0716}, {0x0717,0x0717,0x0717}, /* 0716 */
+ {0x0718,0x0718,0x0718}, {0x0719,0x0719,0x0719}, /* 0718 */
+ {0x071A,0x071A,0x071A}, {0x071B,0x071B,0x071B}, /* 071A */
+ {0x071C,0x071C,0x071C}, {0x071D,0x071D,0x071D}, /* 071C */
+ {0x071E,0x071E,0x071E}, {0x071F,0x071F,0x071F}, /* 071E */
+ {0x0720,0x0720,0x0720}, {0x0721,0x0721,0x0721}, /* 0720 */
+ {0x0722,0x0722,0x0722}, {0x0723,0x0723,0x0723}, /* 0722 */
+ {0x0724,0x0724,0x0724}, {0x0725,0x0725,0x0725}, /* 0724 */
+ {0x0726,0x0726,0x0726}, {0x0727,0x0727,0x0727}, /* 0726 */
+ {0x0728,0x0728,0x0728}, {0x0729,0x0729,0x0729}, /* 0728 */
+ {0x072A,0x072A,0x072A}, {0x072B,0x072B,0x072B}, /* 072A */
+ {0x072C,0x072C,0x072C}, {0x072D,0x072D,0x072D}, /* 072C */
+ {0x072E,0x072E,0x072E}, {0x072F,0x072F,0x072F}, /* 072E */
+ {0x0730,0x0730,0x0730}, {0x0731,0x0731,0x0731}, /* 0730 */
+ {0x0732,0x0732,0x0732}, {0x0733,0x0733,0x0733}, /* 0732 */
+ {0x0734,0x0734,0x0734}, {0x0735,0x0735,0x0735}, /* 0734 */
+ {0x0736,0x0736,0x0736}, {0x0737,0x0737,0x0737}, /* 0736 */
+ {0x0738,0x0738,0x0738}, {0x0739,0x0739,0x0739}, /* 0738 */
+ {0x073A,0x073A,0x073A}, {0x073B,0x073B,0x073B}, /* 073A */
+ {0x073C,0x073C,0x073C}, {0x073D,0x073D,0x073D}, /* 073C */
+ {0x073E,0x073E,0x073E}, {0x073F,0x073F,0x073F}, /* 073E */
+ {0x0740,0x0740,0x0740}, {0x0741,0x0741,0x0741}, /* 0740 */
+ {0x0742,0x0742,0x0742}, {0x0743,0x0743,0x0743}, /* 0742 */
+ {0x0744,0x0744,0x0744}, {0x0745,0x0745,0x0745}, /* 0744 */
+ {0x0746,0x0746,0x0746}, {0x0747,0x0747,0x0747}, /* 0746 */
+ {0x0748,0x0748,0x0748}, {0x0749,0x0749,0x0749}, /* 0748 */
+ {0x074A,0x074A,0x074A}, {0x074B,0x074B,0x074B}, /* 074A */
+ {0x074C,0x074C,0x074C}, {0x074D,0x074D,0x074D}, /* 074C */
+ {0x074E,0x074E,0x074E}, {0x074F,0x074F,0x074F}, /* 074E */
+ {0x0750,0x0750,0x0750}, {0x0751,0x0751,0x0751}, /* 0750 */
+ {0x0752,0x0752,0x0752}, {0x0753,0x0753,0x0753}, /* 0752 */
+ {0x0754,0x0754,0x0754}, {0x0755,0x0755,0x0755}, /* 0754 */
+ {0x0756,0x0756,0x0756}, {0x0757,0x0757,0x0757}, /* 0756 */
+ {0x0758,0x0758,0x0758}, {0x0759,0x0759,0x0759}, /* 0758 */
+ {0x075A,0x075A,0x075A}, {0x075B,0x075B,0x075B}, /* 075A */
+ {0x075C,0x075C,0x075C}, {0x075D,0x075D,0x075D}, /* 075C */
+ {0x075E,0x075E,0x075E}, {0x075F,0x075F,0x075F}, /* 075E */
+ {0x0760,0x0760,0x0760}, {0x0761,0x0761,0x0761}, /* 0760 */
+ {0x0762,0x0762,0x0762}, {0x0763,0x0763,0x0763}, /* 0762 */
+ {0x0764,0x0764,0x0764}, {0x0765,0x0765,0x0765}, /* 0764 */
+ {0x0766,0x0766,0x0766}, {0x0767,0x0767,0x0767}, /* 0766 */
+ {0x0768,0x0768,0x0768}, {0x0769,0x0769,0x0769}, /* 0768 */
+ {0x076A,0x076A,0x076A}, {0x076B,0x076B,0x076B}, /* 076A */
+ {0x076C,0x076C,0x076C}, {0x076D,0x076D,0x076D}, /* 076C */
+ {0x076E,0x076E,0x076E}, {0x076F,0x076F,0x076F}, /* 076E */
+ {0x0770,0x0770,0x0770}, {0x0771,0x0771,0x0771}, /* 0770 */
+ {0x0772,0x0772,0x0772}, {0x0773,0x0773,0x0773}, /* 0772 */
+ {0x0774,0x0774,0x0774}, {0x0775,0x0775,0x0775}, /* 0774 */
+ {0x0776,0x0776,0x0776}, {0x0777,0x0777,0x0777}, /* 0776 */
+ {0x0778,0x0778,0x0778}, {0x0779,0x0779,0x0779}, /* 0778 */
+ {0x077A,0x077A,0x077A}, {0x077B,0x077B,0x077B}, /* 077A */
+ {0x077C,0x077C,0x077C}, {0x077D,0x077D,0x077D}, /* 077C */
+ {0x077E,0x077E,0x077E}, {0x077F,0x077F,0x077F}, /* 077E */
+ {0x0780,0x0780,0x0780}, {0x0781,0x0781,0x0781}, /* 0780 */
+ {0x0782,0x0782,0x0782}, {0x0783,0x0783,0x0783}, /* 0782 */
+ {0x0784,0x0784,0x0784}, {0x0785,0x0785,0x0785}, /* 0784 */
+ {0x0786,0x0786,0x0786}, {0x0787,0x0787,0x0787}, /* 0786 */
+ {0x0788,0x0788,0x0788}, {0x0789,0x0789,0x0789}, /* 0788 */
+ {0x078A,0x078A,0x078A}, {0x078B,0x078B,0x078B}, /* 078A */
+ {0x078C,0x078C,0x078C}, {0x078D,0x078D,0x078D}, /* 078C */
+ {0x078E,0x078E,0x078E}, {0x078F,0x078F,0x078F}, /* 078E */
+ {0x0790,0x0790,0x0790}, {0x0791,0x0791,0x0791}, /* 0790 */
+ {0x0792,0x0792,0x0792}, {0x0793,0x0793,0x0793}, /* 0792 */
+ {0x0794,0x0794,0x0794}, {0x0795,0x0795,0x0795}, /* 0794 */
+ {0x0796,0x0796,0x0796}, {0x0797,0x0797,0x0797}, /* 0796 */
+ {0x0798,0x0798,0x0798}, {0x0799,0x0799,0x0799}, /* 0798 */
+ {0x079A,0x079A,0x079A}, {0x079B,0x079B,0x079B}, /* 079A */
+ {0x079C,0x079C,0x079C}, {0x079D,0x079D,0x079D}, /* 079C */
+ {0x079E,0x079E,0x079E}, {0x079F,0x079F,0x079F}, /* 079E */
+ {0x07A0,0x07A0,0x07A0}, {0x07A1,0x07A1,0x07A1}, /* 07A0 */
+ {0x07A2,0x07A2,0x07A2}, {0x07A3,0x07A3,0x07A3}, /* 07A2 */
+ {0x07A4,0x07A4,0x07A4}, {0x07A5,0x07A5,0x07A5}, /* 07A4 */
+ {0x07A6,0x07A6,0x07A6}, {0x07A7,0x07A7,0x07A7}, /* 07A6 */
+ {0x07A8,0x07A8,0x07A8}, {0x07A9,0x07A9,0x07A9}, /* 07A8 */
+ {0x07AA,0x07AA,0x07AA}, {0x07AB,0x07AB,0x07AB}, /* 07AA */
+ {0x07AC,0x07AC,0x07AC}, {0x07AD,0x07AD,0x07AD}, /* 07AC */
+ {0x07AE,0x07AE,0x07AE}, {0x07AF,0x07AF,0x07AF}, /* 07AE */
+ {0x07B0,0x07B0,0x07B0}, {0x07B1,0x07B1,0x07B1}, /* 07B0 */
+ {0x07B2,0x07B2,0x07B2}, {0x07B3,0x07B3,0x07B3}, /* 07B2 */
+ {0x07B4,0x07B4,0x07B4}, {0x07B5,0x07B5,0x07B5}, /* 07B4 */
+ {0x07B6,0x07B6,0x07B6}, {0x07B7,0x07B7,0x07B7}, /* 07B6 */
+ {0x07B8,0x07B8,0x07B8}, {0x07B9,0x07B9,0x07B9}, /* 07B8 */
+ {0x07BA,0x07BA,0x07BA}, {0x07BB,0x07BB,0x07BB}, /* 07BA */
+ {0x07BC,0x07BC,0x07BC}, {0x07BD,0x07BD,0x07BD}, /* 07BC */
+ {0x07BE,0x07BE,0x07BE}, {0x07BF,0x07BF,0x07BF}, /* 07BE */
+ {0x07C0,0x07C0,0x07C0}, {0x07C1,0x07C1,0x07C1}, /* 07C0 */
+ {0x07C2,0x07C2,0x07C2}, {0x07C3,0x07C3,0x07C3}, /* 07C2 */
+ {0x07C4,0x07C4,0x07C4}, {0x07C5,0x07C5,0x07C5}, /* 07C4 */
+ {0x07C6,0x07C6,0x07C6}, {0x07C7,0x07C7,0x07C7}, /* 07C6 */
+ {0x07C8,0x07C8,0x07C8}, {0x07C9,0x07C9,0x07C9}, /* 07C8 */
+ {0x07CA,0x07CA,0x07CA}, {0x07CB,0x07CB,0x07CB}, /* 07CA */
+ {0x07CC,0x07CC,0x07CC}, {0x07CD,0x07CD,0x07CD}, /* 07CC */
+ {0x07CE,0x07CE,0x07CE}, {0x07CF,0x07CF,0x07CF}, /* 07CE */
+ {0x07D0,0x07D0,0x07D0}, {0x07D1,0x07D1,0x07D1}, /* 07D0 */
+ {0x07D2,0x07D2,0x07D2}, {0x07D3,0x07D3,0x07D3}, /* 07D2 */
+ {0x07D4,0x07D4,0x07D4}, {0x07D5,0x07D5,0x07D5}, /* 07D4 */
+ {0x07D6,0x07D6,0x07D6}, {0x07D7,0x07D7,0x07D7}, /* 07D6 */
+ {0x07D8,0x07D8,0x07D8}, {0x07D9,0x07D9,0x07D9}, /* 07D8 */
+ {0x07DA,0x07DA,0x07DA}, {0x07DB,0x07DB,0x07DB}, /* 07DA */
+ {0x07DC,0x07DC,0x07DC}, {0x07DD,0x07DD,0x07DD}, /* 07DC */
+ {0x07DE,0x07DE,0x07DE}, {0x07DF,0x07DF,0x07DF}, /* 07DE */
+ {0x07E0,0x07E0,0x07E0}, {0x07E1,0x07E1,0x07E1}, /* 07E0 */
+ {0x07E2,0x07E2,0x07E2}, {0x07E3,0x07E3,0x07E3}, /* 07E2 */
+ {0x07E4,0x07E4,0x07E4}, {0x07E5,0x07E5,0x07E5}, /* 07E4 */
+ {0x07E6,0x07E6,0x07E6}, {0x07E7,0x07E7,0x07E7}, /* 07E6 */
+ {0x07E8,0x07E8,0x07E8}, {0x07E9,0x07E9,0x07E9}, /* 07E8 */
+ {0x07EA,0x07EA,0x07EA}, {0x07EB,0x07EB,0x07EB}, /* 07EA */
+ {0x07EC,0x07EC,0x07EC}, {0x07ED,0x07ED,0x07ED}, /* 07EC */
+ {0x07EE,0x07EE,0x07EE}, {0x07EF,0x07EF,0x07EF}, /* 07EE */
+ {0x07F0,0x07F0,0x07F0}, {0x07F1,0x07F1,0x07F1}, /* 07F0 */
+ {0x07F2,0x07F2,0x07F2}, {0x07F3,0x07F3,0x07F3}, /* 07F2 */
+ {0x07F4,0x07F4,0x07F4}, {0x07F5,0x07F5,0x07F5}, /* 07F4 */
+ {0x07F6,0x07F6,0x07F6}, {0x07F7,0x07F7,0x07F7}, /* 07F6 */
+ {0x07F8,0x07F8,0x07F8}, {0x07F9,0x07F9,0x07F9}, /* 07F8 */
+ {0x07FA,0x07FA,0x07FA}, {0x07FB,0x07FB,0x07FB}, /* 07FA */
+ {0x07FC,0x07FC,0x07FC}, {0x07FD,0x07FD,0x07FD}, /* 07FC */
+ {0x07FE,0x07FE,0x07FE}, {0x07FF,0x07FF,0x07FF} /* 07FE */
+};
+
static MY_UNICASE_CHARACTER plane1E[]={
{0x1E00,0x1E01,0x0041}, {0x1E00,0x1E01,0x0041},
{0x1E02,0x1E03,0x0042}, {0x1E02,0x1E03,0x0042},
@@ -1694,7 +1956,7 @@ static MY_UNICASE_CHARACTER planeFF[]={
MY_UNICASE_CHARACTER *my_unicase_default_pages[256]=
{
my_unicase_default_page00,
- plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -1741,7 +2003,7 @@ MY_UNICASE_INFO my_unicase_default=
*/
MY_UNICASE_CHARACTER *my_unicase_pages_mysql500[256]={
plane00_mysql500,
- plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -1928,7 +2190,7 @@ static MY_UNICASE_CHARACTER turk00[]=
static MY_UNICASE_CHARACTER *my_unicase_pages_turkish[256]=
{
- turk00, plane01, plane02, plane03, plane04, plane05, NULL, NULL,
+ turk00, plane01, plane02, plane03, plane04, plane05, plane06, plane07,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, plane1E, plane1F,
@@ -4332,7 +4594,7 @@ static MY_UNICASE_CHARACTER u520p104[]={
MY_UNICASE_CHARACTER *my_unicase_pages_unicode520[4352]=
{
- u520p00, u520p01, u520p02, u520p03, u520p04, u520p05, NULL, NULL,
+ u520p00, u520p01, u520p02, u520p03, u520p04, u520p05, plane06, plane06,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
u520p10, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, u520p1D, u520p1E, u520p1F,
@@ -5230,7 +5492,17 @@ static inline int my_weight_mb2_utf8mb3_general_ci(uchar b0, uchar b1)
{
my_wc_t wc= UTF8MB2_CODE(b0, b1);
MY_UNICASE_CHARACTER *page= my_unicase_default_pages[wc >> 8];
- return (int) (page ? page[wc & 0xFF].sort : wc);
+ /*
+ 2-byte utf8 sequences encode Unicode characters up to U+07FF.
+ my_unicase_default_pages[N] has non-NULL page pointers
+ for all N in the range [0..7].
+ - my_unicase_default_pages[0..5] point to real translation data
+ - my_unicase_default_pages[6..7] point to dummy pages
+ (without real translation).
+ By adding these dummy pages we can avoid testing 'page' against NULL.
+ This gives up to 20% performance improvement.
+ */
+ return (int) page[wc & 0xFF].sort;
}
@@ -5254,6 +5526,7 @@ static inline int my_weight_mb3_utf8mb3_general_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_ci(x)
#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_ci(x,y)
#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_ci(x,y,z)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -5263,6 +5536,7 @@ static inline int my_weight_mb3_utf8mb3_general_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_ci(x)
#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_ci(x,y)
#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_ci(x,y,z)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -5276,7 +5550,11 @@ static inline int my_weight_mb2_utf8mb3_general_mysql500_ci(uchar b0, uchar b1)
{
my_wc_t wc= UTF8MB2_CODE(b0, b1);
MY_UNICASE_CHARACTER *page= my_unicase_pages_mysql500[wc >> 8];
- return (int) (page ? page[wc & 0xFF].sort : wc);
+ /*
+ `page` should never be NULL for 2-byte utf8 characters.
+ See comments in my_weight_mb2_utf8mb3_general_ci().
+ */
+ return (int) page[wc & 0xFF].sort;
}
@@ -5300,6 +5578,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) my_weight_mb1_utf8mb3_general_mysql500_ci(x)
#define WEIGHT_MB2(x,y) my_weight_mb2_utf8mb3_general_mysql500_ci(x,y)
#define WEIGHT_MB3(x,y,z) my_weight_mb3_utf8mb3_general_mysql500_ci(x,y,z)
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -5311,6 +5590,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) ((int) (uchar) (x))
#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y))
#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -5320,6 +5600,7 @@ my_weight_mb3_utf8mb3_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
#define WEIGHT_MB1(x) ((int) (uchar) (x))
#define WEIGHT_MB2(x,y) ((int) UTF8MB2_CODE(x,y))
#define WEIGHT_MB3(x,y,z) ((int) UTF8MB3_CODE(x,y,z))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
/*
@@ -7670,6 +7951,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
All non-BMP characters have the same weight.
*/
#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -7679,6 +7961,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1))
#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2))
#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
@@ -7693,6 +7976,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
All non-BMP characters have the same weight.
*/
#define WEIGHT_MB4(b0,b1,b2,b3) MY_CS_REPLACEMENT_CHARACTER
+#define STRCOLL_MB7_TOUPPER
#include "strcoll.ic"
@@ -7703,6 +7987,7 @@ my_charlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)),
#define WEIGHT_MB2(b0,b1) ((int) UTF8MB2_CODE(b0,b1))
#define WEIGHT_MB3(b0,b1,b2) ((int) UTF8MB3_CODE(b0,b1,b2))
#define WEIGHT_MB4(b0,b1,b2,b3) ((int) UTF8MB4_CODE(b0,b1,b2,b3))
+#define STRCOLL_MB7_BIN
#include "strcoll.ic"
diff --git a/strings/strcoll.ic b/strings/strcoll.ic
index 6aca0d0c460..bf011245981 100644
--- a/strings/strcoll.ic
+++ b/strings/strcoll.ic
@@ -16,6 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
+#include "ctype-ascii.h"
+
#ifndef MY_FUNCTION_NAME
#error MY_FUNCTION_NAME is not defined
#endif
@@ -40,6 +42,42 @@
/*
+ For binary collations:
+ - on 32bit platforms perform only 4 byte optimization
+ - on 64bit platforms perform both 4 byte and 8 byte optimization
+*/
+#if defined(STRCOLL_MB7_BIN)
+#define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_mb7_bin_4bytes((a),(b))
+#if SIZEOF_VOIDP == 8
+#define STRCOLL_MB7_8BYTES
+#define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_mb7_bin_8bytes((a),(b))
+#endif /* Architecture test */
+#endif /* STRCOLL_MB7_BIN */
+
+
+/*
+ For case insensitive collations with trivial mapping from [a-z] to [A-Z]
+ perform optimization only on 64 bit platforms.
+ There is no sense to perform my_ascii_to_upper_magic_uint64() based
+ optimization on 32bit platforms. The idea of this optimization
+ is that it handles 8bytes at a time, using 64bit CPU registers.
+ Enabling this optimization on 32bit platform may only slow things down.
+*/
+#if defined(STRCOLL_MB7_TOUPPER)
+#if SIZEOF_VOIDP == 8
+#define MY_STRCOLL_MB7_4BYTES(a,b) my_strcoll_ascii_toupper_4bytes((a),(b))
+#define MY_STRCOLL_MB7_8BYTES(a,b) my_strcoll_ascii_toupper_8bytes((a),(b))
+#endif /* Architecture test */
+#endif /* STRCOLL_MB7_TOUPPER */
+
+
+/*
+ A helper macro to shift two pointers forward, to the given amount.
+*/
+#define MY_STRING_SHIFT_PTR_PTR(a,b,len) do { a+= len; b+= len; } while(0)
+
+
+/*
Weight of an illegal byte, must follow these rules:
1. Must be greater than weight of any normal character in the collation.
2. Two different bad bytes must have different weights and must be
@@ -182,7 +220,31 @@ MY_FUNCTION_NAME(strnncoll)(CHARSET_INFO *cs __attribute__((unused)),
{
int a_weight, b_weight, res;
uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
- uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ uint b_wlen;
+
+#ifdef MY_STRCOLL_MB7_4BYTES
+ if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))
+ {
+ int res;
+#ifdef MY_STRCOLL_MB7_8BYTES
+ /*TODO: a a loop here >='a' <='z' here, for automatic vectorization*/
+ if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))
+ {
+ if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 8);
+ continue;
+ }
+#endif
+ if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 4);
+ continue;
+ }
+#endif /* MY_STRCOLL_MB7_4BYTES */
+
+ b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+
/*
a_wlen b_wlen Comment
------ ------ -------
@@ -253,7 +315,30 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
{
int a_weight, b_weight, res;
uint a_wlen= MY_FUNCTION_NAME(scan_weight)(&a_weight, a, a_end);
- uint b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+ uint b_wlen;
+
+#ifdef MY_STRCOLL_MB7_4BYTES
+ if (a_wlen == 1 && my_strcoll_ascii_4bytes_found(a, a_end, b, b_end))
+ {
+ int res;
+#ifdef MY_STRCOLL_MB7_8BYTES
+ if (my_strcoll_ascii_4bytes_found(a + 4, a_end, b + 4, b_end))
+ {
+ if ((res= MY_STRCOLL_MB7_8BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 8);
+ continue;
+ }
+#endif
+ if ((res= MY_STRCOLL_MB7_4BYTES(a, b)))
+ return res;
+ MY_STRING_SHIFT_PTR_PTR(a, b, 4);
+ continue;
+ }
+#endif /* MY_STRCOLL_MB7_4BYTES */
+
+ b_wlen= MY_FUNCTION_NAME(scan_weight)(&b_weight, b, b_end);
+
if ((res= (a_weight - b_weight)))
{
/*
@@ -286,7 +371,7 @@ MY_FUNCTION_NAME(strnncollsp)(CHARSET_INFO *cs __attribute__((unused)),
DBUG_ASSERT(0);
return 0;
}
-#endif
+#endif /* DEFINE_STRNNCOLLSP_NOPAD */
#endif /* DEFINE_STRNNCOLL */
@@ -602,3 +687,8 @@ MY_FUNCTION_NAME(strnxfrm_nopad)(CHARSET_INFO *cs,
#undef DEFINE_STRNXFRM_UNICODE_BIN2
#undef DEFINE_STRNNCOLL
#undef DEFINE_STRNNCOLLSP_NOPAD
+
+#undef STRCOLL_MB7_TOUPPER
+#undef STRCOLL_MB7_BIN
+#undef MY_STRCOLL_MB7_4BYTES
+#undef MY_STRCOLL_MB7_8BYTES