1
################### mysql-test\t\sql_notes_basic.test #########################
3
# Variable Name: sql_notes #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable sql_notes #
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 sql_notes TESTS #
30
########################################################################
33
##############################################################################
34
# Saving initial value of sql_notes in a temporary variable #
35
##############################################################################
37
SET @session_start_value = @@session.sql_notes;
38
SELECT @session_start_value;
41
--echo '#--------------------FN_DYNVARS_161_01------------------------#'
42
######################################################################
43
# Display the DEFAULT value of sql_notes #
44
######################################################################
46
SET @@session.sql_notes = 0;
47
SET @@session.sql_notes = DEFAULT;
48
SELECT @@session.sql_notes;
50
SET @@session.sql_notes = 1;
51
SET @@session.sql_notes = DEFAULT;
52
SELECT @@session.sql_notes;
55
--echo '#---------------------FN_DYNVARS_161_02-------------------------#'
56
###########################################################################
57
# Check if sql_notes can be accessed with and without @@ sign #
58
###########################################################################
63
--Error ER_UNKNOWN_TABLE
64
SELECT session.sql_notes;
66
--Error ER_UNKNOWN_TABLE
67
SELECT local.sql_notes;
69
SET session sql_notes = 0;
70
SELECT @@session.sql_notes;
73
--echo '#--------------------FN_DYNVARS_161_03------------------------#'
74
######################################################################
75
# change the value of sql_notes to a valid value #
76
######################################################################
78
SET @@session.sql_notes = 0;
79
SELECT @@session.sql_notes;
80
SET @@session.sql_notes = 1;
81
SELECT @@session.sql_notes;
84
--echo '#--------------------FN_DYNVARS_161_04-------------------------#'
85
#########################################################################
86
# Change the value of sql_notes to invalid value #
87
#########################################################################
89
--Error ER_WRONG_VALUE_FOR_VAR
90
SET @@session.sql_notes = -1;
91
--Error ER_WRONG_VALUE_FOR_VAR
92
SET @@session.sql_notes = 2;
93
--Error ER_WRONG_VALUE_FOR_VAR
94
SET @@session.sql_notes = "T";
95
--Error ER_WRONG_VALUE_FOR_VAR
96
SET @@session.sql_notes = "Y";
97
--Error ER_WRONG_VALUE_FOR_VAR
98
SET @@session.sql_notes = TR�E;
99
--Error ER_WRONG_VALUE_FOR_VAR
100
SET @@session.sql_notes = �N;
102
SET @@session.sql_notes = OF;
103
SELECT @@session.sql_notes;
105
--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.'
107
--Error ER_WRONG_VALUE_FOR_VAR
108
SET @@session.sql_notes = �FF;
109
--Error ER_WRONG_VALUE_FOR_VAR
110
SET @@session.sql_notes = '�';
111
--Error ER_WRONG_VALUE_FOR_VAR
112
SET @@session.sql_notes = NO;
115
--echo '#-------------------FN_DYNVARS_161_05----------------------------#'
116
#########################################################################
117
# Test if accessing global sql_notes gives error #
118
#########################################################################
120
--Error ER_LOCAL_VARIABLE
121
SET @@global.sql_notes = 0;
123
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
124
SELECT @@global.sql_notes;
126
--echo '#----------------------FN_DYNVARS_161_06------------------------#'
127
#########################################################################
128
# Check if the value in GLOBAL Table contains variable value #
129
#########################################################################
131
SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_notes';
133
--echo '#----------------------FN_DYNVARS_161_07------------------------#'
134
#########################################################################
135
# Check if the value in GLOBAL Table matches value in variable #
136
#########################################################################
138
SELECT @@session.sql_notes = VARIABLE_VALUE
139
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
140
WHERE VARIABLE_NAME='sql_notes';
141
SELECT @@session.sql_notes;
142
SELECT VARIABLE_VALUE
143
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
144
WHERE VARIABLE_NAME='sql_notes';
146
--echo '#---------------------FN_DYNVARS_161_08-------------------------#'
147
###################################################################
148
# Check if ON and OFF values can be used on variable #
149
###################################################################
151
SET @@session.sql_notes = OFF;
152
SELECT @@session.sql_notes;
153
SET @@session.sql_notes = ON;
154
SELECT @@session.sql_notes;
156
--echo '#---------------------FN_DYNVARS_161_09----------------------#'
157
###################################################################
158
# Check if TRUE and FALSE values can be used on variable #
159
###################################################################
161
SET @@session.sql_notes = TRUE;
162
SELECT @@session.sql_notes;
163
SET @@session.sql_notes = FALSE;
164
SELECT @@session.sql_notes;
166
##############################
167
# Restore initial value #
168
##############################
170
SET @@session.sql_notes = @session_start_value;
171
SELECT @@session.sql_notes;
173
#############################################################
174
# END OF sql_notes TESTS #
175
#############################################################