Debian Codegraph @

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

raw
1 ############## mysql-test\t\wait_timeout_basic.test ###########################
2 # #
3 # Variable Name: wait_timeout #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: #
8 # Range: #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Sharique Abdullah #
13 # #
14 # Description: Test Cases of Dynamic System Variable wait_timeout #
15 # that checks the 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_wait_timeouts #
23 # #
24 ###############################################################################
25 # Due to differnces between linux and windows in the results
26
27 --source include/not_windows.inc
28 --source include/load_sysvars.inc
29
30 ############################################################
31 # START OF wait_timeout TESTS #
32 ############################################################
33
34 #############################################################
35 # Save initial value #
36 #############################################################
37
38 SET @start_global_value = @@global.wait_timeout;
39 SET @start_session_value = @@session.wait_timeout;
40
41 --echo '#--------------------FN_DYNVARS_005_01-------------------------#'
42 ############################################################
43 # Display the DEFAULT value of wait_timeout #
44 ############################################################
45
46 SET @@global.wait_timeout = 100;
47 SET @@global.wait_timeout = DEFAULT;
48 SELECT @@global.wait_timeout;
49
50 SET @@session.wait_timeout = 200;
51 SET @@session.wait_timeout = DEFAULT;
52 SELECT @@session.wait_timeout;
53
54
55 --echo '#--------------------FN_DYNVARS_005_02-------------------------#'
56 ############################################################
57 # Check the DEFAULT value of wait_timeout #
58 ############################################################
59
60 SET @@global.wait_timeout = DEFAULT;
61 SELECT @@global.wait_timeout = @default_wait_timeout;
62
63 SET @@session.wait_timeout = DEFAULT;
64 SELECT @@session.wait_timeout = @default_wait_timeout;
65
66
67
68 --echo '#--------------------FN_DYNVARS_005_03-------------------------#'
69 ######################################################################
70 # Change the value of wait_timeout to a valid value for GLOBAL Scope #
71 ######################################################################
72
73 #SET @@global.wait_timeout= @min_wait_timeout;
74 SET @@global.wait_timeout= 1;
75 SELECT @@global.wait_timeout;
76
77 SET @@global.wait_timeout = 60020;
78 SELECT @@global.wait_timeout;
79
80 #SET @@global.wait_timeout = @max_wait_timeout;
81 SET @@global.wait_timeout = 31536000;
82 SELECT @@global.wait_timeout = @max_wait_timeout;
83
84
85 --echo '#--------------------FN_DYNVARS_005_04-------------------------#'
86 #######################################################################
87 # Change the value of wait_timeout to a valid value for SESSION Scope #
88 #######################################################################
89 #SET @@session.wait_timeout = @min_wait_timeout;
90 #SELECT @@session.wait_timeout;
91
92 SET @@session.wait_timeout =6000;
93 SELECT @@session.wait_timeout;
94
95 #SET @@session.wait_timeout = @max_wait_timeout;
96 #SELECT @@session.wait_timeout = @max_wait_timeout;
97
98
99 --echo '#------------------FN_DYNVARS_005_05-----------------------#'
100 ########################################################
101 # Change the value of wait_timeout to an invalid value #
102 ########################################################
103
104 SET @@global.wait_timeout = 0;
105 SET @@global.wait_timeout = -1024;
106
107 --Error ER_WRONG_TYPE_FOR_VAR
108 SET @@global.wait_timeout = ON;
109
110 --Error ER_WRONG_TYPE_FOR_VAR
111 SET @@global.wait_timeout = OFF;
112
113 SET @@global.wait_timeout = True;
114 SELECT @@global.wait_timeout;
115
116 SET @@global.wait_timeout = False;
117 SELECT @@global.wait_timeout;
118
119 --Error ER_WRONG_TYPE_FOR_VAR
120 SET @@global.wait_timeout = 65530.34;
121
122 --Error ER_WRONG_TYPE_FOR_VAR
123 SET @@global.wait_timeout ="Test";
124
125
126 --Error ER_WRONG_TYPE_FOR_VAR
127 SET @@session.wait_timeout = ON;
128
129
130 --Error ER_WRONG_TYPE_FOR_VAR
131 SET @@session.wait_timeout = OFF;
132
133 SET @@session.wait_timeout = True;
134 SELECT @@session.wait_timeout;
135
136 SET @@session.wait_timeout = False;
137 SELECT @@session.wait_timeout;
138
139
140 --Error ER_WRONG_TYPE_FOR_VAR
141 SET @@session.wait_timeout = "Test";
142
143
144 --Error ER_WRONG_TYPE_FOR_VAR
145 SET @@session.wait_timeout = 'test';
146
147 SET @@session.wait_timeout = 123456789031;
148 SELECT @@session.wait_timeout = @max_wait_timeout;
149
150
151 --echo '#------------------FN_DYNVARS_005_06-----------------------#'
152 ####################################################################
153 # Check if the value in GLOBAL Table matches value in variable #
154 ####################################################################
155
156 SELECT @@global.wait_timeout = VARIABLE_VALUE
157 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
158 WHERE VARIABLE_NAME='wait_timeout';
159
160 --echo '#------------------FN_DYNVARS_005_07-----------------------#'
161 ####################################################################
162 # Check if the value in SESSION Table matches value in variable #
163 ####################################################################
164
165 SELECT @@session.wait_timeout = VARIABLE_VALUE
166 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
167 WHERE VARIABLE_NAME='wait_timeout';
168
169 --echo '#---------------------FN_DYNVARS_001_09----------------------#'
170 ###########################################################################
171 # Check if global and session variable are independent of each other #
172 ###########################################################################
173
174 SET @@global.wait_timeout = 30000;
175 SET @@global.wait_timeout = 40000;
176 SELECT @@wait_timeout = @@global.wait_timeout;
177
178 --echo '#---------------------FN_DYNVARS_001_10----------------------#'
179 ########################################################################
180 # Check if accessing variable with SESSION,LOCAL and without SCOPE #
181 # points to same session variable #
182 ########################################################################
183
184 SET @@wait_timeout = 100;
185 SELECT @@wait_timeout = @@local.wait_timeout;
186 SELECT @@local.wait_timeout = @@session.wait_timeout;
187
188 --echo '#---------------------FN_DYNVARS_001_11----------------------#'
189 #######################################################################
190 # Check if wait_timeout can be accessed with and without @@ sign #
191 #######################################################################
192
193 SET wait_timeout = 1027;
194 SELECT @@wait_timeout;
195
196
197 --Error ER_UNKNOWN_TABLE
198 SELECT local.wait_timeout;
199
200 --Error ER_UNKNOWN_TABLE
201 SELECT session.wait_timeout;
202
203 --Error ER_BAD_FIELD_ERROR
204 SELECT wait_timeout = @@session.wait_timeout;
205
206 --echo #
207 --echo # MDEV-9516 type error when setting session variable
208 --echo #
209
210 SET SESSION wait_timeout= 28000;
211 SET SESSION wait_timeout= GREATEST(28000, @@wait_timeout);
212 SET SESSION wait_timeout= COALESCE(28000, @@wait_timeout);
213 SET SESSION wait_timeout= IFNULL(28000, @@wait_timeout);
214 SET SESSION wait_timeout= CASE WHEN TRUE THEN 28000 ELSE @@wait_timeout END;
215
216 --error ER_WRONG_TYPE_FOR_VAR
217 SET SESSION wait_timeout= 28000.0;
218 --error ER_WRONG_TYPE_FOR_VAR
219 SET SESSION wait_timeout= 28000.1;
220
221 ####################################
222 # Restore initial value #
223 ####################################
224
225 SET @@global.wait_timeout = @start_global_value;
226 SET @@session.wait_timeout = @start_session_value;
227
228 #################################################
229 # END OF wait_timeout TESTS #
230 #################################################