Debian Codegraph @

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

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