1
############## mysql-test\t\sql_quote_show_create_basic.test ##################
3
# Variable Name: sql_quote_show_create #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable sql_quote_show_create #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html #
24
###############################################################################
26
--source include/load_sysvars.inc
28
#######################################################################
29
# START OF sql_quote_show_create TESTS #
30
#######################################################################
33
##############################################################################
34
# Saving initial value of sql_quote_show_create in a temporary variable #
35
##############################################################################
37
SET @session_start_value = @@session.sql_quote_show_create;
38
SELECT @session_start_value;
40
--echo '#--------------------FN_DYNVARS_162_01------------------------#'
41
######################################################################
42
# Display the DEFAULT value of sql_quote_show_create #
43
######################################################################
45
SET @@session.sql_quote_show_create = 0;
46
SET @@session.sql_quote_show_create = DEFAULT;
47
SELECT @@session.sql_quote_show_create;
49
SET @@session.sql_quote_show_create = 1;
50
SET @@session.sql_quote_show_create = DEFAULT;
51
SELECT @@session.sql_quote_show_create;
54
--echo '#---------------------FN_DYNVARS_162_02-------------------------#'
55
#############################################################################
56
# Check if sql_quote_show_create can be accessed with and without @@ sign #
57
#############################################################################
59
SET sql_quote_show_create = 1;
60
SELECT @@sql_quote_show_create;
62
--Error ER_UNKNOWN_TABLE
63
SELECT session.sql_quote_show_create;
65
--Error ER_UNKNOWN_TABLE
66
SELECT local.sql_quote_show_create;
68
SET session sql_quote_show_create = 0;
69
SELECT @@session.sql_quote_show_create;
72
--echo '#--------------------FN_DYNVARS_162_03------------------------#'
73
########################################################################
74
# change the value of sql_quote_show_create to a valid value #
75
########################################################################
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;
83
--echo '#--------------------FN_DYNVARS_162_04-------------------------#'
84
##########################################################################
85
# Change the value of sql_quote_show_create to invalid value #
86
##########################################################################
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;
101
SET @@session.sql_quote_show_create = OF;
102
SELECT @@session.sql_quote_show_create;
104
--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.'
106
--Error ER_WRONG_VALUE_FOR_VAR
107
SET @@session.sql_quote_show_create = �FF;
108
--Error ER_WRONG_VALUE_FOR_VAR
109
SET @@session.sql_quote_show_create = '�';
110
--Error ER_WRONG_VALUE_FOR_VAR
111
SET @@session.sql_quote_show_create = NO;
114
--echo '#-------------------FN_DYNVARS_162_05----------------------------#'
115
##########################################################################
116
# Test if accessing global sql_quote_show_create gives error #
117
##########################################################################
119
--Error ER_LOCAL_VARIABLE
120
SET @@global.sql_quote_show_create = 0;
122
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
123
SELECT @@global.sql_quote_show_create;
125
--echo '#----------------------FN_DYNVARS_162_06------------------------#'
126
#########################################################################
127
# Check if the value in GLOBAL Table contains variable value #
128
#########################################################################
130
SELECT count(VARIABLE_VALUE)
131
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
132
WHERE VARIABLE_NAME='sql_quote_show_create';
134
--echo '#----------------------FN_DYNVARS_162_07------------------------#'
135
#########################################################################
136
# Check if the value in GLOBAL Table matches value in variable #
137
#########################################################################
139
SELECT @@session.sql_quote_show_create = VARIABLE_VALUE
140
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
141
WHERE VARIABLE_NAME='sql_quote_show_create';
142
SELECT @@session.sql_quote_show_create;
143
SELECT VARIABLE_VALUE
144
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
145
WHERE VARIABLE_NAME='sql_quote_show_create';
147
--echo '#---------------------FN_DYNVARS_162_08-------------------------#'
148
###################################################################
149
# Check if ON and OFF values can be used on variable #
150
###################################################################
152
SET @@session.sql_quote_show_create = OFF;
153
SELECT @@session.sql_quote_show_create;
154
SET @@session.sql_quote_show_create = ON;
155
SELECT @@session.sql_quote_show_create;
157
--echo '#---------------------FN_DYNVARS_162_09----------------------#'
158
###################################################################
159
# Check if TRUE and FALSE values can be used on variable #
160
###################################################################
162
SET @@session.sql_quote_show_create = TRUE;
163
SELECT @@session.sql_quote_show_create;
164
SET @@session.sql_quote_show_create = FALSE;
165
SELECT @@session.sql_quote_show_create;
167
##############################
168
# Restore initial value #
169
##############################
171
SET @@session.sql_quote_show_create = @session_start_value;
172
SELECT @@session.sql_quote_show_create;
174
###############################################################
175
# END OF sql_quote_show_create TESTS #
176
###############################################################