Debian Codegraph @

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

raw
1 ############## mysql-test\t\log_warnings_basic.test ###############
2 # #
3 # Variable Name: log_warnings #
4 # Scope: GLOBAL | SESSION #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 1 #
8 # Range: - #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable log_warnings #
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 #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ############################################################
29 # START OF log_warnings TESTS #
30 ############################################################
31
32
33 #############################################################
34 # Save initial value #
35 #############################################################
36
37 SET @start_global_value = @@global.log_warnings;
38 SELECT @start_global_value;
39 SET @start_session_value = @@session.log_warnings;
40 SELECT @start_session_value;
41
42
43 --echo '#--------------------FN_DYNVARS_067_01-------------------------#'
44 ########################################################################
45 # Display the DEFAULT value of log_warnings #
46 ########################################################################
47
48 SET @@global.log_warnings = 100;
49 SET @@global.log_warnings = DEFAULT;
50 SELECT @@global.log_warnings;
51
52 SET @@session.log_warnings = 200;
53 SET @@session.log_warnings = DEFAULT;
54 SELECT @@session.log_warnings;
55
56
57 --echo '#--------------------FN_DYNVARS_067_02-------------------------#'
58 ########################################################################
59 # Check the DEFAULT value of log_warnings #
60 ########################################################################
61
62 SET @@global.log_warnings = DEFAULT;
63 SELECT @@global.log_warnings = 1;
64
65 SET @@session.log_warnings = DEFAULT;
66 SELECT @@session.log_warnings = 1;
67
68
69 --echo '#--------------------FN_DYNVARS_067_03-------------------------#'
70 ######################################################################
71 # Change the value of log_warnings to a valid value for GLOBAL Scope #
72 ######################################################################
73
74 SET @@global.log_warnings = 0;
75 SELECT @@global.log_warnings;
76 SET @@global.log_warnings = 1;
77 SELECT @@global.log_warnings;
78 SET @@global.log_warnings = 60020;
79 SELECT @@global.log_warnings;
80 SET @@global.log_warnings = 65535;
81 SELECT @@global.log_warnings;
82 SET @@global.log_warnings = 65536;
83 SELECT @@global.log_warnings;
84
85
86 --echo '#--------------------FN_DYNVARS_067_04-------------------------#'
87 #######################################################################
88 # Change the value of log_warnings to a valid value for SESSION Scope #
89 #######################################################################
90
91 SET @@session.log_warnings = 0;
92 SELECT @@session.log_warnings;
93 SET @@session.log_warnings = 1;
94 SELECT @@session.log_warnings;
95 SET @@session.log_warnings = 50050;
96 SELECT @@session.log_warnings;
97 SET @@session.log_warnings = 65535;
98 SELECT @@session.log_warnings;
99 SET @@session.log_warnings = 65550;
100 SELECT @@session.log_warnings;
101
102
103 --echo '#------------------FN_DYNVARS_067_05-----------------------#'
104 ########################################################
105 # Change the value of log_warnings to an invalid value #
106 ########################################################
107
108 SET @@global.log_warnings = 100000000000;
109 SELECT @@global.log_warnings;
110 SET @@global.log_warnings = -1024;
111 SELECT @@global.log_warnings;
112 --Error ER_WRONG_TYPE_FOR_VAR
113 SET @@global.log_warnings = 65530.34;
114 SELECT @@global.log_warnings;
115 --Error ER_WRONG_TYPE_FOR_VAR
116 SET @@global.log_warnings = test;
117 SELECT @@global.log_warnings;
118
119 SET @@session.log_warnings = 100000000000;
120 SELECT @@session.log_warnings;
121 SET @@session.log_warnings = -2;
122 SELECT @@session.log_warnings;
123 --Error ER_WRONG_TYPE_FOR_VAR
124 SET @@session.log_warnings = 65530.34;
125
126 --Error ER_WRONG_TYPE_FOR_VAR
127 SET @@session.log_warnings = test;
128 SELECT @@session.log_warnings;
129
130
131 --echo '#------------------FN_DYNVARS_067_06-----------------------#'
132 ####################################################################
133 # Check if the value in GLOBAL Table matches value in variable #
134 ####################################################################
135
136
137 SELECT @@global.log_warnings = VARIABLE_VALUE
138 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
139 WHERE VARIABLE_NAME='log_warnings';
140
141 --echo '#------------------FN_DYNVARS_067_07-----------------------#'
142 ####################################################################
143 # Check if the value in SESSION Table matches value in variable #
144 ####################################################################
145
146 SELECT @@session.log_warnings = VARIABLE_VALUE
147 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
148 WHERE VARIABLE_NAME='log_warnings';
149
150
151 --echo '#------------------FN_DYNVARS_067_08-----------------------#'
152 ####################################################################
153 # Check if TRUE and FALSE values can be used on variable #
154 ####################################################################
155
156 SET @@global.log_warnings = TRUE;
157 SELECT @@global.log_warnings;
158 SET @@global.log_warnings = FALSE;
159 SELECT @@global.log_warnings;
160
161
162 --echo '#---------------------FN_DYNVARS_067_09----------------------#'
163 #################################################################################
164 # Check if accessing variable with and without GLOBAL point to same variable #
165 #################################################################################
166
167 SET @@global.log_warnings = 10;
168 SELECT @@log_warnings = @@global.log_warnings;
169
170
171 --echo '#---------------------FN_DYNVARS_067_10----------------------#'
172 ########################################################################################################
173 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
174 ########################################################################################################
175
176 SET @@log_warnings = 100;
177 SELECT @@log_warnings = @@local.log_warnings;
178 SELECT @@local.log_warnings = @@session.log_warnings;
179
180
181 --echo '#---------------------FN_DYNVARS_067_11----------------------#'
182 #######################################################################
183 # Check if log_warnings can be accessed with and without @@ sign #
184 #######################################################################
185
186 SET log_warnings = 1;
187 SELECT @@log_warnings;
188 --Error ER_UNKNOWN_TABLE
189 SELECT local.log_warnings;
190 --Error ER_UNKNOWN_TABLE
191 SELECT session.log_warnings;
192 --Error ER_BAD_FIELD_ERROR
193 SELECT log_warnings = @@session.log_warnings;
194
195
196 ####################################
197 # Restore initial value #
198 ####################################
199
200 SET @@global.log_warnings = @start_global_value;
201 SELECT @@global.log_warnings;
202 SET @@session.log_warnings = @start_session_value;
203 SELECT @@session.log_warnings;
204
205
206 #############################################################
207 # END OF log_warnings TESTS #
208 #############################################################
209