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