Debian Codegraph @

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

raw
1
2
3 ################## mysql-test\t\have_query_cache_basic.test ###################
4 # #
5 # Variable Name: have_query_cache #
6 # Scope: Global #
7 # Access Type: Static #
8 # Data Type: boolean #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author : Sharique Abdullah #
13 # #
14 # #
15 # Description:Test Cases of Dynamic System Variable have_query_cache #
16 # that checks the behavior of this variable in the following ways #
17 # * Value Check #
18 # * Scope Check #
19 # #
20 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
21 # server-system-variables.html #
22 # #
23 ###############################################################################
24
25 --echo '#---------------------BS_STVARS_015_01----------------------#'
26 ####################################################################
27 # Displaying default value #
28 ####################################################################
29 SELECT COUNT(@@GLOBAL.have_query_cache);
30 --echo 1 Expected
31
32
33 --echo '#---------------------BS_STVARS_015_02----------------------#'
34 ####################################################################
35 # Check if Value can set #
36 ####################################################################
37
38 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
39 SET @@GLOBAL.have_query_cache=1;
40 --echo Expected error 'Read only variable'
41
42 SELECT COUNT(@@GLOBAL.have_query_cache);
43 --echo 1 Expected
44
45
46
47
48 --echo '#---------------------BS_STVARS_015_03----------------------#'
49 #################################################################
50 # Check if the value in GLOBAL Table matches value in variable #
51 #################################################################
52
53 --disable_warnings
54 SELECT @@GLOBAL.have_query_cache = VARIABLE_VALUE
55 FROM performance_schema.global_variables
56 WHERE VARIABLE_NAME='have_query_cache';
57 --enable_warnings
58 --echo 1 Expected
59
60 SELECT COUNT(@@GLOBAL.have_query_cache);
61 --echo 1 Expected
62
63 --disable_warnings
64 SELECT COUNT(VARIABLE_VALUE)
65 FROM performance_schema.global_variables
66 WHERE VARIABLE_NAME='have_query_cache';
67 --enable_warnings
68 --echo 1 Expected
69
70
71
72 --echo '#---------------------BS_STVARS_015_04----------------------#'
73 ################################################################################
74 # Check if accessing variable with and without GLOBAL point to same variable #
75 ################################################################################
76 SELECT @@have_query_cache = @@GLOBAL.have_query_cache;
77 --echo 1 Expected
78
79
80
81 --echo '#---------------------BS_STVARS_015_05----------------------#'
82 ################################################################################
83 # Check if have_query_cache can be accessed with and without @@ sign #
84 ################################################################################
85
86 SELECT COUNT(@@have_query_cache);
87 --echo 1 Expected
88
89 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
90 SELECT COUNT(@@local.have_query_cache);
91 --echo Expected error 'Variable is a GLOBAL variable'
92
93 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
94 SELECT COUNT(@@SESSION.have_query_cache);
95 --echo Expected error 'Variable is a GLOBAL variable'
96
97 SELECT COUNT(@@GLOBAL.have_query_cache);
98 --echo 1 Expected
99
100 --Error ER_BAD_FIELD_ERROR
101 SELECT have_query_cache;
102 --echo Expected error 'Unknown column'
103
104