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 --Error ER_WRONG_TYPE_FOR_VAR
105 SET @@global.auto_increment_offset = ON;
106 SELECT @@global.auto_increment_offset;
107 --Error ER_WRONG_TYPE_FOR_VAR
108 SET @@global.auto_increment_offset = OFF;
109 SELECT @@global.auto_increment_offset;
110 --Error ER_WRONG_TYPE_FOR_VAR
111 SET @@global.auto_increment_offset = test;
112 SELECT @@global.auto_increment_offset;
113 # for session scope
114 SET @@session.auto_increment_offset = 0;
115 SELECT @@session.auto_increment_offset;
116 SET @@session.auto_increment_offset = -2;
117 SELECT @@session.auto_increment_offset;
118 SET @@session.auto_increment_offset = 65550;
119 SELECT @@session.auto_increment_offset;
120
121 --Error ER_WRONG_TYPE_FOR_VAR
122 SET @@session.auto_increment_offset = ON;
123 SELECT @@session.auto_increment_offset;
124 --Error ER_WRONG_TYPE_FOR_VAR
125 SET @@session.auto_increment_offset = OFF;
126 SELECT @@session.auto_increment_offset;
127 --Error ER_WRONG_TYPE_FOR_VAR
128 SET @@session.auto_increment_offset = test;
129 SELECT @@session.auto_increment_offset;
130
131
132
133 --echo '#------------------FN_DYNVARS_002_06-----------------------#'
134 ####################################################################
135 # Check if the value in GLOBAL Table matches value in variable #
136 ####################################################################
137
138 SELECT @@global.auto_increment_offset = VARIABLE_VALUE
139 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
140 WHERE VARIABLE_NAME='auto_increment_offset';
141
142
143 --echo '#------------------FN_DYNVARS_002_07-----------------------#'
144 ####################################################################
145 # Check if the value in SESSION Table matches value in variable #
146 ####################################################################
147
148 SELECT @@session.auto_increment_offset = VARIABLE_VALUE
149 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
150 WHERE VARIABLE_NAME='auto_increment_offset';
151
152
153 --echo '#------------------FN_DYNVARS_002_08-----------------------#'
154 ####################################################################
155 # Check if TRUE and FALSE values can be used on variable #
156 ####################################################################
157
158 SET @@global.auto_increment_offset = TRUE;
159 SELECT @@global.auto_increment_offset;
160 SET @@global.auto_increment_offset = FALSE;
161 SELECT @@global.auto_increment_offset;
162
163
164 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
165 ###############################################################################
166 # Check if global and session variables are independant of each other #
167 ###############################################################################
168
169 SET @@global.auto_increment_offset = 10;
170 SET @@session.auto_increment_offset = 11;
171 SELECT @@auto_increment_offset = @@global.auto_increment_offset;
172
173
174 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
175 ##############################################################################
176 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
177 # to same session variable #
178 ##############################################################################
179
180 SET @@auto_increment_offset = 100;
181 SELECT @@auto_increment_offset = @@local.auto_increment_offset;
182 SELECT @@local.auto_increment_offset = @@session.auto_increment_offset;
183
184
185 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
186 ###############################################################################
187 # Check if auto_increment_offset can be accessed with and without @@ sign #
188 ###############################################################################
189
190 SET auto_increment_offset = 1;
191 SELECT @@auto_increment_offset;
192 --Error ER_UNKNOWN_TABLE
193 SELECT local.auto_increment_offset;
194 --Error ER_UNKNOWN_TABLE
195 SELECT session.auto_increment_offset;
196 --Error ER_BAD_FIELD_ERROR
197 SELECT auto_increment_offset = @@session.auto_increment_offset;
198
199
200 ####################################
201 # Restore initial value #
202 ####################################
203
204 SET @@global.auto_increment_offset = @start_global_value;
205 SELECT @@global.auto_increment_offset;
206 SET @@session.auto_increment_offset = @start_session_value;
207 SELECT @@session.auto_increment_offset;
208
209
210 ###################################################
211 # END OF auto_increment_offset TESTS #
212 ###################################################
213