Loading client/mysql.cc +11 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,17 @@ static int read_and_execute(bool interactive) if (!interactive) { line=batch_readline(status.line_buff); /* Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. Editors like "notepad" put this marker in the very beginning of a text file when you save the file using "Unicode UTF-8" format. */ if (!line_number && (uchar) line[0] == 0xEF && (uchar) line[1] == 0xBB && (uchar) line[2] == 0xBF) line+= 3; line_number++; if (!glob_buffer.length()) status.query_start_line=line_number; Loading mysql-test/include/ctype_regex.inc 0 → 100644 +42 −0 Original line number Diff line number Diff line # # To test a desired collation, set session.collation_connection to # this collation before including this file # --disable_warnings drop table if exists t1; --enable_warnings # # Create a table with two varchar(64) null-able column, # using current values of # @@character_set_connection and @@collation_connection. # create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; drop table t1; mysql-test/r/ctype_euckr.result +41 −0 Original line number Diff line number Diff line Loading @@ -178,3 +178,44 @@ hex(a) A2E6 FEF7 DROP TABLE t1; create table t1 (s1 varchar(5) character set euckr); insert into t1 values (0xA141); insert into t1 values (0xA15A); insert into t1 values (0xA161); insert into t1 values (0xA17A); insert into t1 values (0xA181); insert into t1 values (0xA1FE); insert into t1 values (0xA140); Warnings: Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1 insert into t1 values (0xA15B); Warnings: Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1 insert into t1 values (0xA160); Warnings: Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1 insert into t1 values (0xA17B); Warnings: Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1 insert into t1 values (0xA180); Warnings: Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1 insert into t1 values (0xA1FF); Warnings: Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1 select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1; hex(s1) hex(convert(s1 using utf8)) A141 ECA2A5 A15A ECA381 A161 ECA382 A17A ECA3A5 A181 ECA3A6 A1FE EFBFA2 drop table t1; End of 5.0 tests mysql-test/r/ctype_uca.result +45 −0 Original line number Diff line number Diff line Loading @@ -2767,4 +2767,49 @@ a c ch drop table t1; set collation_connection=ucs2_unicode_ci; drop table if exists t1; create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) character set ucs2 collate ucs2_unicode_ci default NULL, `s2` varchar(64) character set ucs2 collate ucs2_unicode_ci default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; s1 regexp s2 1 1 1 1 1 1 1 0 0 0 NULL NULL NULL NULL drop table t1; set names utf8; End for 5.0 tests mysql-test/r/ctype_ucs.result +45 −0 Original line number Diff line number Diff line Loading @@ -922,6 +922,51 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' drop table t1; set collation_connection=ucs2_general_ci; drop table if exists t1; create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) character set ucs2 default NULL, `s2` varchar(64) character set ucs2 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; s1 regexp s2 1 1 1 1 1 1 1 0 0 0 NULL NULL NULL NULL drop table t1; set names latin1; select hex(char(0x41 using ucs2)); hex(char(0x41 using ucs2)) 0041 Loading Loading
client/mysql.cc +11 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,17 @@ static int read_and_execute(bool interactive) if (!interactive) { line=batch_readline(status.line_buff); /* Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. Editors like "notepad" put this marker in the very beginning of a text file when you save the file using "Unicode UTF-8" format. */ if (!line_number && (uchar) line[0] == 0xEF && (uchar) line[1] == 0xBB && (uchar) line[2] == 0xBF) line+= 3; line_number++; if (!glob_buffer.length()) status.query_start_line=line_number; Loading
mysql-test/include/ctype_regex.inc 0 → 100644 +42 −0 Original line number Diff line number Diff line # # To test a desired collation, set session.collation_connection to # this collation before including this file # --disable_warnings drop table if exists t1; --enable_warnings # # Create a table with two varchar(64) null-able column, # using current values of # @@character_set_connection and @@collation_connection. # create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; drop table t1;
mysql-test/r/ctype_euckr.result +41 −0 Original line number Diff line number Diff line Loading @@ -178,3 +178,44 @@ hex(a) A2E6 FEF7 DROP TABLE t1; create table t1 (s1 varchar(5) character set euckr); insert into t1 values (0xA141); insert into t1 values (0xA15A); insert into t1 values (0xA161); insert into t1 values (0xA17A); insert into t1 values (0xA181); insert into t1 values (0xA1FE); insert into t1 values (0xA140); Warnings: Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1 insert into t1 values (0xA15B); Warnings: Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1 insert into t1 values (0xA160); Warnings: Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1 insert into t1 values (0xA17B); Warnings: Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1 insert into t1 values (0xA180); Warnings: Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1 insert into t1 values (0xA1FF); Warnings: Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1 select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1; hex(s1) hex(convert(s1 using utf8)) A141 ECA2A5 A15A ECA381 A161 ECA382 A17A ECA3A5 A181 ECA3A6 A1FE EFBFA2 drop table t1; End of 5.0 tests
mysql-test/r/ctype_uca.result +45 −0 Original line number Diff line number Diff line Loading @@ -2767,4 +2767,49 @@ a c ch drop table t1; set collation_connection=ucs2_unicode_ci; drop table if exists t1; create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) character set ucs2 collate ucs2_unicode_ci default NULL, `s2` varchar(64) character set ucs2 collate ucs2_unicode_ci default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; s1 regexp s2 1 1 1 1 1 1 1 0 0 0 NULL NULL NULL NULL drop table t1; set names utf8; End for 5.0 tests
mysql-test/r/ctype_ucs.result +45 −0 Original line number Diff line number Diff line Loading @@ -922,6 +922,51 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' drop table t1; set collation_connection=ucs2_general_ci; drop table if exists t1; create table t1 as select repeat(' ', 64) as s1, repeat(' ',64) as s2 union select null, null; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `s1` varchar(64) character set ucs2 default NULL, `s2` varchar(64) character set ucs2 default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 delete from t1; insert into t1 values('aaa','aaa'); insert into t1 values('aaa|qqq','qqq'); insert into t1 values('gheis','^[^a-dXYZ]+$'); insert into t1 values('aab','^aa?b'); insert into t1 values('Baaan','^Ba*n'); insert into t1 values('aaa','qqq|aaa'); insert into t1 values('qqq','qqq|aaa'); insert into t1 values('bbb','qqq|aaa'); insert into t1 values('bbb','qqq'); insert into t1 values('aaa','aba'); insert into t1 values(null,'abc'); insert into t1 values('def',null); insert into t1 values(null,null); insert into t1 values('ghi','ghi['); select HIGH_PRIORITY s1 regexp s2 from t1; s1 regexp s2 1 1 1 1 1 1 1 0 0 0 NULL NULL NULL NULL drop table t1; set names latin1; select hex(char(0x41 using ucs2)); hex(char(0x41 using ucs2)) 0041 Loading