1
################# mysql-test\t\query_prealloc_size_basic.test ##################
3
# Variable Name: query_prealloc_size #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
7
# Default Value: 8192 #
8
# Range: 8192-4294967295 #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable query_prealloc_size #
15
# that checks the behavior of this variable in the following ways #
17
# * Valid & Invalid values #
18
# * Scope & Access method #
22
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
24
################################################################################
26
--source include/load_sysvars.inc
28
########################################################################
29
# START OF query_prealloc_size TESTS #
30
########################################################################
33
#############################################################
34
# Save initial value #
35
#############################################################
37
SET @start_global_value = @@global.query_prealloc_size ;
38
SELECT @start_global_value;
39
SET @start_session_value = @@session.query_prealloc_size ;
40
SELECT @start_session_value;
43
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
44
########################################################################
45
# Display the DEFAULT value of myisam_block_size #
46
########################################################################
48
SET @@global.query_prealloc_size = 100;
49
SET @@global.query_prealloc_size = DEFAULT;
50
SELECT @@global.query_prealloc_size ;
52
SET @@session.query_prealloc_size = 200;
53
SET @@session.query_prealloc_size = DEFAULT;
54
SELECT @@session.query_prealloc_size ;
57
--echo '#--------------------FN_DYNVARS_005_02-------------------------#'
58
########################################################################
59
# Check the DEFAULT value of query_prealloc_size #
60
########################################################################
62
SET @@global.query_prealloc_size = DEFAULT;
63
SELECT @@global.query_prealloc_size = 8192;
65
SET @@session.query_prealloc_size = DEFAULT;
66
SELECT @@session.query_prealloc_size = 8192;
69
--echo '#--------------------FN_DYNVARS_005_03-------------------------#'
70
################################################################################
71
# Change the value of query_prealloc_size to a valid value for GLOBAL Scope #
72
################################################################################
74
SET @@global.query_prealloc_size = 8192;
75
SELECT @@global.query_prealloc_size ;
77
#SET @@global.query_prealloc_size = 4294967295;
78
#SELECT @@global.query_prealloc_size ;
80
SET @@global.query_prealloc_size = 655354;
81
SELECT @@global.query_prealloc_size ;
84
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
85
##################################################################################
86
# Change the value of query_prealloc_size to a valid value for SESSION Scope #
87
##################################################################################
89
SET @@session.query_prealloc_size = 8192;
90
SELECT @@session.query_prealloc_size ;
92
#SET @@session.query_prealloc_size = 4294967295;
93
#SELECT @@session.query_prealloc_size ;
95
SET @@session.query_prealloc_size = 655345;
96
SELECT @@session.query_prealloc_size ;
101
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
102
####################################################################
103
# Change the value of query_prealloc_size to an invalid value #
104
####################################################################
106
SET @@global.query_prealloc_size = 0;
107
SELECT @@global.query_prealloc_size ;
109
#SET @@global.query_prealloc_size = -1024;
110
#SELECT @@global.query_prealloc_size ;
112
#SET @@global.query_prealloc_size = 429496729533;
113
#SELECT @@global.query_prealloc_size ;
116
--Error ER_WRONG_TYPE_FOR_VAR
117
SET @@global.query_prealloc_size = 65530.34;
118
SELECT @@global.query_prealloc_size ;
120
--Error ER_WRONG_TYPE_FOR_VAR
121
SET @@global.query_prealloc_size = test;
122
SELECT @@global.query_prealloc_size ;
124
--Error ER_WRONG_TYPE_FOR_VAR
125
SET @@global.query_prealloc_size = "test";
126
SELECT @@global.query_prealloc_size ;
128
--Error ER_WRONG_TYPE_FOR_VAR
129
SET @@global.query_prealloc_size = 'test';
130
SELECT @@global.query_prealloc_size ;
132
--Error ER_WRONG_TYPE_FOR_VAR
133
SET @@global.query_prealloc_size = ON;
134
SELECT @@global.query_prealloc_size ;
137
SET @@session.query_prealloc_size = 0;
138
SELECT @@session.query_prealloc_size ;
140
#SET @@session.query_prealloc_size = -2;
141
#SELECT @@session.query_prealloc_size ;
143
--Error ER_WRONG_TYPE_FOR_VAR
144
SET @@session.query_prealloc_size = 65530.34;
145
SELECT @@session.query_prealloc_size ;
148
--Error ER_WRONG_TYPE_FOR_VAR
149
SET @@session.query_prealloc_size = test;
150
SELECT @@session.query_prealloc_size ;
152
--Error ER_WRONG_TYPE_FOR_VAR
153
SET @@session.query_prealloc_size = "test";
154
SELECT @@session.query_prealloc_size ;
157
--echo '#------------------FN_DYNVARS_005_06-----------------------#'
158
####################################################################
159
# Check if the value in GLOBAL Table matches value in variable #
160
####################################################################
163
SELECT @@global.query_prealloc_size = VARIABLE_VALUE
164
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
165
WHERE VARIABLE_NAME='query_prealloc_size ';
167
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
168
####################################################################
169
# Check if the value in SESSION Table matches value in variable #
170
####################################################################
172
SELECT @@session.query_prealloc_size = VARIABLE_VALUE
173
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
174
WHERE VARIABLE_NAME='query_prealloc_size ';
177
--echo '#------------------FN_DYNVARS_005_08-----------------------#'
178
####################################################################
179
# Check if TRUE and FALSE values can be used on variable #
180
####################################################################
182
SET @@global.query_prealloc_size = TRUE;
183
SELECT @@global.query_prealloc_size ;
184
SET @@global.query_prealloc_size = FALSE;
185
SELECT @@global.query_prealloc_size ;
189
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
190
################################################################################
191
# Check if accessing variable with and without GLOBAL point to same variable #
192
################################################################################
194
SET @@global.query_prealloc_size = 10;
195
SELECT @@query_prealloc_size = @@global.query_prealloc_size ;
198
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
199
##############################################################################
200
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to #
201
# to the same session variable #
202
##############################################################################
204
SET @@query_prealloc_size = 100;
205
SELECT @@query_prealloc_size = @@local.query_prealloc_size ;
206
SELECT @@local.query_prealloc_size = @@session.query_prealloc_size ;
209
--echo '#---------------------FN_DYNVARS_001_11----------------------#'
210
################################################################################
211
# Check if query_prealloc_size can be accessed with and without @@ sign #
212
################################################################################
214
SET query_prealloc_size = 1;
215
SELECT @@query_prealloc_size ;
216
--Error ER_UNKNOWN_TABLE
218
SELECT local.query_prealloc_size ;
220
--Error ER_UNKNOWN_TABLE
221
SELECT session.query_prealloc_size ;
223
--Error ER_BAD_FIELD_ERROR
224
SELECT query_prealloc_size = @@session.query_prealloc_size ;
227
####################################
228
# Restore initial value #
229
####################################
231
SET @@global.query_prealloc_size = @start_global_value;
232
SELECT @@global.query_prealloc_size ;
233
SET @@session.query_prealloc_size = @start_session_value;
234
SELECT @@session.query_prealloc_size ;
237
#############################################################
238
# END OF query_prealloc_size TESTS #
239
#############################################################