~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_like.test

  • Committer: Monty Taylor
  • Date: 2008-09-06 00:05:54 UTC
  • mfrom: (377.1.5 drizzle)
  • Revision ID: monty@inaugust.com-20080906000554-lvjbntm1d6jgcqt4
Merged in from brian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
drop table t1;
46
46
 
47
47
#
48
 
# Test like with non-default character set
49
 
#
50
 
 
51
 
SET NAMES koi8r;
52
 
 
53
 
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
54
 
 
55
 
INSERT INTO t1 VALUES ('����'),('����'),('����'),('����'),('����'),('����');
56
 
INSERT INTO t1 VALUES ('����������'),('����������'),('����������'),('����������');
57
 
INSERT INTO t1 VALUES ('����������'),('����������'),('����������'),('����������');
58
 
INSERT INTO t1 VALUES ('����������'),('����������'),('����������'),('����������');
59
 
 
60
 
SELECT * FROM t1 WHERE a LIKE '%����%';
61
 
SELECT * FROM t1 WHERE a LIKE '%���%';
62
 
SELECT * FROM t1 WHERE a LIKE '����%';
63
 
 
64
 
DROP TABLE t1;
65
 
 
66
 
# Bug #2547 Strange "like" behaviour in tables with default charset=cp1250
67
 
# Test like with non-default character set using TurboBM
68
 
#
69
 
SET NAMES cp1250;
70
 
CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
71
 
INSERT INTO t1 VALUES
72
 
('Techni Tapes Sp. z o.o.'),
73
 
('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
74
 
('AKAPESTER 1 P.P.H.U.'),
75
 
('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
76
 
('PPUH PESKA-I Maria Struniarska');
77
 
 
78
 
select * from t1 where a like '%PESA%';
79
 
select * from t1 where a like '%PESA %';
80
 
select * from t1 where a like '%PES%';
81
 
select * from t1 where a like '%PESKA%';
82
 
select * from t1 where a like '%ESKA%';
83
 
DROP TABLE t1;
84
 
 
85
 
#
86
 
# LIKE crashed for binary collations in some cases
87
 
#
88
 
select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
89
 
 
90
 
#
91
 
# Check 8bit escape character
92
 
#
93
 
set names koi8r;
94
 
select 'andre%' like 'andre�%' escape '�';
95
 
 
96
 
# Check 8bit escape character with charset conversion:
97
 
# For "a LIKE b ESCAPE c" expressions,
98
 
# escape character is converted into the operation character set,
99
 
# which is result of aggregation  of character sets of "a" and "b".
100
 
# "c" itself doesn't take part in aggregation, because its collation
101
 
# doesn't matter, escape character is always compared binary.
102
 
# In the example below, escape character is converted from koi8r into cp1251:
103
 
#
104
 
select _cp1251'andre%' like convert('andre�%' using cp1251)  escape '�';
105
 
 
106
 
#
107
48
# End of 4.1 tests