Debian Codegraph @

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

raw
1 ############## mysql-test\t\sql_quote_show_create_basic.test ##################
2 # #
3 # Variable Name: sql_quote_show_create #
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_quote_show_create #
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_quote_show_create TESTS #
30 #######################################################################
31
32
33 ##############################################################################
34 # Saving initial value of sql_quote_show_create in a temporary variable #
35 ##############################################################################
36
37 SET @session_start_value = @@session.sql_quote_show_create;
38 SELECT @session_start_value;
39
40 --echo '#--------------------FN_DYNVARS_162_01------------------------#'
41 ######################################################################
42 # Display the DEFAULT value of sql_quote_show_create #
43 ######################################################################
44
45 SET @@session.sql_quote_show_create = 0;
46 SET @@session.sql_quote_show_create = DEFAULT;
47 SELECT @@session.sql_quote_show_create;
48
49 SET @@session.sql_quote_show_create = 1;
50 SET @@session.sql_quote_show_create = DEFAULT;
51 SELECT @@session.sql_quote_show_create;
52
53
54 --echo '#---------------------FN_DYNVARS_162_02-------------------------#'
55 #############################################################################
56 # Check if sql_quote_show_create can be accessed with and without @@ sign #
57 #############################################################################
58
59 SET sql_quote_show_create = 1;
60 SELECT @@sql_quote_show_create;
61
62 --Error ER_UNKNOWN_TABLE
63 SELECT session.sql_quote_show_create;
64
65 --Error ER_UNKNOWN_TABLE
66 SELECT local.sql_quote_show_create;
67
68 SET session sql_quote_show_create = 0;
69 SELECT @@session.sql_quote_show_create;
70
71
72 --echo '#--------------------FN_DYNVARS_162_03------------------------#'
73 ########################################################################
74 # change the value of sql_quote_show_create to a valid value #
75 ########################################################################
76
77 SET @@session.sql_quote_show_create = 0;
78 SELECT @@session.sql_quote_show_create;
79 SET @@session.sql_quote_show_create = 1;
80 SELECT @@session.sql_quote_show_create;
81
82
83 --echo '#--------------------FN_DYNVARS_162_04-------------------------#'
84 ##########################################################################
85 # Change the value of sql_quote_show_create to invalid value #
86 ##########################################################################
87
88 --Error ER_WRONG_VALUE_FOR_VAR
89 SET @@session.sql_quote_show_create = -1;
90 --Error ER_WRONG_VALUE_FOR_VAR
91 SET @@session.sql_quote_show_create = 2;
92 --Error ER_WRONG_VALUE_FOR_VAR
93 SET @@session.sql_quote_show_create = "T";
94 --Error ER_WRONG_VALUE_FOR_VAR
95 SET @@session.sql_quote_show_create = "Y";
96 --Error ER_WRONG_VALUE_FOR_VAR
97 SET @@session.sql_quote_show_create = TRÜE;
98 --Error ER_WRONG_VALUE_FOR_VAR
99 SET @@session.sql_quote_show_create = ÕN;
100 --error ER_PARSE_ERROR
101 SET @@session.sql_quote_show_create = OF;
102 --Error ER_WRONG_VALUE_FOR_VAR
103 SET @@session.sql_quote_show_create = ÓFF;
104 --Error ER_WRONG_VALUE_FOR_VAR
105 SET @@session.sql_quote_show_create = '¹';
106 --Error ER_WRONG_VALUE_FOR_VAR
107 SET @@session.sql_quote_show_create = NO;
108
109
110 --echo '#-------------------FN_DYNVARS_162_05----------------------------#'
111 ##########################################################################
112 # Test if accessing global sql_quote_show_create gives error #
113 ##########################################################################
114
115 SET @@global.sql_quote_show_create = 1-@@global.sql_quote_show_create;
116 SELECT @@global.sql_quote_show_create;
117 SET @@global.sql_quote_show_create = 1-@@global.sql_quote_show_create;
118 SELECT @@global.sql_quote_show_create;
119
120 --echo '#----------------------FN_DYNVARS_162_06------------------------#'
121 #########################################################################
122 # Check if the value in GLOBAL Table contains variable value #
123 #########################################################################
124
125 --disable_warnings
126 SELECT count(VARIABLE_VALUE)
127 FROM performance_schema.global_variables
128 WHERE VARIABLE_NAME='sql_quote_show_create';
129 --enable_warnings
130
131 --echo '#----------------------FN_DYNVARS_162_07------------------------#'
132 #########################################################################
133 # Check if the value in GLOBAL Table matches value in variable #
134 #########################################################################
135
136 --disable_warnings
137 SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE
138 FROM performance_schema.session_variables
139 WHERE VARIABLE_NAME='sql_quote_show_create';
140 --enable_warnings
141 SELECT @@session.sql_quote_show_create;
142 --disable_warnings
143 SELECT VARIABLE_VALUE
144 FROM performance_schema.session_variables
145 WHERE VARIABLE_NAME='sql_quote_show_create';
146 --enable_warnings
147
148 --echo '#---------------------FN_DYNVARS_162_08-------------------------#'
149 ###################################################################
150 # Check if ON and OFF values can be used on variable #
151 ###################################################################
152
153 SET @@session.sql_quote_show_create = OFF;
154 SELECT @@session.sql_quote_show_create;
155 SET @@session.sql_quote_show_create = ON;
156 SELECT @@session.sql_quote_show_create;
157
158 --echo '#---------------------FN_DYNVARS_162_09----------------------#'
159 ###################################################################
160 # Check if TRUE and FALSE values can be used on variable #
161 ###################################################################
162
163 SET @@session.sql_quote_show_create = TRUE;
164 SELECT @@session.sql_quote_show_create;
165 SET @@session.sql_quote_show_create = FALSE;
166 SELECT @@session.sql_quote_show_create;
167
168 ##############################
169 # Restore initial value #
170 ##############################
171
172 SET @@session.sql_quote_show_create = @session_start_value;
173 SELECT @@session.sql_quote_show_create;
174
175 ###############################################################
176 # END OF sql_quote_show_create TESTS #
177 ###############################################################