1
by brian
clean slate |
1 |
#
|
2 |
# Test of like
|
|
3 |
#
|
|
4 |
||
5 |
--disable_warnings |
|
6 |
drop table if exists t1; |
|
7 |
--enable_warnings |
|
8 |
||
9 |
create table t1 (a varchar(10), key(a)); |
|
10 |
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); |
|
11 |
explain extended select * from t1 where a like 'abc%'; |
|
12 |
explain extended select * from t1 where a like concat('abc','%'); |
|
13 |
select * from t1 where a like "abc%"; |
|
14 |
select * from t1 where a like concat("abc","%"); |
|
15 |
select * from t1 where a like "ABC%"; |
|
16 |
select * from t1 where a like "test%"; |
|
17 |
select * from t1 where a like "te_t"; |
|
18 |
||
19 |
#
|
|
20 |
# The following will test the Turbo Boyer-Moore code
|
|
21 |
#
|
|
22 |
select * from t1 where a like "%a%"; |
|
23 |
select * from t1 where a like "%abcd%"; |
|
24 |
select * from t1 where a like "%abc\d%"; |
|
25 |
||
26 |
drop table t1; |
|
27 |
||
28 |
create table t1 (a varchar(10), key(a)); |
|
29 |
||
30 |
#
|
|
31 |
# Bug #2231
|
|
32 |
#
|
|
33 |
insert into t1 values ('a'), ('a\\b'); |
|
34 |
select * from t1 where a like 'a\\%' escape '#'; |
|
35 |
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b'; |
|
36 |
||
37 |
#
|
|
38 |
# Bug #2885: like and datetime
|
|
39 |
#
|
|
40 |
||
41 |
drop table t1; |
|
42 |
create table t1 (a datetime); |
|
43 |
insert into t1 values ('2004-03-11 12:00:21'); |
|
44 |
select * from t1 where a like '2004-03-11 12:00:21'; |
|
45 |
drop table t1; |
|
46 |
||
47 |
#
|
|
48 |
# End of 4.1 tests
|