Debian Codegraph @

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

raw
1 ################### mysql-test\t\sql_notes_basic.test #########################
2 # #
3 # Variable Name: sql_notes #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: boolean #
7 # Default Value: #
8 # Valid Values: 0,1 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Rizwan #
13 # #
14 # Description: Test Cases of Dynamic System Variable sql_notes #
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 sql_notes TESTS #
30 ########################################################################
31
32
33 ##############################################################################
34 # Saving initial value of sql_notes in a temporary variable #
35 ##############################################################################
36
37 SET @session_start_value = @@session.sql_notes;
38 SELECT @session_start_value;
39
40
41 --echo '#--------------------FN_DYNVARS_161_01------------------------#'
42 ######################################################################
43 # Display the DEFAULT value of sql_notes #
44 ######################################################################
45
46 SET @@session.sql_notes = 0;
47 SET @@session.sql_notes = DEFAULT;
48 SELECT @@session.sql_notes;
49
50 SET @@session.sql_notes = 1;
51 SET @@session.sql_notes = DEFAULT;
52 SELECT @@session.sql_notes;
53
54
55 --echo '#---------------------FN_DYNVARS_161_02-------------------------#'
56 ###########################################################################
57 # Check if sql_notes can be accessed with and without @@ sign #
58 ###########################################################################
59
60 SET sql_notes = 1;
61 SELECT @@sql_notes;
62
63 --Error ER_UNKNOWN_TABLE
64 SELECT session.sql_notes;
65
66 --Error ER_UNKNOWN_TABLE
67 SELECT local.sql_notes;
68
69 SET session sql_notes = 0;
70 SELECT @@session.sql_notes;
71
72
73 --echo '#--------------------FN_DYNVARS_161_03------------------------#'
74 ######################################################################
75 # change the value of sql_notes to a valid value #
76 ######################################################################
77
78 SET @@session.sql_notes = 0;
79 SELECT @@session.sql_notes;
80 SET @@session.sql_notes = 1;
81 SELECT @@session.sql_notes;
82
83
84 --echo '#--------------------FN_DYNVARS_161_04-------------------------#'
85 #########################################################################
86 # Change the value of sql_notes to invalid value #
87 #########################################################################
88
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;
101 --error ER_PARSE_ERROR
102 SET @@session.sql_notes = OF;
103 --Error ER_WRONG_VALUE_FOR_VAR
104 SET @@session.sql_notes = ÓFF;
105 --Error ER_WRONG_VALUE_FOR_VAR
106 SET @@session.sql_notes = '¹';
107 --Error ER_WRONG_VALUE_FOR_VAR
108 SET @@session.sql_notes = NO;
109
110
111 --echo '#-------------------FN_DYNVARS_161_05----------------------------#'
112 #########################################################################
113 # Test if accessing global sql_notes gives error #
114 #########################################################################
115
116 SET @@global.sql_notes = 1-@@global.sql_notes;
117 SELECT @@global.sql_notes;
118 SET @@global.sql_notes = 1-@@global.sql_notes;
119 SELECT @@global.sql_notes;
120
121 --echo '#----------------------FN_DYNVARS_161_06------------------------#'
122 #########################################################################
123 # Check if the value in GLOBAL Table contains variable value #
124 #########################################################################
125
126 --disable_warnings
127 SELECT count(VARIABLE_VALUE) FROM performance_schema.global_variables WHERE VARIABLE_NAME='sql_notes';
128 --enable_warnings
129
130 --echo '#----------------------FN_DYNVARS_161_07------------------------#'
131 #########################################################################
132 # Check if the value in GLOBAL Table matches value in variable #
133 #########################################################################
134
135 --disable_warnings
136 SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE
137 FROM performance_schema.session_variables
138 WHERE VARIABLE_NAME='sql_notes';
139 --enable_warnings
140 SELECT @@session.sql_notes;
141 --disable_warnings
142 SELECT VARIABLE_VALUE
143 FROM performance_schema.session_variables
144 WHERE VARIABLE_NAME='sql_notes';
145 --enable_warnings
146
147 --echo '#---------------------FN_DYNVARS_161_08-------------------------#'
148 ###################################################################
149 # Check if ON and OFF values can be used on variable #
150 ###################################################################
151
152 SET @@session.sql_notes = OFF;
153 SELECT @@session.sql_notes;
154 SET @@session.sql_notes = ON;
155 SELECT @@session.sql_notes;
156
157 --echo '#---------------------FN_DYNVARS_161_09----------------------#'
158 ###################################################################
159 # Check if TRUE and FALSE values can be used on variable #
160 ###################################################################
161
162 SET @@session.sql_notes = TRUE;
163 SELECT @@session.sql_notes;
164 SET @@session.sql_notes = FALSE;
165 SELECT @@session.sql_notes;
166
167 ##############################
168 # Restore initial value #
169 ##############################
170
171 SET @@session.sql_notes = @session_start_value;
172 SELECT @@session.sql_notes;
173
174 #############################################################
175 # END OF sql_notes TESTS #
176 #############################################################
177