innodb_handler.test 2.06 KB
Newer Older
1 2 3 4 5 6
-- source include/have_innodb.inc

#
# test of HANDLER ...
#

7 8 9 10
--disable_warnings
drop table if exists t1,t2;
--enable_warnings

11
create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
handler t1 open as t2;
handler t2 read a first;
handler t2 read a next;
handler t2 read a next;
handler t2 read a prev;
handler t2 read a last;
handler t2 read a prev;
handler t2 read a prev;

handler t2 read a first;
handler t2 read a prev;

handler t2 read a last;
handler t2 read a prev;
handler t2 read a next;
handler t2 read a next;

handler t2 read a=(15);
handler t2 read a=(16);

36 37
--error 1070
handler t2 read a=(19,"fff");
38 39 40 41 42

handler t2 read b=(19,"fff");
handler t2 read b=(19,"yyy");
handler t2 read b=(19);

43 44
--error 1109
handler t1 read a last;
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

handler t2 read a=(11);
handler t2 read a>=(11);

handler t2 read a=(18);
handler t2 read a>=(18);
handler t2 read a>(18);
handler t2 read a<=(18);
handler t2 read a<(18);

handler t2 read a first limit 5;
handler t2 read a next  limit 3;
handler t2 read a prev  limit 10;

handler t2 read a>=(16) limit 4;
handler t2 read a>=(16) limit 2,2;
handler t2 read a last  limit 3;

handler t2 read a=(19);
handler t2 read a=(19) where b="yyy";

handler t2 read first;
handler t2 read next;
68 69
--error 1064
handler t2 read last;
70
handler t2 close;
serg@serg.mysql.com's avatar
serg@serg.mysql.com committed
71

72 73 74 75 76 77 78 79 80 81
handler t1 open;
handler t1 read a next; # this used to crash as a bug#5373
handler t1 read a next;
handler t1 close;

handler t1 open;
handler t1 read a prev; # this used to crash as a bug#5373
handler t1 read a prev;
handler t1 close;

serg@serg.mysql.com's avatar
serg@serg.mysql.com committed
82 83
handler t1 open as t2;
handler t2 read first;
84
alter table t1 engine=innodb;
serg@serg.mysql.com's avatar
serg@serg.mysql.com committed
85
--error 1109
serg@serg.mysql.com's avatar
serg@serg.mysql.com committed
86
handler t2 read first;
87

88
drop table t1;
89
CREATE TABLE t1 (  no1 smallint(5) NOT NULL default '0',  no2 int(10) NOT NULL default '0',  PRIMARY KEY  (no1,no2)) ENGINE=InnoDB;
90 91 92 93 94
INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2);
HANDLER t1 OPEN;
HANDLER t1 READ `primary` = (1, 1000);
HANDLER t1 READ `primary` PREV;
DROP TABLE t1;
95