Debian Codegraph @

mysql-test/suite/storage_engine/insert.test

raw
1 #
2 # Basic INSERT statements
3 #
4 # LOW_PRIORITY|HIGH_PRIORITY are covered in insert_high_low_prio test
5 # DELAYED is covered in insert_delayed test
6 # IGNORE and ON DUPLICATE KEY UPDATE are covered in insert_with_keys test
7
8 --source have_engine.inc
9
10 --disable_warnings
11 DROP TABLE IF EXISTS t1, t2;
12 --enable_warnings
13
14 --source create_table.inc
15
16 # INSERT [INTO] .. VALUES|VALUE ..
17
18 INSERT INTO t1 VALUES (100,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
19 if ($mysql_errname)
20 {
21 --let $functionality = INSERT
22 --source unexpected_result.inc
23 }
24 --sorted_result
25 SELECT a,b FROM t1;
26
27 INSERT t1 VALUE (10,'foo'),(11,'abc');
28 --sorted_result
29 SELECT a,b FROM t1;
30
31 INSERT INTO t1 (b,a) VALUES ('test',0);
32 --sorted_result
33 SELECT a,b FROM t1;
34
35 INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
36 --sorted_result
37 SELECT a,b FROM t1;
38
39 INSERT t1 (a) VALUE (10),(20);
40 --sorted_result
41 SELECT a,b FROM t1;
42
43 # INSERT [INTO] .. SET
44
45 INSERT INTO t1 SET a = 11, b = 'f';
46 --sorted_result
47 SELECT a,b FROM t1;
48
49 INSERT t1 SET b = DEFAULT;
50 --sorted_result
51 SELECT a,b FROM t1;
52
53
54 # INSERT .. SELECT
55
56 --let $table_name = t2
57 --source create_table.inc
58 INSERT INTO t2 SELECT a,b FROM t1;
59 if ($mysql_errname)
60 {
61 --let $functionality = INSERT .. SELECT
62 --source unexpected_result.inc
63 }
64
65
66 INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo';
67 --sorted_result
68 SELECT a,b FROM t1;
69
70 INSERT t1 (a,b) SELECT a,b FROM t1;
71 --sorted_result
72 SELECT a,b FROM t1;
73
74 # Cleanup
75 DROP TABLE t1, t2;
76
77 --source cleanup_engine.inc
78