1
############## mysql-test\t\auto_commit_basic.test #############################
3
# Variable Name: autocommit #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
12
# Author: Salman Rawala #
14
# Description: Test Cases of Dynamic System Variable "autocommit" #
15
# that checks behavior of this variable in the following ways #
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: (Not Mentioned on website) #
23
################################################################################
25
--source include/load_sysvars.inc
27
########################################################################
28
# START OF autocommit TESTS #
29
########################################################################
32
########################################################################
33
# Saving initial value of autocommit in a temporary variable #
34
########################################################################
36
SET @start_value = @@autocommit;
40
--echo '#--------------------FN_DYNVARS_003_01------------------------#'
41
########################################################################
42
# Display the DEFAULT value of autocommit #
43
########################################################################
46
SET @@autocommit = DEFAULT;
48
echo 'Bug: variable DEFAULT value not working and is not throwing error';
50
--echo '#---------------------FN_DYNVARS_003_02-------------------------#'
51
###############################################
52
# Check default value of variable #
53
###############################################
55
SET @@autocommit = @start_value;
56
SELECT @@autocommit = 1;
59
--echo '#--------------------FN_DYNVARS_003_03------------------------#'
60
########################################################################
61
# Change the value of autocommit to a valid value #
62
########################################################################
69
--echo '#--------------------FN_DYNVARS_003_04-------------------------#'
70
###########################################################################
71
# Change the value of autocommit to invalid value #
72
###########################################################################
74
--Error ER_WRONG_VALUE_FOR_VAR
76
--Error ER_WRONG_VALUE_FOR_VAR
77
SET @@autocommit = -1;
78
--Error ER_WRONG_VALUE_FOR_VAR
79
SET @@autocommit = TRUEF;
80
--Error ER_WRONG_VALUE_FOR_VAR
81
SET @@autocommit = TRUE_F;
82
--Error ER_WRONG_VALUE_FOR_VAR
83
SET @@autocommit = FALSE0;
84
--Error ER_WRONG_VALUE_FOR_VAR
85
SET @@autocommit = OON;
86
--Error ER_WRONG_VALUE_FOR_VAR
87
SET @@autocommit = ONN;
88
--Error ER_WRONG_VALUE_FOR_VAR
89
SET @@autocommit = OOFF;
90
--Error ER_WRONG_VALUE_FOR_VAR
91
SET @@autocommit = 0FF;
92
--Error ER_WRONG_VALUE_FOR_VAR
93
SET @@autocommit = ' ';
94
--Error ER_WRONG_VALUE_FOR_VAR
95
SET @@autocommit = " ";
96
--Error ER_WRONG_VALUE_FOR_VAR
97
SET @@autocommit = '';
100
--echo '#-------------------FN_DYNVARS_003_05----------------------------#'
101
###########################################################################
102
# Test if accessing global autocommit gives error #
103
###########################################################################
105
--Error ER_LOCAL_VARIABLE
106
SET @@global.autocommit = 0;
107
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
108
SELECT @@global.autocommit;
111
--echo '#----------------------FN_DYNVARS_003_06------------------------#'
112
#########################################################################
113
# Check if the value in SESSION Table matches value in variable #
114
#########################################################################
116
SELECT @@session.autocommit = VARIABLE_VALUE
117
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
118
WHERE VARIABLE_NAME='autocommit';
119
--echo Bug # 34839: Values in variable and information_schema do not match for autocommit
121
--echo '#----------------------FN_DYNVARS_003_07------------------------#'
122
#########################################################################
123
# Check if the value in GLOBAL Table matches value in variable #
124
#########################################################################
126
SET @@autocommit = 1;
127
SELECT @@autocommit = VARIABLE_VALUE
128
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
129
WHERE VARIABLE_NAME='autocommit';
131
--echo '#---------------------FN_DYNVARS_003_08-------------------------#'
132
###################################################################
133
# Check if ON and OFF values can be used on variable #
134
###################################################################
136
SET @@autocommit = OFF;
138
SET @@autocommit = ON;
141
--echo '#---------------------FN_DYNVARS_003_09----------------------#'
142
###################################################################
143
# Check if TRUE and FALSE values can be used on variable #
144
###################################################################
146
SET @@autocommit = TRUE;
148
SET @@autocommit = FALSE;
152
--echo '#---------------------FN_DYNVARS_003_10----------------------#'
153
##############################################################################
154
# Check if accessing variable with SESSION,LOCAL and without SCOPE points #
155
# to same session variable #
156
##############################################################################
158
SET @@autocommit = 0;
159
SELECT @@autocommit = @@local.autocommit;
160
SELECT @@local.autocommit = @@session.autocommit;
161
SET @@autocommit = 1;
162
SELECT @@autocommit = @@local.autocommit;
163
SELECT @@session.autocommit = @@autocommit;
166
--echo '#---------------------FN_DYNVARS_003_11----------------------#'
167
#####################################################################
168
# Check if autocommit can be accessed with and without @@ sign #
169
#####################################################################
173
--Error ER_UNKNOWN_TABLE
174
SELECT local.autocommit;
175
--Error ER_UNKNOWN_TABLE
176
SELECT session.autocommit;
177
--Error ER_BAD_FIELD_ERROR
178
SELECT autocommit = @@session.autocommit;
181
##############################
182
# Restore initial value #
183
##############################
185
SET @@autocommit = @start_value;
188
########################################################################
189
# END OF autocommit TESTS #
190
########################################################################