1#
2# DELETE statements for tables with keys
3#
4--source have_engine.inc
5--source have_default_index.inc
6
7--disable_warnings
8DROP TABLE IF EXISTS t1;
9--enable_warnings
10
11--let $create_definition = a $int_col, b $char_indexed_col, $default_index (b)
12--source create_table.inc
13if ($mysql_errname)
14{
15  --let $functionality = Index on a CHAR column
16  --source unexpected_result.inc
17}
18if (!$mysql_errname)
19{
20  INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
21  DELETE FROM t1 WHERE b > 'y';
22  if ($mysql_errname)
23  {
24    --let $functionality = DELETE
25    --source unexpected_result.inc
26  }
27  if (!$mysql_errname)
28  {
29    DELETE FROM t1 WHERE a=2;
30
31    --sorted_result
32    SELECT a,b FROM t1;
33    DELETE FROM t1;
34  }
35  DROP TABLE t1;
36}
37
38--let $create_definition = a $int_indexed_col PRIMARY KEY, b $char_col
39--source create_table.inc
40if ($mysql_errname)
41{
42  --let $functionality = PRIMARY KEY
43  --source unexpected_result.inc
44}
45if (!$mysql_errname)
46{
47  INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
48  DELETE FROM t1 WHERE b > 'y';
49  DELETE FROM t1 WHERE a=2;
50
51  --sorted_result
52  SELECT a,b FROM t1;
53  DELETE FROM t1;
54  DROP TABLE t1;
55}
56
57--let $create_definition = a $int_indexed_col, b $int_col, c $int_indexed_col, $default_index(a), $default_index(b)
58--source create_table.inc
59if ($mysql_errname)
60{
61  --let $functionality = Multiple indexes
62  --source unexpected_result.inc
63}
64if (!$mysql_errname)
65{
66  INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
67  DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
68  --sorted_result
69  SELECT a,b,c FROM t1;
70  DROP TABLE t1;
71}
72
73--source cleanup_engine.inc
74
75