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 SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE
115 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
116 WHERE VARIABLE_NAME='autocommit';
117
118 --echo '#----------------------FN_DYNVARS_003_07------------------------#'
119 #########################################################################
120 # Check if the value in GLOBAL Table matches value in variable #
121 #########################################################################
122
123 SET @@autocommit = 1;
124 SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE
125 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
126 WHERE VARIABLE_NAME='autocommit';
127
128 --echo '#---------------------FN_DYNVARS_003_08-------------------------#'
129 ###################################################################
130 # Check if ON and OFF values can be used on variable #
131 ###################################################################
132
133 SET @@autocommit = OFF;
134 SELECT @@autocommit;
135 SET @@autocommit = ON;
136 SELECT @@autocommit;
137
138 --echo '#---------------------FN_DYNVARS_003_09----------------------#'
139 ###################################################################
140 # Check if TRUE and FALSE values can be used on variable #
141 ###################################################################
142
143 SET @@autocommit = TRUE;
144 SELECT @@autocommit;
145 SET @@autocommit = FALSE;
146 SELECT @@autocommit;
147
148
149 --echo '#---------------------FN_DYNVARS_003_10----------------------#'
150 ##############################################################################
151 # Check if accessing variable with SESSION,LOCAL and without SCOPE points #
152 # to same session variable #
153 ##############################################################################
154
155 SET @@autocommit = 0;
156 SELECT @@autocommit = @@local.autocommit;
157 SELECT @@local.autocommit = @@session.autocommit;
158 SET @@autocommit = 1;
159 SELECT @@autocommit = @@local.autocommit;
160 SELECT @@session.autocommit = @@autocommit;
161
162
163 --echo '#---------------------FN_DYNVARS_003_11----------------------#'
164 #####################################################################
165 # Check if autocommit can be accessed with and without @@ sign #
166 #####################################################################
167
168 SET autocommit = 1;
169 SELECT @@autocommit;
170 --Error ER_UNKNOWN_TABLE
171 SELECT local.autocommit;
172 --Error ER_UNKNOWN_TABLE
173 SELECT session.autocommit;
174 --Error ER_BAD_FIELD_ERROR
175 SELECT autocommit = @@session.autocommit;
176
177
178 ##############################
179 # Restore initial value #
180 ##############################
181
182 SET @@global.autocommit = @start_value;
183 SELECT @@global.autocommit;
184
185 ########################################################################
186 # END OF autocommit TESTS #
187 ########################################################################