~vadim-tk/percona-server/percona-galera-5.1.57

« back to all changes in this revision

Viewing changes to mysql-test/t/ctype_latin1_de.test

  • Committer: root
  • Date: 2011-07-10 16:09:24 UTC
  • Revision ID: root@r815.office.percona.com-20110710160924-fyffqsbaclgu6vui
Initial port

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test latin_de character set
 
3
#
 
4
 
 
5
set names latin1;
 
6
set @@collation_connection=latin1_german2_ci;
 
7
 
 
8
select @@collation_connection;
 
9
 
 
10
--disable_warnings
 
11
drop table if exists t1;
 
12
--enable_warnings
 
13
 
 
14
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
 
15
insert into t1 (a) values ('�'),('ac'),('ae'),('ad'),('�c'),('aeb');
 
16
insert into t1 (a) values ('�c'),('uc'),('ue'),('ud'),('�'),('ueb'),('uf');
 
17
insert into t1 (a) values ('�'),('oc'),('�a'),('oe'),('od'),('�c'),('oeb');
 
18
insert into t1 (a) values ('s'),('ss'),('�'),('�b'),('ssa'),('ssc'),('�a');
 
19
insert into t1 (a) values ('e�'),('u�'),('�o'),('��'),('��a'),('aeae');
 
20
insert into t1 (a) values ('q'),('a'),('u'),('o'),('�'),('�'),('a');
 
21
select a,b from t1 order by a,b;
 
22
select a,b from t1 order by upper(a),b;
 
23
select a from t1 order by a desc;
 
24
check table t1;
 
25
select * from t1 where a like "�%";
 
26
select * from t1 where a like binary "%�%";
 
27
select * from t1 where a like "%�%";
 
28
select * from t1 where a like "%U%";
 
29
select * from t1 where a like "%ss%";
 
30
drop table t1;
 
31
 
 
32
# The following should all be true
 
33
select strcmp('�','ae'),strcmp('ae','�'),strcmp('aeq','�q'),strcmp('�q','aeq');
 
34
select strcmp('ss','�'),strcmp('�','ss'),strcmp('�s','sss'),strcmp('�q','ssq');
 
35
 
 
36
# The following should all return -1
 
37
select strcmp('�','af'),strcmp('a','�'),strcmp('��','aeq'),strcmp('��','aeaeq');
 
38
select strcmp('ss','�a'),strcmp('�','ssa'),strcmp('s�a','sssb'),strcmp('s','�');
 
39
select strcmp('�','o�'),strcmp('�','u�'),strcmp('�','oeb');
 
40
 
 
41
# The following should all return 1
 
42
select strcmp('af','�'),strcmp('�','a'),strcmp('aeq','��'),strcmp('aeaeq','��');
 
43
select strcmp('�a','ss'),strcmp('ssa','�'),strcmp('sssb','s�a'),strcmp('�','s');
 
44
select strcmp('u','�a'),strcmp('u','�');
 
45
 
 
46
#
 
47
# overlapping combo's
 
48
#
 
49
select strcmp('s�', '�a'), strcmp('a�', '�x');
 
50
#
 
51
# Some other simple tests with the current character set
 
52
#
 
53
 
 
54
create table t1 (a varchar(10), key(a), fulltext (a));
 
55
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
 
56
select * from t1 where a like "abc%"; 
 
57
select * from t1 where a like "test%"; 
 
58
select * from t1 where a like "te_t"; 
 
59
select * from t1 where match a against ("te*" in boolean mode)+0;
 
60
drop table t1;
 
61
 
 
62
#
 
63
# Test bug report #152 (problem with index on latin1_de)
 
64
#
 
65
 
 
66
#
 
67
# The below checks both binary and character comparisons.
 
68
#
 
69
create table t1 (word varchar(255) not null, word2 varchar(255) not null default '', index(word));
 
70
show create table t1;
 
71
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
 
72
update t1 set word2=word;
 
73
select word, word=binary 0xdf as t from t1 having t > 0;
 
74
select word, word=cast(0xdf AS CHAR) as t from t1 having t > 0;
 
75
select * from t1 where word=binary 0xDF;
 
76
select * from t1 where word=CAST(0xDF as CHAR);
 
77
select * from t1 where word2=binary 0xDF;
 
78
select * from t1 where word2=CAST(0xDF as CHAR);
 
79
select * from t1 where word='ae';
 
80
select * from t1 where word= 0xe4 or word=CAST(0xe4 as CHAR);
 
81
select * from t1 where word between binary 0xDF and binary 0xDF;
 
82
select * from t1 where word between CAST(0xDF AS CHAR) and CAST(0xDF AS CHAR);
 
83
select * from t1 where word like 'ae';
 
84
select * from t1 where word like 'AE';
 
85
select * from t1 where word like binary 0xDF;
 
86
select * from t1 where word like CAST(0xDF as CHAR);
 
87
drop table t1;
 
88
 
 
89
#
 
90
# Bug #5447 Select does not find records
 
91
#
 
92
CREATE TABLE t1 (
 
93
  autor varchar(80) NOT NULL default '',
 
94
  PRIMARY KEY  (autor)
 
95
);
 
96
INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
 
97
('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
 
98
('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
 
99
SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
 
100
DROP TABLE t1;
 
101
 
 
102
#
 
103
# Test of special character in german collation
 
104
#
 
105
 
 
106
CREATE TABLE t1 (
 
107
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
 
108
);
 
109
show create table t1;
 
110
INSERT INTO t1 VALUES ('�');
 
111
INSERT INTO t1 VALUES ('ue');
 
112
SELECT DISTINCT s1 FROM t1;
 
113
SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
 
114
SELECT COUNT(DISTINCT s1) FROM t1;
 
115
SELECT FIELD('ue',s1), FIELD('�',s1), s1='ue', s1='�' FROM t1;
 
116
DROP TABLE t1;
 
117
 
 
118
-- source include/ctype_filesort.inc
 
119
-- source include/ctype_german.inc
 
120
 
 
121
#
 
122
# Bug#7878 with utf8_general_ci, equals (=) has problem with
 
123
# accent insensitivity.
 
124
# Although originally this problem was found with UTF8 character set,
 
125
# '=' behaved wrong for latin1_german2_ci as well.
 
126
# Let's check it does not work incorrect anymore.
 
127
 
128
SET NAMES latin1;
 
129
CREATE TABLE t1 (
 
130
  col1 varchar(255) NOT NULL default ''
 
131
) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci;
 
132
INSERT INTO t1 VALUES ('�'),('ss'),('ss');
 
133
ALTER TABLE t1 ADD KEY ifword(col1);
 
134
SELECT * FROM t1 WHERE col1='�' ORDER BY col1, BINARY col1;
 
135
DROP TABLE t1;
 
136
 
 
137
# End of 4.1 tests
 
138
 
 
139
#
 
140
# Bug#9509
 
141
#
 
142
create table t1 (s1 char(5) character set latin1 collate latin1_german2_ci);
 
143
insert into t1 values (0xf6) /* this is o-umlaut */;
 
144
select * from t1 where length(s1)=1 and s1='oe';
 
145
drop table t1;