~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/max_prepared_stmt_count_basic.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############## mysql-test\t\max_prepared_stmt_count_basic.test ###############
 
2
#                                                                             #
 
3
# Variable Name: max_prepared_stmt_count                                      #
 
4
# Scope: GLOBAL                                                               #
 
5
# Access Type: Dynamic                                                        #
 
6
# Data Type: numeric                                                          #
 
7
# Default Value: 16382                                                        #
 
8
# Range: 0-1048576                                                            #
 
9
#                                                                             #
 
10
#                                                                             #
 
11
# Creation Date: 2008-02-07                                                   #
 
12
# Author:  Salman                                                             #
 
13
#                                                                             #
 
14
# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count  #
 
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
#Due to differences in the results, ps-protocol is switched off.
 
27
--disable_ps_protocol
 
28
 
 
29
--source include/load_sysvars.inc
 
30
 
 
31
 
 
32
######################################################################## 
 
33
#              START OF max_prepared_stmt_count TESTS                  #
 
34
######################################################################## 
 
35
 
 
36
 
 
37
########################################################################### 
 
38
# Saving initial value of max_prepared_stmt_count in a temporary variable #
 
39
########################################################################### 
 
40
 
 
41
SET @start_value = @@global.max_prepared_stmt_count;
 
42
SELECT @start_value;
 
43
 
 
44
 
 
45
--echo '#--------------------FN_DYNVARS_081_01------------------------#'
 
46
########################################################################## 
 
47
#           Display the DEFAULT value of max_prepared_stmt_count         #
 
48
########################################################################## 
 
49
 
 
50
SET @@global.max_prepared_stmt_count = 5000;
 
51
SET @@global.max_prepared_stmt_count = DEFAULT;
 
52
SELECT @@global.max_prepared_stmt_count;
 
53
 
 
54
 
 
55
--echo '#---------------------FN_DYNVARS_081_02-------------------------#'
 
56
############################################### 
 
57
#     Verify default value of variable        #
 
58
############################################### 
 
59
 
 
60
SET @@global.max_prepared_stmt_count = @start_value;
 
61
SELECT @@global.max_prepared_stmt_count = 16382;
 
62
 
 
63
 
 
64
--echo '#--------------------FN_DYNVARS_081_03------------------------#'
 
65
########################################################################## 
 
66
#    Change the value of max_prepared_stmt_count to a valid value        #
 
67
########################################################################## 
 
68
 
 
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;
 
79
 
 
80
 
 
81
--echo '#--------------------FN_DYNVARS_081_04-------------------------#'
 
82
############################################################################# 
 
83
#      Change the value of max_prepared_stmt_count to invalid value         #
 
84
############################################################################# 
 
85
 
 
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;
 
99
 
 
100
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
 
101
 
 
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;
 
108
 
 
109
 
 
110
--echo '#-------------------FN_DYNVARS_081_05----------------------------#'
 
111
############################################################################# 
 
112
#       Test if accessing session max_prepared_stmt_count gives error       #
 
113
############################################################################# 
 
114
 
 
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;
 
119
 
 
120
 
 
121
--echo '#----------------------FN_DYNVARS_081_06------------------------#'
 
122
############################################################################## 
 
123
# Check if the value in GLOBAL & SESSION Tables matches values in variable   #
 
124
##############################################################################
 
125
 
 
126
SELECT @@global.max_prepared_stmt_count = VARIABLE_VALUE 
 
127
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 
128
WHERE VARIABLE_NAME='max_prepared_stmt_count';
 
129
 
 
130
SELECT @@max_prepared_stmt_count = VARIABLE_VALUE 
 
131
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 
132
WHERE VARIABLE_NAME='max_prepared_stmt_count';
 
133
 
 
134
 
 
135
--echo '#---------------------FN_DYNVARS_081_07----------------------#'
 
136
################################################################### 
 
137
#      Check if TRUE and FALSE values can be used on variable     #
 
138
################################################################### 
 
139
 
 
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;
 
144
 
 
145
 
 
146
--echo '#---------------------FN_DYNVARS_081_08----------------------#'
 
147
########################################################################################################
 
148
#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
 
149
########################################################################################################
 
150
 
 
151
SET @@global.max_prepared_stmt_count = 5000;
 
152
SELECT @@max_prepared_stmt_count = @@global.max_prepared_stmt_count;
 
153
 
 
154
 
 
155
--echo '#---------------------FN_DYNVARS_081_09----------------------#'
 
156
################################################################################  
 
157
#   Check if max_prepared_stmt_count can be accessed with and without @@ sign    #
 
158
################################################################################
 
159
 
 
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;
 
173
 
 
174
 
 
175
##############################  
 
176
#   Restore initial value    #
 
177
##############################
 
178
 
 
179
SET @@global.max_prepared_stmt_count = @start_value;
 
180
SELECT @@global.max_prepared_stmt_count;
 
181
 
 
182
--enable_ps_protocol
 
183
######################################################################## 
 
184
#              END OF max_prepared_stmt_count TESTS                      #
 
185
########################################################################