Debian Codegraph @

mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test

raw
1 ############## mysql-test\t\auto_increment_increment_basic.test ################
2 # #
3 # Variable Name: auto_increment_increment #
4 # Scope: GLOBAL & SESSION #
5 # Access Type: Dynamic #
6 # Data Type: Numeric #
7 # Default Value: 1 #
8 # Range: 1 - 65536 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman Rawala #
13 # #
14 # Description: Test Cases of Dynamic System Variable "auto_increment_increment"#
15 # that checks behavior of this variable in the following ways #
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity #
20 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html#option_mysqld_auto-increment-increment #
23 # #
24 ################################################################################
25
26 --source include/load_sysvars.inc
27
28 ########################################################################
29 # START OF auto_increment_increment TESTS #
30 ########################################################################
31
32
33 #############################################################
34 # Save initial value #
35 #############################################################
36
37 SET @start_global_value = @@global.auto_increment_increment;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.auto_increment_increment;
40 SELECT @start_session_value;
41
42
43 --echo '#--------------------FN_DYNVARS_001_01-------------------------#'
44 ########################################################################
45 # Display the DEFAULT value of auto_increment_increment #
46 ########################################################################
47
48 SET @@global.auto_increment_increment = 100;
49 SET @@global.auto_increment_increment = DEFAULT;
50 SELECT @@global.auto_increment_increment;
51
52 SET @@session.auto_increment_increment = 200;
53 SET @@session.auto_increment_increment = DEFAULT;
54 SELECT @@session.auto_increment_increment;
55
56
57 --echo '#--------------------FN_DYNVARS_001_02-------------------------#'
58 ########################################################################
59 # Check the DEFAULT value of auto_increment_increment #
60 ########################################################################
61
62 SET @@global.auto_increment_increment = DEFAULT;
63 SELECT @@global.auto_increment_increment = 1;
64
65 SET @@session.auto_increment_increment = DEFAULT;
66 SELECT @@session.auto_increment_increment = 1;
67
68
69 --echo '#--------------------FN_DYNVARS_001_03-------------------------#'
70 ##################################################################
71 # Change the value of variable to a valid value for GLOBAL Scope #
72 ##################################################################
73
74 SET @@global.auto_increment_increment = 1;
75 SELECT @@global.auto_increment_increment;
76 SET @@global.auto_increment_increment = 60020;
77 SELECT @@global.auto_increment_increment;
78 SET @@global.auto_increment_increment = 65535;
79 SELECT @@global.auto_increment_increment;
80
81
82 --echo '#--------------------FN_DYNVARS_001_04-------------------------#'
83 ###################################################################
84 # Change the value of variable to a valid value for SESSION Scope #
85 ###################################################################
86
87 SET @@session.auto_increment_increment = 1;
88 SELECT @@session.auto_increment_increment;
89 SET @@session.auto_increment_increment = 50050;
90 SELECT @@session.auto_increment_increment;
91 SET @@session.auto_increment_increment = 65535;
92 SELECT @@session.auto_increment_increment;
93
94
95 --echo '#------------------FN_DYNVARS_001_05-----------------------#'
96 ####################################################################
97 # Change the value of auto_increment_increment to an invalid value #
98 ####################################################################
99
100 SET @@global.auto_increment_increment = 0;
101 SELECT @@global.auto_increment_increment;
102 SET @@global.auto_increment_increment = -1024;
103 SELECT @@global.auto_increment_increment;
104 SET @@global.auto_increment_increment = 65536;
105 SELECT @@global.auto_increment_increment;
106 SET @@global.auto_increment_increment = 4294967295;
107 SELECT @@global.auto_increment_increment;
108 --Error ER_WRONG_TYPE_FOR_VAR
109 SET @@global.auto_increment_increment = 65530.34;
110 SELECT @@global.auto_increment_increment;
111 --Error ER_WRONG_TYPE_FOR_VAR
112 SET @@global.auto_increment_increment = test;
113 SELECT @@global.auto_increment_increment;
114
115 SET @@session.auto_increment_increment = 0;
116 SELECT @@session.auto_increment_increment;
117 SET @@session.auto_increment_increment = -1024;
118 SELECT @@session.auto_increment_increment;
119 --Error ER_WRONG_TYPE_FOR_VAR
120 SET @@session.auto_increment_increment = 65530.34;
121 SELECT @@global.auto_increment_increment;
122 SET @@session.auto_increment_increment = 65536;
123 SELECT @@session.auto_increment_increment;
124 SET @@session.auto_increment_increment = 4294967295;
125 SELECT @@session.auto_increment_increment;
126
127 --Error ER_WRONG_TYPE_FOR_VAR
128 SET @@session.auto_increment_increment = test;
129 SELECT @@session.auto_increment_increment;
130
131
132 --echo '#------------------FN_DYNVARS_001_06-----------------------#'
133 ####################################################################
134 # Check if the value in GLOBAL Table matches value in variable #
135 ####################################################################
136
137 --disable_warnings
138 SELECT @@global.auto_increment_increment = VARIABLE_VALUE
139 FROM performance_schema.global_variables
140 WHERE VARIABLE_NAME='auto_increment_increment';
141 --enable_warnings
142
143
144 --echo '#------------------FN_DYNVARS_001_07-----------------------#'
145 ####################################################################
146 # Check if the value in SESSION Table matches value in variable #
147 ####################################################################
148
149 --disable_warnings
150 SELECT @@session.auto_increment_increment = VARIABLE_VALUE
151 FROM performance_schema.session_variables
152 WHERE VARIABLE_NAME='auto_increment_increment';
153 --enable_warnings
154
155
156 --echo '#------------------FN_DYNVARS_001_08-----------------------#'
157 ####################################################################
158 # Check if TRUE and FALSE values can be used on variable #
159 ####################################################################
160
161 SET @@global.auto_increment_increment = TRUE;
162 SELECT @@global.auto_increment_increment;
163 SET @@global.auto_increment_increment = FALSE;
164 SELECT @@global.auto_increment_increment;
165
166
167 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
168 ###############################################################################
169 # Check if global and session variables are independant of each other #
170 ###############################################################################
171
172 SET @@global.auto_increment_increment = 10;
173 SET @@session.auto_increment_increment = 11;
174 SELECT @@auto_increment_increment = @@global.auto_increment_increment;
175
176
177 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
178 ##############################################################################
179 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
180 # to same session variable #
181 ##############################################################################
182
183 SET @@auto_increment_increment = 100;
184 SELECT @@auto_increment_increment = @@local.auto_increment_increment;
185 SELECT @@local.auto_increment_increment = @@session.auto_increment_increment;
186
187
188 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
189 ###############################################################################
190 # Check if auto_increment_increment can be accessed with and without @@ sign #
191 ###############################################################################
192
193 SET auto_increment_increment = 1;
194 SELECT @@auto_increment_increment;
195 --Error ER_UNKNOWN_TABLE
196 SELECT local.auto_increment_increment;
197 --Error ER_UNKNOWN_TABLE
198 SELECT session.auto_increment_increment;
199 --Error ER_BAD_FIELD_ERROR
200 SELECT auto_increment_increment = @@session.auto_increment_increment;
201
202
203 ####################################
204 # Restore initial value #
205 ####################################
206
207 SET @@global.auto_increment_increment = @start_global_value;
208 SELECT @@global.auto_increment_increment;
209 SET @@session.auto_increment_increment = @start_session_value;
210 SELECT @@session.auto_increment_increment;
211
212
213 #############################################################
214 # END OF auto_increment_increment TESTS #
215 #############################################################
216