Debian Codegraph @

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

raw
1 ############## mysql-test\t\automatic_sp_privileges_basic.test #################
2 # #
3 # Variable Name: automatic_sp_privileges #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: Boolean #
7 # Default Value: TRUE #
8 # Range: NA #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman Rawala #
13 # #
14 # Description: Test Cases of Dynamic System Variable "automatic_sp_privileges" #
15 # that checks 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_automatic_sp_privileges #
23 # #
24 ################################################################################
25
26 --source include/load_sysvars.inc
27
28 #######################################################################
29 # START OF automatic_sp_privileges TESTS #
30 #######################################################################
31
32
33 ###############################################################################
34 # Saving initial value of automatic_sp_privileges in a temporary variable #
35 ###############################################################################
36
37 SET @start_value = @@global.automatic_sp_privileges;
38 SELECT @start_value;
39
40 --echo '#--------------------FN_DYNVARS_004_01------------------------#'
41 ###############################################################################
42 # Display the DEFAULT value of automatic_sp_privileges #
43 ###############################################################################
44
45 SET @@global.automatic_sp_privileges = 0;
46 SET @@global.automatic_sp_privileges = DEFAULT;
47 SELECT @@global.automatic_sp_privileges;
48
49
50 --echo '#---------------------FN_DYNVARS_004_02-------------------------#'
51 ###############################################
52 # Verify default value of variable #
53 ###############################################
54
55 SET @@global.automatic_sp_privileges = @start_value;
56 SELECT @@global.automatic_sp_privileges = TRUE;
57
58
59 --echo '#--------------------FN_DYNVARS_004_03------------------------#'
60 ###############################################################################
61 # Change the value of automatic_sp_privileges to a valid value #
62 ###############################################################################
63
64 SET @@global.automatic_sp_privileges = 0;
65 SELECT @@global.automatic_sp_privileges;
66 SET @@global.automatic_sp_privileges = 1;
67 SELECT @@global.automatic_sp_privileges;
68
69 --echo '#--------------------FN_DYNVARS_004_04-------------------------#'
70 ###############################################################################
71 # Change the value of automatic_sp_privileges to invalid value #
72 ###############################################################################
73
74 --Error ER_WRONG_VALUE_FOR_VAR
75 SET @@global.automatic_sp_privileges = 2;
76 --Error ER_WRONG_VALUE_FOR_VAR
77 SET @@global.automatic_sp_privileges = -1;
78 --Error ER_WRONG_VALUE_FOR_VAR
79 SET @@global.automatic_sp_privileges = TRUEF;
80 --Error ER_WRONG_VALUE_FOR_VAR
81 SET @@global.automatic_sp_privileges = TRUE_F;
82 --Error ER_WRONG_VALUE_FOR_VAR
83 SET @@global.automatic_sp_privileges = FALSE0;
84 --Error ER_WRONG_VALUE_FOR_VAR
85 SET @@global.automatic_sp_privileges = OON;
86 --Error ER_WRONG_VALUE_FOR_VAR
87 SET @@global.automatic_sp_privileges = ONN;
88 --Error ER_WRONG_VALUE_FOR_VAR
89 SET @@global.automatic_sp_privileges = OOFF;
90 --Error ER_WRONG_VALUE_FOR_VAR
91 SET @@global.automatic_sp_privileges = 0FF;
92 --Error ER_WRONG_VALUE_FOR_VAR
93 SET @@global.automatic_sp_privileges = ' ';
94 --Error ER_WRONG_VALUE_FOR_VAR
95 SET @@global.automatic_sp_privileges = " ";
96 --Error ER_WRONG_VALUE_FOR_VAR
97 SET @@global.automatic_sp_privileges = '';
98
99
100 --echo '#-------------------FN_DYNVARS_004_05----------------------------#'
101 ###########################################################################
102 # Test if accessing session automatic_sp_privileges gives error #
103 ###########################################################################
104
105 --Error ER_GLOBAL_VARIABLE
106 SET @@session.automatic_sp_privileges = 1;
107 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
108 SELECT @@session.automatic_sp_privileges;
109
110
111 --echo '#----------------------FN_DYNVARS_004_06------------------------#'
112 ##############################################################################
113 # Check if the value in GLOBAL Tables matches values in variable #
114 ##############################################################################
115
116 --disable_warnings
117 SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE
118 FROM performance_schema.global_variables
119 WHERE VARIABLE_NAME='automatic_sp_privileges';
120 --enable_warnings
121
122 --echo '#---------------------FN_DYNVARS_004_07----------------------#'
123 ###################################################################
124 # Check if ON and OFF values can be used on variable #
125 ###################################################################
126
127 SET @@global.automatic_sp_privileges = OFF;
128 SELECT @@global.automatic_sp_privileges;
129 SET @@global.automatic_sp_privileges = ON;
130 SELECT @@global.automatic_sp_privileges;
131
132 --echo '#---------------------FN_DYNVARS_004_08----------------------#'
133 ###################################################################
134 # Check if TRUE and FALSE values can be used on variable #
135 ###################################################################
136
137 SET @@global.automatic_sp_privileges = TRUE;
138 SELECT @@global.automatic_sp_privileges;
139 SET @@global.automatic_sp_privileges = FALSE;
140 SELECT @@global.automatic_sp_privileges;
141
142 --echo '#---------------------FN_DYNVARS_004_09----------------------#'
143 ##############################################################################
144 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
145 # to same session variable #
146 ##############################################################################
147
148 SET @@global.automatic_sp_privileges = 1;
149 SELECT @@automatic_sp_privileges = @@global.automatic_sp_privileges;
150
151 --echo '#---------------------FN_DYNVARS_004_10----------------------#'
152 ###############################################################################
153 # Check if automatic_sp_privileges can be accessed with and without @@ sign #
154 ###############################################################################
155 --Error ER_GLOBAL_VARIABLE
156 SET automatic_sp_privileges = 1;
157 --Error ER_PARSE_ERROR
158 SET local.automatic_sp_privileges = 1;
159 --Error ER_UNKNOWN_TABLE
160 SELECT local.automatic_sp_privileges;
161 --Error ER_PARSE_ERROR
162 SET global.automatic_sp_privileges = 1;
163 --Error ER_UNKNOWN_TABLE
164 SELECT global.automatic_sp_privileges;
165 --Error ER_BAD_FIELD_ERROR
166 SELECT automatic_sp_privileges;
167 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
168 SELECT @@session.automatic_sp_privileges;
169
170
171
172 ##############################
173 # Restore initial value #
174 ##############################
175
176 SET @@global.automatic_sp_privileges = @start_value;
177 SELECT @@global.automatic_sp_privileges;
178
179
180 #############################################################
181 # END OF automatic_sp_privileges TESTS #
182 #############################################################