Debian Codegraph @

mysql-test/suite/storage_engine/autoinc_vars.test

raw
1 #
2 # auto-increment-offset and auto-increment-increment
3 #
4
5 --source have_engine.inc
6 --source have_default_index.inc
7
8 --disable_warnings
9 DROP TABLE IF EXISTS t1;
10 --enable_warnings
11
12 # auto_increment_offset
13 SET auto_increment_offset = 200;
14 --let $create_definition = a $int_indexed_col AUTO_INCREMENT, b $char_col, $default_index(a)
15 --source create_table.inc
16 if ($mysql_errname)
17 {
18 --let $functionality = AUTO_INCREMENT
19 --source unexpected_result.inc
20 }
21 if (!$mysql_errname)
22 {
23 # If auto_increment_offset is greater than auto_increment_increment,
24 # the offset is ignored
25 INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
26 SELECT LAST_INSERT_ID();
27 --sorted_result
28 SELECT a,b FROM t1;
29
30 # auto_increment_increment
31
32 SET auto_increment_increment = 300;
33 # offset should not be ignored anymore
34 INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
35 SELECT LAST_INSERT_ID();
36 --sorted_result
37 SELECT a,b FROM t1;
38
39 SET auto_increment_increment = 50;
40 INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
41 SELECT LAST_INSERT_ID();
42 --sorted_result
43 SELECT a,b FROM t1;
44 DROP TABLE t1;
45 }
46
47 # offset is greater than the max value
48
49 SET auto_increment_increment = 500;
50 SET auto_increment_offset = 300;
51 --let $create_definition = a TINYINT $default_col_indexed_opts AUTO_INCREMENT, $default_index(a)
52 --source create_table.inc
53 if ($mysql_errname)
54 {
55 --let $functionality = AUTO_INCREMENT
56 --source unexpected_result.inc
57 }
58 if (!$mysql_errname)
59 {
60 INSERT INTO t1 (a) VALUES (NULL);
61 SELECT LAST_INSERT_ID();
62 --sorted_result
63 SELECT a FROM t1;
64 DROP TABLE t1;
65 }
66
67 --source cleanup_engine.inc
68