Debian Codegraph @

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

raw
1 ####################### mysql-test\t\sql_log_bin_basic.test ###################
2 # #
3 # Variable Name: sql_log_bin #
4 # Scope: SESSION #
5 # Access Type: Dynamic #
6 # Data Type: boolean #
7 # Default Value: #
8 # Valid Values: 0,1 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Rizwan #
13 # #
14 # Description: Test Cases of Dynamic System Variable sql_log_bin #
15 # that checks the 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 #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ########################################################################
29 # START OF sql_log_bin TESTS #
30 ########################################################################
31
32
33 ##############################################################################
34 # Saving initial value of sql_log_bin in a temporary variable #
35 ##############################################################################
36
37 SET @session_start_value = @@session.sql_log_bin;
38 SELECT @session_start_value;
39
40 --echo '#--------------------FN_DYNVARS_156_01------------------------#'
41 ########################################################################
42 # Display the DEFAULT value of sql_log_bin #
43 ########################################################################
44
45 SET @@session.sql_log_bin = 0;
46 SET @@session.sql_log_bin = DEFAULT;
47 SELECT @@session.sql_log_bin;
48
49 SET @@session.sql_log_bin = 1;
50 SET @@session.sql_log_bin = DEFAULT;
51 SELECT @@session.sql_log_bin;
52
53
54 --echo '#---------------------FN_DYNVARS_156_02-------------------------#'
55 #############################################################################
56 # Check if sql_log_bin can be accessed with and without @@ sign #
57 #############################################################################
58
59 SET sql_log_bin = 1;
60 SELECT @@sql_log_bin;
61
62 --Error ER_UNKNOWN_TABLE
63 SELECT session.sql_log_bin;
64
65 --Error ER_UNKNOWN_TABLE
66 SELECT local.sql_log_bin;
67
68 SET session sql_log_bin = 0;
69 SELECT @@session.sql_log_bin;
70
71
72 --echo '#--------------------FN_DYNVARS_156_03------------------------#'
73 ########################################################################
74 # change the value of sql_log_bin to a valid value #
75 ########################################################################
76
77 SET @@session.sql_log_bin = 0;
78 SELECT @@session.sql_log_bin;
79 SET @@session.sql_log_bin = 1;
80 SELECT @@session.sql_log_bin;
81
82
83 --echo '#--------------------FN_DYNVARS_156_04-------------------------#'
84 ###########################################################################
85 # Change the value of sql_log_bin to invalid value #
86 ###########################################################################
87
88 --Error ER_WRONG_VALUE_FOR_VAR
89 SET @@session.sql_log_bin = -1;
90 --Error ER_WRONG_VALUE_FOR_VAR
91 SET @@session.sql_log_bin = 2;
92 --Error ER_WRONG_VALUE_FOR_VAR
93 SET @@session.sql_log_bin = "T";
94 --Error ER_WRONG_VALUE_FOR_VAR
95 SET @@session.sql_log_bin = "Y";
96 --Error ER_WRONG_VALUE_FOR_VAR
97 SET @@session.sql_log_bin = TRÜE;
98 --Error ER_WRONG_VALUE_FOR_VAR
99 SET @@session.sql_log_bin = ÕN;
100 --error ER_PARSE_ERROR
101 SET @@session.sql_log_bin = OF;
102 --Error ER_WRONG_VALUE_FOR_VAR
103 SET @@session.sql_log_bin = ÓFF;
104 --Error ER_WRONG_VALUE_FOR_VAR
105 SET @@session.sql_log_bin = '¹';
106 --Error ER_WRONG_VALUE_FOR_VAR
107 SET @@session.sql_log_bin = NO;
108
109
110 --echo '#-------------------FN_DYNVARS_156_05----------------------------#'
111 ###########################################################################
112 # Test if setting global sql_log_bin gives error, #
113 # and there is a deprecation warning on reading it. #
114 ###########################################################################
115
116 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
117 SELECT @@global.sql_log_bin;
118 --Error ER_LOCAL_VARIABLE
119 SET @@global.sql_log_bin = 0;
120 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
121 SELECT @@global.sql_log_bin;
122 --Error ER_LOCAL_VARIABLE
123 SET @@global.sql_log_bin = 1;
124
125 --echo '#----------------------FN_DYNVARS_156_06------------------------#'
126 #########################################################################
127 # Check if the value in GLOBAL Table contains variable value #
128 #########################################################################
129
130 --disable_warnings
131 SELECT count(VARIABLE_VALUE) FROM performance_schema.global_variables WHERE VARIABLE_NAME='sql_log_bin';
132 --enable_warnings
133
134 --echo '#----------------------FN_DYNVARS_156_07------------------------#'
135 #########################################################################
136 # Check if the value in GLOBAL Table matches value in variable #
137 #########################################################################
138
139 --disable_warnings
140 SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE
141 FROM performance_schema.session_variables
142 WHERE VARIABLE_NAME='sql_log_bin';
143 --enable_warnings
144 SELECT @@session.sql_log_bin;
145 --disable_warnings
146 SELECT VARIABLE_VALUE
147 FROM performance_schema.session_variables
148 WHERE VARIABLE_NAME='sql_log_bin';
149 --enable_warnings
150
151 --echo '#---------------------FN_DYNVARS_156_08-------------------------#'
152 ###################################################################
153 # Check if ON and OFF values can be used on variable #
154 ###################################################################
155
156 SET @@session.sql_log_bin = OFF;
157 SELECT @@session.sql_log_bin;
158 SET @@session.sql_log_bin = ON;
159 SELECT @@session.sql_log_bin;
160
161 --echo '#---------------------FN_DYNVARS_156_09----------------------#'
162 ###################################################################
163 # Check if TRUE and FALSE values can be used on variable #
164 ###################################################################
165
166 SET @@session.sql_log_bin = TRUE;
167 SELECT @@session.sql_log_bin;
168 SET @@session.sql_log_bin = FALSE;
169 SELECT @@session.sql_log_bin;
170
171 ##############################
172 # Restore initial value #
173 ##############################
174
175 SET @@session.sql_log_bin = @session_start_value;
176 SELECT @@session.sql_log_bin;
177
178 ###############################################################
179 # END OF sql_log_bin TESTS #
180 ###############################################################