Debian Codegraph @

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

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