Debian Codegraph @

mysql-test/suite/storage_engine/delete.test

raw
1 #
2 # Basic DELETE statements.
3 # DELETE LOW_PRIORITY is covered in delete_low_prio test
4 # DELETE QUICK is covered in delete_quick test (syntax only)
5 # DELETE IGNORE is covered in delete_ignore test
6 #
7
8 --source have_engine.inc
9
10 --disable_warnings
11 DROP TABLE IF EXISTS t1,t2;
12 --enable_warnings
13
14 --let $create_definition = a $int_col, b $char_col
15 --source create_table.inc
16 INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
17 INSERT INTO t1 (a,b) SELECT a, b FROM t1;
18
19 # Single-table DELETE
20
21 DELETE FROM t1 WHERE b IN ('c');
22 if ($mysql_errname)
23 {
24 --let $functionality = DELETE FROM
25 --source unexpected_result.inc
26 }
27 --sorted_result
28 SELECT a,b FROM t1;
29
30 DELETE FROM t1 WHERE a < 0 OR b = 'a';
31 --sorted_result
32 SELECT a,b FROM t1;
33
34 # ORDER BY and LIMIT
35 DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
36 --sorted_result
37 SELECT a,b FROM t1;
38
39 # Multi-table DELETE
40
41 --let $create_definition = c $char_col, d $int_col
42 --let $table_name = t2
43 --source create_table.inc
44 INSERT INTO t2 (c,d) SELECT b, a FROM t1;
45 --sorted_result
46 SELECT c,d FROM t2;
47
48 DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1;
49 --sorted_result
50 SELECT a,b FROM t1;
51 --sorted_result
52 SELECT c,d FROM t2;
53
54 DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c;
55 --sorted_result
56 SELECT a,b FROM t1;
57 --sorted_result
58 SELECT c,d FROM t2;
59
60 DELETE FROM t1;
61 --sorted_result
62 SELECT a,b FROM t1;
63
64 # Cleanup
65 DROP TABLE t1, t2;
66
67 --source cleanup_engine.inc
68