1
2
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
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# Basic test routine for the Blackhole Engine
--disable_warnings
drop table if exists t1;
--enable_warnings
# Test with Variable Width Table
CREATE TABLE t1 (c1 int, c2 text, c3 blob) ENGINE=blackhole;
INSERT INTO t1 VALUES (111, "aaaa", "aaaa");
INSERT INTO t1 VALUES (222, "bbbb", "bbbb");
INSERT INTO t1 VALUES (333, "cccc", "cccc");
SELECT * FROM t1;
UPDATE t1 SET c2 = "xxxx" WHERE c1 = 111;
UPDATE t1 SET c2 = "yyyy" WHERE c1 = 222;
UPDATE t1 SET c2 = "zzzz" WHERE c1 = 333;
SELECT * FROM t1;
REPLACE INTO t1 VALUES (1, "one", "one");
REPLACE INTO t1 VALUES (2, "two", "two");
REPLACE INTO t1 VALUES (3, "three", "three");
SELECT * FROM t1;
DELETE FROM t1 WHERE c1 = 111;
DELETE FROM t1 WHERE c1 = 222;
DELETE FROM t1;
SELECT * FROM t1;
DROP TABLE t1;
# Test with Fixed Length Table + Primary Key
CREATE TABLE t1 (id int primary key, c1 int, c2 double) ENGINE=blackhole;
INSERT INTO t1 VALUES (1, 1111, 11.111);
INSERT INTO t1 VALUES (2, 2222, 22.222);
INSERT INTO t1 VALUES (3, 3333, 33.333);
# Double check that read locks are still being honored by the kernel.
CREATE TABLE t5 (a int) ENGINE=BLACKHOLE;
INSERT INTO t5 VALUES (1);
FLUSH TABLES WITH READ LOCK;
--error 1223
INSERT INTO t5 VALUES (1);
UNLOCK TABLES;
INSERT INTO t5 VALUES (1);
FLUSH TABLES WITH READ LOCK;
--error 1223
DROP TABLE t5;
UNLOCK TABLES;
INSERT INTO t5 VALUES (1);
DROP TABLE t5;
# Test for bug lp:492046
CREATE SCHEMA foo;
use foo;
CREATE TABLE A (A INT) ENGINE=BLACKHOLE;
DROP SCHEMA foo;
|