1
############## mysql-test\t\max_prepared_stmt_count_basic.test ###############
3
# Variable Name: max_prepared_stmt_count #
5
# Access Type: Dynamic #
7
# Default Value: 16382 #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count #
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
#Due to differences in the results, ps-protocol is switched off.
29
--source include/load_sysvars.inc
32
########################################################################
33
# START OF max_prepared_stmt_count TESTS #
34
########################################################################
37
###########################################################################
38
# Saving initial value of max_prepared_stmt_count in a temporary variable #
39
###########################################################################
41
SET @start_value = @@global.max_prepared_stmt_count;
45
--echo '#--------------------FN_DYNVARS_081_01------------------------#'
46
##########################################################################
47
# Display the DEFAULT value of max_prepared_stmt_count #
48
##########################################################################
50
SET @@global.max_prepared_stmt_count = 5000;
51
SET @@global.max_prepared_stmt_count = DEFAULT;
52
SELECT @@global.max_prepared_stmt_count;
55
--echo '#---------------------FN_DYNVARS_081_02-------------------------#'
56
###############################################
57
# Verify default value of variable #
58
###############################################
60
SET @@global.max_prepared_stmt_count = @start_value;
61
SELECT @@global.max_prepared_stmt_count = 16382;
64
--echo '#--------------------FN_DYNVARS_081_03------------------------#'
65
##########################################################################
66
# Change the value of max_prepared_stmt_count to a valid value #
67
##########################################################################
69
SET @@global.max_prepared_stmt_count = 0;
70
SELECT @@global.max_prepared_stmt_count;
71
SET @@global.max_prepared_stmt_count = 1;
72
SELECT @@global.max_prepared_stmt_count;
73
SET @@global.max_prepared_stmt_count = 1048576;
74
SELECT @@global.max_prepared_stmt_count;
75
SET @@global.max_prepared_stmt_count = 1048575;
76
SELECT @@global.max_prepared_stmt_count;
77
SET @@global.max_prepared_stmt_count = 65535;
78
SELECT @@global.max_prepared_stmt_count;
81
--echo '#--------------------FN_DYNVARS_081_04-------------------------#'
82
#############################################################################
83
# Change the value of max_prepared_stmt_count to invalid value #
84
#############################################################################
86
SET @@global.max_prepared_stmt_count = -1;
87
SELECT @@global.max_prepared_stmt_count;
88
SET @@global.max_prepared_stmt_count = 100000000000;
89
SELECT @@global.max_prepared_stmt_count;
90
--Error ER_WRONG_TYPE_FOR_VAR
91
SET @@global.max_prepared_stmt_count = 10000.01;
92
SELECT @@global.max_prepared_stmt_count;
93
SET @@global.max_prepared_stmt_count = -1024;
94
SELECT @@global.max_prepared_stmt_count;
95
SET @@global.max_prepared_stmt_count = 1048577;
96
SELECT @@global.max_prepared_stmt_count;
97
SET @@global.max_prepared_stmt_count = 104857612;
98
SELECT @@global.max_prepared_stmt_count;
100
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
102
--Error ER_WRONG_TYPE_FOR_VAR
103
SET @@global.max_prepared_stmt_count = ON;
104
SELECT @@global.max_prepared_stmt_count;
105
--Error ER_WRONG_TYPE_FOR_VAR
106
SET @@global.max_prepared_stmt_count = 'test';
107
SELECT @@global.max_prepared_stmt_count;
110
--echo '#-------------------FN_DYNVARS_081_05----------------------------#'
111
#############################################################################
112
# Test if accessing session max_prepared_stmt_count gives error #
113
#############################################################################
115
--Error ER_GLOBAL_VARIABLE
116
SET @@session.max_prepared_stmt_count = 4096;
117
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
118
SELECT @@session.max_prepared_stmt_count;
121
--echo '#----------------------FN_DYNVARS_081_06------------------------#'
122
##############################################################################
123
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
124
##############################################################################
126
SELECT @@global.max_prepared_stmt_count = VARIABLE_VALUE
127
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
128
WHERE VARIABLE_NAME='max_prepared_stmt_count';
130
SELECT @@max_prepared_stmt_count = VARIABLE_VALUE
131
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
132
WHERE VARIABLE_NAME='max_prepared_stmt_count';
135
--echo '#---------------------FN_DYNVARS_081_07----------------------#'
136
###################################################################
137
# Check if TRUE and FALSE values can be used on variable #
138
###################################################################
140
SET @@global.max_prepared_stmt_count = TRUE;
141
SELECT @@global.max_prepared_stmt_count;
142
SET @@global.max_prepared_stmt_count = FALSE;
143
SELECT @@global.max_prepared_stmt_count;
146
--echo '#---------------------FN_DYNVARS_081_08----------------------#'
147
########################################################################################################
148
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
149
########################################################################################################
151
SET @@global.max_prepared_stmt_count = 5000;
152
SELECT @@max_prepared_stmt_count = @@global.max_prepared_stmt_count;
155
--echo '#---------------------FN_DYNVARS_081_09----------------------#'
156
################################################################################
157
# Check if max_prepared_stmt_count can be accessed with and without @@ sign #
158
################################################################################
160
--Error ER_GLOBAL_VARIABLE
161
SET max_prepared_stmt_count = 6000;
162
SELECT @@max_prepared_stmt_count;
163
--Error ER_PARSE_ERROR
164
SET local.max_prepared_stmt_count = 7000;
165
--Error ER_UNKNOWN_TABLE
166
SELECT local.max_prepared_stmt_count;
167
--Error ER_PARSE_ERROR
168
SET global.max_prepared_stmt_count = 8000;
169
--Error ER_UNKNOWN_TABLE
170
SELECT global.max_prepared_stmt_count;
171
--Error ER_BAD_FIELD_ERROR
172
SELECT max_prepared_stmt_count = @@session.max_prepared_stmt_count;
175
##############################
176
# Restore initial value #
177
##############################
179
SET @@global.max_prepared_stmt_count = @start_value;
180
SELECT @@global.max_prepared_stmt_count;
183
########################################################################
184
# END OF max_prepared_stmt_count TESTS #
185
########################################################################