innodb_handler.result 2.68 KB
Newer Older
1
drop table if exists t1,t2;
unknown's avatar
unknown committed
2
create table t1 (a int, b char(10), key a(a), key b(a,b)) engine=innodb;
unknown's avatar
unknown committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
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;
a	b
14	aaa
handler t2 read a next;
a	b
15	bbb
handler t2 read a next;
a	b
16	ccc
handler t2 read a prev;
a	b
15	bbb
handler t2 read a last;
a	b
22	iii
handler t2 read a prev;
a	b
21	hhh
handler t2 read a prev;
a	b
20	ggg
handler t2 read a first;
a	b
14	aaa
handler t2 read a prev;
a	b
handler t2 read a last;
a	b
22	iii
handler t2 read a prev;
a	b
21	hhh
handler t2 read a next;
a	b
22	iii
handler t2 read a next;
a	b
handler t2 read a=(15);
a	b
15	bbb
handler t2 read a=(16);
a	b
16	ccc
handler t2 read a=(19,"fff");
52
ERROR 42000: Too many key parts specified; max 1 parts allowed
unknown's avatar
unknown committed
53 54 55 56 57 58 59 60 61 62
handler t2 read b=(19,"fff");
a	b
19	fff
handler t2 read b=(19,"yyy");
a	b
19	yyy
handler t2 read b=(19);
a	b
19	fff
handler t1 read a last;
63
ERROR 42S02: Unknown table 't1' in HANDLER
unknown's avatar
unknown committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
handler t2 read a=(11);
a	b
handler t2 read a>=(11);
a	b
14	aaa
handler t2 read a=(18);
a	b
18	eee
handler t2 read a>=(18);
a	b
18	eee
handler t2 read a>(18);
a	b
19	fff
handler t2 read a<=(18);
a	b
18	eee
handler t2 read a<(18);
a	b
17	ddd
handler t2 read a first limit 5;
a	b
14	aaa
15	bbb
16	ccc
16	xxx
17	ddd
handler t2 read a next  limit 3;
a	b
18	eee
19	fff
19	yyy
handler t2 read a prev  limit 10;
a	b
19	fff
18	eee
17	ddd
16	xxx
16	ccc
15	bbb
14	aaa
handler t2 read a>=(16) limit 4;
a	b
16	ccc
16	xxx
17	ddd
18	eee
handler t2 read a>=(16) limit 2,2;
a	b
17	ddd
18	eee
handler t2 read a last  limit 3;
a	b
22	iii
21	hhh
20	ggg
handler t2 read a=(19);
a	b
19	fff
handler t2 read a=(19) where b="yyy";
a	b
19	yyy
handler t2 read first;
a	b
17	ddd
handler t2 read next;
a	b
18	eee
handler t2 read last;
133
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
unknown's avatar
unknown committed
134
handler t2 close;
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
handler t1 open;
handler t1 read a next;
a	b
14	aaa
handler t1 read a next;
a	b
15	bbb
handler t1 close;
handler t1 open;
handler t1 read a prev;
a	b
22	iii
handler t1 read a prev;
a	b
21	hhh
handler t1 close;
unknown's avatar
unknown committed
151 152
handler t1 open as t2;
handler t2 read first;
unknown's avatar
unknown committed
153
a	b
unknown's avatar
unknown committed
154
17	ddd
unknown's avatar
unknown committed
155
alter table t1 engine=innodb;
unknown's avatar
unknown committed
156
handler t2 read first;
157
ERROR 42S02: Unknown table 't2' in HANDLER
158
drop table t1;
unknown's avatar
unknown committed
159
CREATE TABLE t1 (  no1 smallint(5) NOT NULL default '0',  no2 int(10) NOT NULL default '0',  PRIMARY KEY  (no1,no2)) ENGINE=InnoDB;
160 161 162 163 164 165
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);
no1	no2
HANDLER t1 READ `primary` PREV;
no1	no2
166
1	275
167
DROP TABLE t1;