1
############## mysql-test\t\log_warnings_basic.test ###############
3
# Variable Name: log_warnings #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable log_warnings #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html #
24
###############################################################################
26
--source include/load_sysvars.inc
28
############################################################
29
# START OF log_warnings TESTS #
30
############################################################
33
#############################################################
34
# Save initial value #
35
#############################################################
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;
43
--echo '#--------------------FN_DYNVARS_067_01-------------------------#'
44
########################################################################
45
# Display the DEFAULT value of log_warnings #
46
########################################################################
48
SET @@global.log_warnings = 100;
49
SET @@global.log_warnings = DEFAULT;
50
SELECT @@global.log_warnings;
52
SET @@session.log_warnings = 200;
53
SET @@session.log_warnings = DEFAULT;
54
SELECT @@session.log_warnings;
57
--echo '#--------------------FN_DYNVARS_067_02-------------------------#'
58
########################################################################
59
# Check the DEFAULT value of log_warnings #
60
########################################################################
62
SET @@global.log_warnings = DEFAULT;
63
SELECT @@global.log_warnings = 1;
65
SET @@session.log_warnings = DEFAULT;
66
SELECT @@session.log_warnings = 1;
69
--echo '#--------------------FN_DYNVARS_067_03-------------------------#'
70
######################################################################
71
# Change the value of log_warnings to a valid value for GLOBAL Scope #
72
######################################################################
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;
86
--echo '#--------------------FN_DYNVARS_067_04-------------------------#'
87
#######################################################################
88
# Change the value of log_warnings to a valid value for SESSION Scope #
89
#######################################################################
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;
103
--echo '#------------------FN_DYNVARS_067_05-----------------------#'
104
########################################################
105
# Change the value of log_warnings to an invalid value #
106
########################################################
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_PARSE_ERROR
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;
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_PARSE_ERROR
124
SET @@session.log_warnings = 65530.34.;
125
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
127
--Error ER_WRONG_TYPE_FOR_VAR
128
SET @@session.log_warnings = test;
129
SELECT @@session.log_warnings;
132
--echo '#------------------FN_DYNVARS_067_06-----------------------#'
133
####################################################################
134
# Check if the value in GLOBAL Table matches value in variable #
135
####################################################################
138
SELECT @@global.log_warnings = VARIABLE_VALUE
139
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
140
WHERE VARIABLE_NAME='log_warnings';
142
--echo '#------------------FN_DYNVARS_067_07-----------------------#'
143
####################################################################
144
# Check if the value in SESSION Table matches value in variable #
145
####################################################################
147
SELECT @@session.log_warnings = VARIABLE_VALUE
148
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
149
WHERE VARIABLE_NAME='log_warnings';
152
--echo '#------------------FN_DYNVARS_067_08-----------------------#'
153
####################################################################
154
# Check if TRUE and FALSE values can be used on variable #
155
####################################################################
157
SET @@global.log_warnings = TRUE;
158
SELECT @@global.log_warnings;
159
SET @@global.log_warnings = FALSE;
160
SELECT @@global.log_warnings;
163
--echo '#---------------------FN_DYNVARS_067_09----------------------#'
164
#################################################################################
165
# Check if accessing variable with and without GLOBAL point to same variable #
166
#################################################################################
168
SET @@global.log_warnings = 10;
169
SELECT @@log_warnings = @@global.log_warnings;
172
--echo '#---------------------FN_DYNVARS_067_10----------------------#'
173
########################################################################################################
174
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
175
########################################################################################################
177
SET @@log_warnings = 100;
178
SELECT @@log_warnings = @@local.log_warnings;
179
SELECT @@local.log_warnings = @@session.log_warnings;
182
--echo '#---------------------FN_DYNVARS_067_11----------------------#'
183
#######################################################################
184
# Check if log_warnings can be accessed with and without @@ sign #
185
#######################################################################
187
SET log_warnings = 1;
188
SELECT @@log_warnings;
189
--Error ER_UNKNOWN_TABLE
190
SELECT local.log_warnings;
191
--Error ER_UNKNOWN_TABLE
192
SELECT session.log_warnings;
193
--Error ER_BAD_FIELD_ERROR
194
SELECT log_warnings = @@session.log_warnings;
197
####################################
198
# Restore initial value #
199
####################################
201
SET @@global.log_warnings = @start_global_value;
202
SELECT @@global.log_warnings;
203
SET @@session.log_warnings = @start_session_value;
204
SELECT @@session.log_warnings;
207
#############################################################
208
# END OF log_warnings TESTS #
209
#############################################################