Debian Codegraph @

mysql-test/suite/storage_engine/update_multi.test

raw
1 #
2 # Multi-table UPDATE statements.
3 #
4
5 --source have_engine.inc
6
7 --disable_warnings
8 DROP TABLE IF EXISTS t1,t2;
9 --enable_warnings
10
11 --source create_table.inc
12 INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
13 INSERT INTO t1 (a,b) SELECT a, b FROM t1;
14
15 --let $table_name = t2
16 --let $create_definition = c $char_col, d $int_col
17 --source create_table.inc
18 INSERT INTO t2 (c,d) SELECT b, a FROM t1;
19
20 UPDATE t1, t2 SET t1.a = t2.d+100, t2.c = 'multi' WHERE c < b AND a + d != 1;
21 if ($mysql_errname)
22 {
23 --let $functionality = UPDATE
24 --source unexpected_result.inc
25 }
26 if (!$mysql_errname)
27 {
28 --sorted_result
29 SELECT a,b FROM t1;
30 --sorted_result
31 SELECT c,d FROM t2;
32
33 UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c;
34 --sorted_result
35 SELECT a,b FROM t1;
36 --sorted_result
37 SELECT c,d FROM t2;
38 }
39
40 # Cleanup
41 DROP TABLE t1, t2;
42
43 --source cleanup_engine.inc
44