2
# Common tests for all character sets and collations.
3
# Include this file from a test with @test_characrer_set
4
# and @test_collation set to desired values.
6
# Please don't use SHOW CREATE TABLE in this file,
7
# we want it to be HANDLER independent. You can
8
# use SHOW FULL COLUMNS instead.
10
# Please surround all CREATE TABLE with --disable_warnings
11
# and --enable_warnings to be able to set storage_engine
12
# without having to check if the hanlder exists.
14
SET @safe_character_set_server= @@character_set_server;
15
SET @safe_collation_server= @@collation_server;
16
SET @safe_character_set_client= @@character_set_client;
17
SET @safe_character_set_results= @@character_set_results;
18
SET character_set_server= @test_character_set;
19
SET collation_server= @test_collation;
24
# Bug 1883: LIKE did not work in some cases with a key.
27
CREATE TABLE t1 (c CHAR(10), KEY(c));
29
# check the column was created with the expected charset/collation
30
--replace_result select,insert,update,references ""
31
SHOW FULL COLUMNS FROM t1;
32
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
33
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
37
# Bug 6643 incorrect response with partial utf8 index
40
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
42
# check the column was created with the expected charset/collation
43
--replace_result select,insert,update,references ""
44
SHOW FULL COLUMNS FROM t1;
45
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
46
SELECT c1 as want3results from t1 where c1 like 'l%';
47
SELECT c1 as want3results from t1 where c1 like 'lo%';
48
SELECT c1 as want1result from t1 where c1 like 'loc%';
49
SELECT c1 as want1result from t1 where c1 like 'loca%';
50
SELECT c1 as want1result from t1 where c1 like 'locat%';
51
SELECT c1 as want1result from t1 where c1 like 'locati%';
52
SELECT c1 as want1result from t1 where c1 like 'locatio%';
53
SELECT c1 as want1result from t1 where c1 like 'location%';
57
# Bug #31070: crash during conversion of charsets
58
# Bug #32726: crash with cast in order by clause and cp932 charset
60
create table t1 (a set('a') not null);
61
insert into t1 values (),();
62
select cast(a as char(1)) from t1;
63
select a sounds like a from t1;
64
select 1 from t1 order by cast(a as char(1));
68
# Bug#27580 SPACE() function collation bug?
73
level smallint unsigned);
75
insert into t1 values ('string',1);
76
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
82
SET character_set_server= @safe_character_set_server;
83
SET collation_server= @safe_collation_server;
84
SET character_set_client= @safe_character_set_client;
85
SET character_set_results= @safe_character_set_results;