2000-12-28 02:56:38 +01:00
|
|
|
#
|
|
|
|
# Test of like
|
|
|
|
#
|
|
|
|
|
2001-09-14 01:54:33 +02:00
|
|
|
drop table if exists t1;
|
2000-12-28 02:56:38 +01:00
|
|
|
create table t1 (a varchar(10), key(a));
|
|
|
|
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
|
2003-03-02 14:07:32 +01:00
|
|
|
explain select * from t1 where a like 'abc%';
|
|
|
|
explain select * from t1 where a like concat('abc','%');
|
|
|
|
select * from t1 where a like "abc%";
|
|
|
|
select * from t1 where a like concat("abc","%");
|
|
|
|
select * from t1 where a like "ABC%";
|
|
|
|
select * from t1 where a like "test%";
|
|
|
|
select * from t1 where a like "te_t";
|
2002-05-17 15:45:00 +02:00
|
|
|
|
|
|
|
#
|
2002-05-21 00:07:09 +02:00
|
|
|
# The following will test the Turbo Boyer-Moore code
|
2002-05-17 15:45:00 +02:00
|
|
|
#
|
|
|
|
select * from t1 where a like "%a%";
|
|
|
|
select * from t1 where a like "%abcd%";
|
|
|
|
select * from t1 where a like "%abc\d%";
|
|
|
|
|
2000-12-28 02:56:38 +01:00
|
|
|
drop table t1;
|
2003-12-30 16:23:38 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug #2231
|
|
|
|
#
|
|
|
|
|
|
|
|
create table t1 (a varchar(10), key(a));
|
|
|
|
insert into t1 values ('a'), ('a\\b');
|
|
|
|
select * from t1 where a like 'a\\%' escape '#';
|
2004-01-08 09:24:36 +01:00
|
|
|
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
|
2003-12-30 16:23:38 +01:00
|
|
|
drop table t1;
|