handler.result
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:10k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. drop table if exists t1;
  2. create table t1 (a int, b char(10), key a(a), key b(a,b));
  3. insert into t1 values
  4. (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
  5. (14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"),
  6. (20,"ggg"),(21,"hhh"),(22,"iii");
  7. handler t1 open as t2;
  8. handler t2 read a=(SELECT 1);
  9. 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 'SELECT 1)' at line 1
  10. handler t2 read a first;
  11. a b
  12. 14 aaa
  13. handler t2 read a next;
  14. a b
  15. 15 bbb
  16. handler t2 read a next;
  17. a b
  18. 16 ccc
  19. handler t2 read a prev;
  20. a b
  21. 15 bbb
  22. handler t2 read a last;
  23. a b
  24. 22 iii
  25. handler t2 read a prev;
  26. a b
  27. 21 hhh
  28. handler t2 read a prev;
  29. a b
  30. 20 ggg
  31. handler t2 read a first;
  32. a b
  33. 14 aaa
  34. handler t2 read a prev;
  35. a b
  36. handler t2 read a last;
  37. a b
  38. 22 iii
  39. handler t2 read a prev;
  40. a b
  41. 21 hhh
  42. handler t2 read a next;
  43. a b
  44. 22 iii
  45. handler t2 read a next;
  46. a b
  47. handler t2 read a=(15);
  48. a b
  49. 15 bbb
  50. handler t2 read a=(16);
  51. a b
  52. 16 ccc
  53. handler t2 read a=(19,"fff");
  54. ERROR 42000: Too many key parts specified; max 1 parts allowed
  55. handler t2 read b=(19,"fff");
  56. a b
  57. 19 fff
  58. handler t2 read b=(19,"yyy");
  59. a b
  60. 19 yyy
  61. handler t2 read b=(19);
  62. a b
  63. 19 fff
  64. handler t1 read a last;
  65. ERROR 42S02: Unknown table 't1' in HANDLER
  66. handler t2 read a=(11);
  67. a b
  68. handler t2 read a>=(11);
  69. a b
  70. 14 aaa
  71. handler t2 read a=(18);
  72. a b
  73. 18 eee
  74. handler t2 read a>=(18);
  75. a b
  76. 18 eee
  77. handler t2 read a>(18);
  78. a b
  79. 19 fff
  80. handler t2 read a<=(18);
  81. a b
  82. 18 eee
  83. handler t2 read a<(18);
  84. a b
  85. 17 ddd
  86. handler t2 read a first limit 5;
  87. a b
  88. 14 aaa
  89. 15 bbb
  90. 16 ccc
  91. 16 xxx
  92. 17 ddd
  93. handler t2 read a next  limit 3;
  94. a b
  95. 18 eee
  96. 19 fff
  97. 19 yyy
  98. handler t2 read a prev  limit 10;
  99. a b
  100. 19 fff
  101. 18 eee
  102. 17 ddd
  103. 16 xxx
  104. 16 ccc
  105. 15 bbb
  106. 14 aaa
  107. handler t2 read a>=(16) limit 4;
  108. a b
  109. 16 ccc
  110. 16 xxx
  111. 17 ddd
  112. 18 eee
  113. handler t2 read a>=(16) limit 2,2;
  114. a b
  115. 17 ddd
  116. 18 eee
  117. handler t2 read a last  limit 3;
  118. a b
  119. 22 iii
  120. 21 hhh
  121. 20 ggg
  122. handler t2 read a=(19);
  123. a b
  124. 19 fff
  125. handler t2 read a=(19) where b="yyy";
  126. a b
  127. 19 yyy
  128. handler t2 read first;
  129. a b
  130. 17 ddd
  131. handler t2 read next;
  132. a b
  133. 18 eee
  134. handler t2 read next;
  135. a b
  136. 19 fff
  137. handler t2 read last;
  138. 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
  139. handler t2 close;
  140. handler t1 open as t2;
  141. drop table t1;
  142. create table t1 (a int);
  143. insert into t1 values (17);
  144. handler t2 read first;
  145. ERROR 42S02: Unknown table 't2' in HANDLER
  146. handler t1 open as t2;
  147. alter table t1 engine=MyISAM;
  148. handler t2 read first;
  149. ERROR 42S02: Unknown table 't2' in HANDLER
  150. drop table t1;
  151. create table t1 (a int);
  152. insert into t1 values (1),(2),(3),(4),(5),(6);
  153. delete from t1 limit 2;
  154. handler t1 open;
  155. handler t1 read first;
  156. a
  157. 3
  158. handler t1 read first limit 1,1;
  159. a
  160. 4
  161. handler t1 read first limit 2,2;
  162. a
  163. 5
  164. 6
  165. delete from t1 limit 3;
  166. handler t1 read first;
  167. a
  168. 6
  169. drop table t1;
  170. create table t1(a int, index(a));
  171. insert into t1 values (1), (2), (3);
  172. handler t1 open;
  173. handler t1 read a=(W);
  174. ERROR 42S22: Unknown column 'W' in 'field list'
  175. handler t1 read a=(a);
  176. ERROR HY000: Incorrect arguments to HANDLER ... READ
  177. drop table t1;
  178. create table t1 (a char(5));
  179. insert into t1 values ("Ok");
  180. handler t1 open as t;
  181. handler t read first;
  182. a
  183. Ok
  184. use mysql;
  185. handler t read first;
  186. a
  187. Ok
  188. handler t close;
  189. handler test.t1 open as t;
  190. handler t read first;
  191. a
  192. Ok
  193. handler t close;
  194. use test;
  195. drop table t1;
  196. create table t1 ( a int, b int, INDEX a (a) );
  197. insert into t1 values (1,2), (2,1);
  198. handler t1 open;
  199. handler t1 read a=(1) where b=2;
  200. a b
  201. 1 2
  202. handler t1 read a=(1) where b=3;
  203. a b
  204. handler t1 read a=(1) where b=1;
  205. a b
  206. handler t1 close;
  207. drop table t1;
  208. drop database if exists test_test;
  209. create database test_test;
  210. use test_test;
  211. create table t1(table_id char(20) primary key);
  212. insert into t1 values ('test_test.t1');
  213. insert into t1 values ('');
  214. handler t1 open;
  215. handler t1 read first limit 9;
  216. table_id
  217. test_test.t1
  218. create table t2(table_id char(20) primary key);
  219. insert into t2 values ('test_test.t2');
  220. insert into t2 values ('');
  221. handler t2 open;
  222. handler t2 read first limit 9;
  223. table_id
  224. test_test.t2
  225. use test;
  226. drop table if exists t1;
  227. create table t1(table_id char(20) primary key);
  228. insert into t1 values ('test.t1');
  229. insert into t1 values ('');
  230. handler t1 open;
  231. ERROR 42000: Not unique table/alias: 't1'
  232. use test;
  233. handler test.t1 read first limit 9;
  234. 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 'read first limit 9' at line 1
  235. handler test_test.t1 read first limit 9;
  236. 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 'read first limit 9' at line 1
  237. handler t1 read first limit 9;
  238. table_id
  239. test_test.t1
  240. handler test_test.t2 read first limit 9;
  241. 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 'read first limit 9' at line 1
  242. handler t2 read first limit 9;
  243. table_id
  244. test_test.t2
  245. handler test_test.t1 close;
  246. 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 'close' at line 1
  247. handler t1 close;
  248. drop table test_test.t1;
  249. handler test_test.t2 close;
  250. 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 'close' at line 1
  251. handler t2 close;
  252. drop table test_test.t2;
  253. drop database test_test;
  254. use test;
  255. handler test.t1 close;
  256. 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 'close' at line 1
  257. handler t1 close;
  258. ERROR 42S02: Unknown table 't1' in HANDLER
  259. drop table test.t1;
  260. drop database if exists test_test;
  261. drop table if exists t1;
  262. drop table if exists t2;
  263. drop table if exists t3;
  264. create database test_test;
  265. use test_test;
  266. create table t1 (c1 char(20));
  267. insert into t1 values ('test_test.t1');
  268. create table t3 (c1 char(20));
  269. insert into t3 values ('test_test.t3');
  270. handler t1 open;
  271. handler t1 read first limit 9;
  272. c1
  273. test_test.t1
  274. handler t1 open h1;
  275. handler h1 read first limit 9;
  276. c1
  277. test_test.t1
  278. use test;
  279. create table t1 (c1 char(20));
  280. create table t2 (c1 char(20));
  281. create table t3 (c1 char(20));
  282. insert into t1 values ('t1');
  283. insert into t2 values ('t2');
  284. insert into t3 values ('t3');
  285. handler t1 open;
  286. ERROR 42000: Not unique table/alias: 't1'
  287. handler t2 open t1;
  288. ERROR 42000: Not unique table/alias: 't1'
  289. handler t3 open t1;
  290. ERROR 42000: Not unique table/alias: 't1'
  291. handler t1 read first limit 9;
  292. c1
  293. test_test.t1
  294. handler test.t1 close;
  295. 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 'close' at line 1
  296. handler test.t1 open h1;
  297. ERROR 42000: Not unique table/alias: 'h1'
  298. handler test_test.t1 open h1;
  299. ERROR 42000: Not unique table/alias: 'h1'
  300. handler test_test.t3 open h3;
  301. handler test.t1 open h2;
  302. handler t1 read first limit 9;
  303. c1
  304. test_test.t1
  305. handler h1 read first limit 9;
  306. c1
  307. test_test.t1
  308. handler h2 read first limit 9;
  309. c1
  310. t1
  311. handler h3 read first limit 9;
  312. c1
  313. test_test.t3
  314. handler h2 read first limit 9;
  315. c1
  316. t1
  317. handler test.h1 close;
  318. 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 'close' at line 1
  319. handler t1 close;
  320. handler h1 close;
  321. handler h2 close;
  322. handler t1 read first limit 9;
  323. ERROR 42S02: Unknown table 't1' in HANDLER
  324. handler h1 read first limit 9;
  325. ERROR 42S02: Unknown table 'h1' in HANDLER
  326. handler h2 read first limit 9;
  327. ERROR 42S02: Unknown table 'h2' in HANDLER
  328. handler h3 read first limit 9;
  329. c1
  330. test_test.t3
  331. handler h3 read first limit 9;
  332. c1
  333. test_test.t3
  334. use test_test;
  335. handler h3 read first limit 9;
  336. c1
  337. test_test.t3
  338. handler test.h3 read first limit 9;
  339. 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 'read first limit 9' at line 1
  340. handler h3 close;
  341. use test;
  342. drop table t3;
  343. drop table t2;
  344. drop table t1;
  345. drop database test_test;
  346. create table t1 (c1 char(20));
  347. insert into t1 values ("t1");
  348. handler t1 open as h1;
  349. handler h1 read first limit 9;
  350. c1
  351. t1
  352. create table t2 (c1 char(20));
  353. insert into t2 values ("t2");
  354. handler t2 open as h2;
  355. handler h2 read first limit 9;
  356. c1
  357. t2
  358. create table t3 (c1 char(20));
  359. insert into t3 values ("t3");
  360. handler t3 open as h3;
  361. handler h3 read first limit 9;
  362. c1
  363. t3
  364. create table t4 (c1 char(20));
  365. insert into t4 values ("t4");
  366. handler t4 open as h4;
  367. handler h4 read first limit 9;
  368. c1
  369. t4
  370. create table t5 (c1 char(20));
  371. insert into t5 values ("t5");
  372. handler t5 open as h5;
  373. handler h5 read first limit 9;
  374. c1
  375. t5
  376. alter table t1 engine=MyISAM;
  377. handler h1 read first limit 9;
  378. ERROR 42S02: Unknown table 'h1' in HANDLER
  379. handler h2 read first limit 9;
  380. c1
  381. t2
  382. handler h3 read first limit 9;
  383. c1
  384. t3
  385. handler h4 read first limit 9;
  386. c1
  387. t4
  388. handler h5 read first limit 9;
  389. c1
  390. t5
  391. alter table t5 engine=MyISAM;
  392. handler h1 read first limit 9;
  393. ERROR 42S02: Unknown table 'h1' in HANDLER
  394. handler h2 read first limit 9;
  395. c1
  396. t2
  397. handler h3 read first limit 9;
  398. c1
  399. t3
  400. handler h4 read first limit 9;
  401. c1
  402. t4
  403. handler h5 read first limit 9;
  404. ERROR 42S02: Unknown table 'h5' in HANDLER
  405. alter table t3 engine=MyISAM;
  406. handler h1 read first limit 9;
  407. ERROR 42S02: Unknown table 'h1' in HANDLER
  408. handler h2 read first limit 9;
  409. c1
  410. t2
  411. handler h3 read first limit 9;
  412. ERROR 42S02: Unknown table 'h3' in HANDLER
  413. handler h4 read first limit 9;
  414. c1
  415. t4
  416. handler h5 read first limit 9;
  417. ERROR 42S02: Unknown table 'h5' in HANDLER
  418. handler h2 close;
  419. handler h4 close;
  420. handler t1 open as h1_1;
  421. handler t1 open as h1_2;
  422. handler t1 open as h1_3;
  423. handler h1_1 read first limit 9;
  424. c1
  425. t1
  426. handler h1_2 read first limit 9;
  427. c1
  428. t1
  429. handler h1_3 read first limit 9;
  430. c1
  431. t1
  432. alter table t1 engine=MyISAM;
  433. handler h1_1 read first limit 9;
  434. ERROR 42S02: Unknown table 'h1_1' in HANDLER
  435. handler h1_2 read first limit 9;
  436. ERROR 42S02: Unknown table 'h1_2' in HANDLER
  437. handler h1_3 read first limit 9;
  438. ERROR 42S02: Unknown table 'h1_3' in HANDLER
  439. drop table t1;
  440. drop table t2;
  441. drop table t3;
  442. drop table t4;
  443. drop table t5;
  444. create table t1 (c1 int);
  445. insert into t1 values (1);
  446. handler t1 open;
  447. handler t1 read first;
  448. c1
  449. 1
  450. send the below to another connection, do not wait for the result
  451.  optimize table t1;
  452. proceed with the normal connection
  453. handler t1 read next;
  454. c1
  455. 1
  456. handler t1 close;
  457. read the result from the other connection
  458. Table Op Msg_type Msg_text
  459. test.t1 optimize status OK
  460. proceed with the normal connection
  461. drop table t1;