Debian Codegraph @

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

raw
1 ############## mysql-test\t\query_cache_min_res_unit_basic.test ###############
2 # #
3 # Variable Name: query_cache_min_res_unit #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value:1024 #
8 # Min Value:0 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman Rawala #
13 # #
14 # Description: Test Cases of Dynamic System Variable query_cache_min_res_unit #
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/have_query_cache.inc
27 --source include/load_sysvars.inc
28
29 ########################################################################
30
31
32 ########################################################################
33 # START OF query_cache_min_res_unit TESTS #
34 ########################################################################
35
36
37 ###############################################################################
38 # Saving initial value of query_cache_min_res_unit in a temporary variable #
39 ###############################################################################
40
41 SET @start_value = @@global.query_cache_min_res_unit;
42 SELECT @start_value;
43
44
45 --echo '#--------------------FN_DYNVARS_132_01------------------------#'
46 ###############################################################################
47 # Display the DEFAULT value of query_cache_min_res_unit #
48 ###############################################################################
49
50 SET @@global.query_cache_min_res_unit = 99;
51 SET @@global.query_cache_min_res_unit = DEFAULT;
52 SELECT @@global.query_cache_min_res_unit;
53
54
55 --echo '#---------------------FN_DYNVARS_132_02-------------------------#'
56 ###############################################
57 # Verify default value of variable #
58 ###############################################
59
60 SET @@global.query_cache_min_res_unit = @start_value;
61 SELECT @@global.query_cache_min_res_unit = 4096;
62
63
64 --echo '#--------------------FN_DYNVARS_132_03------------------------#'
65 ################################################################################
66 # Change the value of query_cache_min_res_unit to a valid value #
67 ################################################################################
68
69 SET @@global.query_cache_min_res_unit = 0;
70 SELECT @@global.query_cache_min_res_unit;
71 SET @@global.query_cache_min_res_unit = 1;
72 SELECT @@global.query_cache_min_res_unit;
73 SET @@global.query_cache_min_res_unit = 512;
74 SELECT @@global.query_cache_min_res_unit;
75 SET @@global.query_cache_min_res_unit = 513;
76 SELECT @@global.query_cache_min_res_unit;
77 SET @@global.query_cache_min_res_unit = 1048576;
78 SELECT @@global.query_cache_min_res_unit;
79 SET @@global.query_cache_min_res_unit = 1048575;
80 SELECT @@global.query_cache_min_res_unit;
81
82
83 --echo '#--------------------FN_DYNVARS_132_04-------------------------#'
84 ###################################################################################
85 # Change the value of query_cache_min_res_unit to invalid value #
86 ###################################################################################
87
88 SET @@global.query_cache_min_res_unit = -1;
89 SELECT @@global.query_cache_min_res_unit;
90 SET @@global.query_cache_min_res_unit = 4294967296;
91 SELECT @@global.query_cache_min_res_unit;
92 SET @@global.query_cache_min_res_unit = 511;
93 SELECT @@global.query_cache_min_res_unit;
94 --Error ER_WRONG_TYPE_FOR_VAR
95 SET @@global.query_cache_min_res_unit = 10000.01;
96 SELECT @@global.query_cache_min_res_unit;
97 SET @@global.query_cache_min_res_unit = -1024;
98 SELECT @@global.query_cache_min_res_unit;
99 SET @@global.query_cache_min_res_unit = 42949672950;
100 SELECT @@global.query_cache_min_res_unit;
101
102 --Error ER_WRONG_TYPE_FOR_VAR
103 SET @@global.query_cache_min_res_unit = ON;
104 SELECT @@global.query_cache_min_res_unit;
105 --Error ER_WRONG_TYPE_FOR_VAR
106 SET @@global.query_cache_min_res_unit = 'test';
107 SELECT @@global.query_cache_min_res_unit;
108
109
110 --echo '#-------------------FN_DYNVARS_132_05----------------------------#'
111 ###################################################################################
112 # Test if accessing session query_cache_min_res_unit gives error #
113 ###################################################################################
114
115 --Error ER_GLOBAL_VARIABLE
116 SET @@session.query_cache_min_res_unit = 0;
117 SELECT @@query_cache_min_res_unit;
118
119
120 --echo '#----------------------FN_DYNVARS_132_06------------------------#'
121 ##############################################################################
122 # Check if the value in GLOBAL & SESSION Tables matches values in variable #
123 ##############################################################################
124
125 SELECT @@global.query_cache_min_res_unit = VARIABLE_VALUE
126 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
127 WHERE VARIABLE_NAME='query_cache_min_res_unit';
128
129 SELECT @@query_cache_min_res_unit = VARIABLE_VALUE
130 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
131 WHERE VARIABLE_NAME='query_cache_min_res_unit';
132
133
134 --echo '#---------------------FN_DYNVARS_132_07----------------------#'
135 ###################################################################
136 # Check if TRUE and FALSE values can be used on variable #
137 ###################################################################
138
139 SET @@global.query_cache_min_res_unit = TRUE;
140 SELECT @@global.query_cache_min_res_unit;
141 SET @@global.query_cache_min_res_unit = FALSE;
142 SELECT @@global.query_cache_min_res_unit;
143
144
145 --echo '#---------------------FN_DYNVARS_132_08----------------------#'
146 ########################################################################################################
147 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
148 ########################################################################################################
149
150 SET @@global.query_cache_min_res_unit = 1;
151 SELECT @@query_cache_min_res_unit = @@global.query_cache_min_res_unit;
152
153
154 --echo '#---------------------FN_DYNVARS_132_09----------------------#'
155 ##################################################################################
156 # Check if query_cache_min_res_unit can be accessed with and without @@ sign #
157 ##################################################################################
158
159 --Error ER_GLOBAL_VARIABLE
160 SET query_cache_min_res_unit = 1;
161 SELECT @@query_cache_min_res_unit;
162 --Error ER_UNKNOWN_TABLE
163 SELECT local.query_cache_min_res_unit;
164 --Error ER_UNKNOWN_TABLE
165 SELECT global.query_cache_min_res_unit;
166 --Error ER_BAD_FIELD_ERROR
167 SELECT query_cache_min_res_unit = @@session.query_cache_min_res_unit;
168
169
170 ##############################
171 # Restore initial value #
172 ##############################
173
174 SET @@global.query_cache_min_res_unit = @start_value;
175 SELECT @@global.query_cache_min_res_unit;
176
177
178 ########################################################################
179 # END OF query_cache_min_res_unit TESTS #
180 ########################################################################