Debian Codegraph @

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

raw
1 ############## mysql-test\t\auto_increment_offset_basic.test ###################
2 # #
3 # Variable Name: auto_increment_offset #
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_offset" #
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-offset #
23 # #
24 ################################################################################
25
26 --source include/load_sysvars.inc
27
28 #####################################################################
29 # START OF auto_increment_offset TESTS #
30 #####################################################################
31
32 #############################################################
33 # Save initial value #
34 #############################################################
35
36 SET @start_global_value = @@global.auto_increment_offset;
37 SELECT @start_global_value;
38 SET @start_session_value = @@session.auto_increment_offset;
39 SELECT @start_session_value;
40
41
42 --echo '#--------------------FN_DYNVARS_002_01-------------------------#'
43 #####################################################################
44 # Display the DEFAULT value of auto_increment_offset #
45 #####################################################################
46
47 SET @@global.auto_increment_offset = 100;
48 SET @@global.auto_increment_offset = DEFAULT;
49 SELECT @@global.auto_increment_offset;
50
51 SET @@session.auto_increment_offset = 200;
52 SET @@session.auto_increment_offset = DEFAULT;
53 SELECT @@session.auto_increment_offset;
54
55
56 --echo '#--------------------FN_DYNVARS_002_02-------------------------#'
57 #####################################################################
58 # Check the DEFAULT value of auto_increment_offset #
59 #####################################################################
60
61 SET @@global.auto_increment_offset = @start_global_value;
62 SELECT @@global.auto_increment_offset = 1;
63 SET @@session.auto_increment_offset = @start_session_value;
64 SELECT @@session.auto_increment_offset = 1;
65
66
67 --echo '#--------------------FN_DYNVARS_002_03-------------------------#'
68 ###############################################################################
69 # Change the value of auto_increment_offset to a valid value for GLOBAL Scope #
70 ###############################################################################
71
72 SET @@global.auto_increment_offset = 1;
73 SELECT @@global.auto_increment_offset;
74 SET @@global.auto_increment_offset = 60020;
75 SELECT @@global.auto_increment_offset;
76 SET @@global.auto_increment_offset = 65535;
77 SELECT @@global.auto_increment_offset;
78
79
80 --echo '#--------------------FN_DYNVARS_002_04-------------------------#'
81 ###############################################################################
82 # Change the value of auto_increment_offset to a valid value for SESSION Scope#
83 ###############################################################################
84
85 SET @@session.auto_increment_offset = 1;
86 SELECT @@session.auto_increment_offset;
87 SET @@session.auto_increment_offset = 50050;
88 SELECT @@session.auto_increment_offset;
89 SET @@session.auto_increment_offset = 65535;
90 SELECT @@session.auto_increment_offset;
91
92
93 --echo '#------------------FN_DYNVARS_002_05-----------------------#'
94 #################################################################
95 # Change the value of auto_increment_offset to an invalid value #
96 #################################################################
97 # for global scope
98 SET @@global.auto_increment_offset = 0;
99 SELECT @@global.auto_increment_offset;
100 SET @@global.auto_increment_offset = -1024;
101 SELECT @@global.auto_increment_offset;
102 SET @@global.auto_increment_offset = 65536;
103 SELECT @@global.auto_increment_offset;
104 SET @@global.auto_increment_offset = 4294967295;
105 SELECT @@global.auto_increment_offset;
106 --Error ER_WRONG_TYPE_FOR_VAR
107 SET @@global.auto_increment_offset = 65535.4;
108 SELECT @@global.auto_increment_offset;
109 --Error ER_WRONG_TYPE_FOR_VAR
110 SET @@global.auto_increment_offset = ON;
111 SELECT @@global.auto_increment_offset;
112 --Error ER_WRONG_TYPE_FOR_VAR
113 SET @@global.auto_increment_offset = OFF;
114 SELECT @@global.auto_increment_offset;
115 --Error ER_WRONG_TYPE_FOR_VAR
116 SET @@global.auto_increment_offset = test;
117 SELECT @@global.auto_increment_offset;
118 # for session scope
119 SET @@session.auto_increment_offset = 0;
120 SELECT @@session.auto_increment_offset;
121 SET @@session.auto_increment_offset = -1024;
122 SELECT @@session.auto_increment_offset;
123 SET @@session.auto_increment_offset = 65536;
124 SELECT @@session.auto_increment_offset;
125 SET @@session.auto_increment_offset = 4294967295;
126 SELECT @@session.auto_increment_offset;
127 --Error ER_WRONG_TYPE_FOR_VAR
128 SET @@session.auto_increment_offset = 65535.4;
129 SELECT @@session.auto_increment_offset;
130 --Error ER_WRONG_TYPE_FOR_VAR
131 SET @@session.auto_increment_offset = ON;
132 SELECT @@session.auto_increment_offset;
133 --Error ER_WRONG_TYPE_FOR_VAR
134 SET @@session.auto_increment_offset = OFF;
135 SELECT @@session.auto_increment_offset;
136 --Error ER_WRONG_TYPE_FOR_VAR
137 SET @@session.auto_increment_offset = test;
138 SELECT @@session.auto_increment_offset;
139
140
141
142 --echo '#------------------FN_DYNVARS_002_06-----------------------#'
143 ####################################################################
144 # Check if the value in GLOBAL Table matches value in variable #
145 ####################################################################
146
147 --disable_warnings
148 SELECT @@global.auto_increment_offset = VARIABLE_VALUE
149 FROM performance_schema.global_variables
150 WHERE VARIABLE_NAME='auto_increment_offset';
151 --enable_warnings
152
153
154 --echo '#------------------FN_DYNVARS_002_07-----------------------#'
155 ####################################################################
156 # Check if the value in SESSION Table matches value in variable #
157 ####################################################################
158
159 --disable_warnings
160 SELECT @@session.auto_increment_offset = VARIABLE_VALUE
161 FROM performance_schema.session_variables
162 WHERE VARIABLE_NAME='auto_increment_offset';
163 --enable_warnings
164
165
166 --echo '#------------------FN_DYNVARS_002_08-----------------------#'
167 ####################################################################
168 # Check if TRUE and FALSE values can be used on variable #
169 ####################################################################
170
171 SET @@global.auto_increment_offset = TRUE;
172 SELECT @@global.auto_increment_offset;
173 SET @@global.auto_increment_offset = FALSE;
174 SELECT @@global.auto_increment_offset;
175
176
177 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
178 ###############################################################################
179 # Check if global and session variables are independant of each other #
180 ###############################################################################
181
182 SET @@global.auto_increment_offset = 10;
183 SET @@session.auto_increment_offset = 11;
184 SELECT @@auto_increment_offset = @@global.auto_increment_offset;
185
186
187 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
188 ##############################################################################
189 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
190 # to same session variable #
191 ##############################################################################
192
193 SET @@auto_increment_offset = 100;
194 SELECT @@auto_increment_offset = @@local.auto_increment_offset;
195 SELECT @@local.auto_increment_offset = @@session.auto_increment_offset;
196
197
198 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
199 ###############################################################################
200 # Check if auto_increment_offset can be accessed with and without @@ sign #
201 ###############################################################################
202
203 SET auto_increment_offset = 1;
204 SELECT @@auto_increment_offset;
205 --Error ER_UNKNOWN_TABLE
206 SELECT local.auto_increment_offset;
207 --Error ER_UNKNOWN_TABLE
208 SELECT session.auto_increment_offset;
209 --Error ER_BAD_FIELD_ERROR
210 SELECT auto_increment_offset = @@session.auto_increment_offset;
211
212
213 ####################################
214 # Restore initial value #
215 ####################################
216
217 SET @@global.auto_increment_offset = @start_global_value;
218 SELECT @@global.auto_increment_offset;
219 SET @@session.auto_increment_offset = @start_session_value;
220 SELECT @@session.auto_increment_offset;
221
222
223 ###################################################
224 # END OF auto_increment_offset TESTS #
225 ###################################################
226