Debian Codegraph @

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

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