1
################# mysql-test\t\sql_log_off_basic.test #########################
3
# Variable Name: sql_log_off #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable sql_log_off #
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
27
########################################################################
28
# START OF sql_log_off TESTS #
29
########################################################################
32
################################################################################
33
# Saving initial value of sql_log_off in a temporary variable #
34
################################################################################
36
SET @session_start_value = @@session.sql_log_off;
37
SELECT @session_start_value;
39
--echo '#--------------------FN_DYNVARS_157_01------------------------#'
40
########################################################################
41
# Display the DEFAULT value of sql_log_off #
42
########################################################################
44
SET @@session.sql_log_off = 0;
45
SET @@session.sql_log_off = DEFAULT;
46
SELECT @@session.sql_log_off;
48
SET @@session.sql_log_off = 1;
49
SET @@session.sql_log_off = DEFAULT;
50
SELECT @@session.sql_log_off;
53
--echo '#---------------------FN_DYNVARS_157_02-------------------------#'
54
#############################################################################
55
# Check if sql_log_off can be accessed with and without @@ sign #
56
#############################################################################
61
--Error ER_UNKNOWN_TABLE
62
SELECT session.sql_log_off;
64
--Error ER_UNKNOWN_TABLE
65
SELECT local.sql_log_off;
67
SET session sql_log_off = 0;
68
SELECT @@session.sql_log_off;
71
--echo '#--------------------FN_DYNVARS_157_03------------------------#'
72
########################################################################
73
# change the value of sql_log_off to a valid value #
74
########################################################################
76
SET @@session.sql_log_off = 0;
77
SELECT @@session.sql_log_off;
78
SET @@session.sql_log_off = 1;
79
SELECT @@session.sql_log_off;
82
--echo '#--------------------FN_DYNVARS_157_04-------------------------#'
83
###########################################################################
84
# Change the value of sql_log_off to invalid value #
85
###########################################################################
87
--Error ER_WRONG_VALUE_FOR_VAR
88
SET @@session.sql_log_off = -1;
89
--Error ER_WRONG_VALUE_FOR_VAR
90
SET @@session.sql_log_off = 2;
91
--Error ER_WRONG_VALUE_FOR_VAR
92
SET @@session.sql_log_off = "T";
93
--Error ER_WRONG_VALUE_FOR_VAR
94
SET @@session.sql_log_off = "Y";
95
--Error ER_WRONG_VALUE_FOR_VAR
96
SET @@session.sql_log_off = TR�E;
97
--Error ER_WRONG_VALUE_FOR_VAR
98
SET @@session.sql_log_off = �N;
100
SET @@session.sql_log_off = OF;
101
SELECT @@session.sql_log_off;
103
--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.'
105
--Error ER_WRONG_VALUE_FOR_VAR
106
SET @@session.sql_log_off = �FF;
107
--Error ER_WRONG_VALUE_FOR_VAR
108
SET @@session.sql_log_off = '�';
109
--Error ER_WRONG_VALUE_FOR_VAR
110
SET @@session.sql_log_off = NO;
113
--echo '#-------------------FN_DYNVARS_157_05----------------------------#'
114
###########################################################################
115
# Test if accessing global sql_log_off gives error #
116
###########################################################################
118
--Error ER_LOCAL_VARIABLE
119
SET @@global.sql_log_off = 0;
121
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
122
SELECT @@global.sql_log_off;
124
--echo '#----------------------FN_DYNVARS_157_06------------------------#'
125
#########################################################################
126
# Check if the value in GLOBAL Table contains variable value #
127
#########################################################################
129
SELECT count(VARIABLE_VALUE)
130
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
131
WHERE VARIABLE_NAME='sql_log_off';
133
--echo '#----------------------FN_DYNVARS_157_07------------------------#'
134
#########################################################################
135
# Check if the value in GLOBAL Table matches value in variable #
136
#########################################################################
138
SELECT @@session.sql_log_off = VARIABLE_VALUE
139
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
140
WHERE VARIABLE_NAME='sql_log_off';
141
SELECT @@session.sql_log_off;
142
SELECT VARIABLE_VALUE
143
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
144
WHERE VARIABLE_NAME='sql_log_off';
146
--echo '#---------------------FN_DYNVARS_157_08-------------------------#'
147
###################################################################
148
# Check if ON and OFF values can be used on variable #
149
###################################################################
151
SET @@session.sql_log_off = OFF;
152
SELECT @@session.sql_log_off;
153
SET @@session.sql_log_off = ON;
154
SELECT @@session.sql_log_off;
156
--echo '#---------------------FN_DYNVARS_157_09----------------------#'
157
###################################################################
158
# Check if TRUE and FALSE values can be used on variable #
159
###################################################################
161
SET @@session.sql_log_off = TRUE;
162
SELECT @@session.sql_log_off;
163
SET @@session.sql_log_off = FALSE;
164
SELECT @@session.sql_log_off;
166
##############################
167
# Restore initial value #
168
##############################
170
SET @@session.sql_log_off = @session_start_value;
171
SELECT @@session.sql_log_off;
173
###############################################################
174
# END OF sql_log_off TESTS #
175
###############################################################