1
############## mysql-test\t\max_connections_basic.test ###############
3
# Variable Name: max_connections #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable max_connections #
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 max_connections TESTS #
30
###############################################################
33
###################################################################
34
# Saving initial value of max_connections in a temporary variable #
35
###################################################################
37
SET @start_value = @@global.max_connections;
41
--echo '#--------------------FN_DYNVARS_074_01------------------------#'
42
##################################################################
43
# Display the DEFAULT value of max_connections #
44
##################################################################
46
SET @@global.max_connections = 5000;
47
SET @@global.max_connections = DEFAULT;
48
SELECT @@global.max_connections;
50
--echo '#---------------------FN_DYNVARS_074_02-------------------------#'
51
###############################################
52
# Verify default value of variable #
53
###############################################
55
SET @@global.max_connections = @start_value;
56
SELECT @@global.max_connections = 151;
59
--echo '#--------------------FN_DYNVARS_074_03------------------------#'
60
##################################################################
61
# Change the value of max_connections to a valid value #
62
##################################################################
64
SET @@global.max_connections = 100000;
65
SELECT @@global.max_connections;
66
SET @@global.max_connections = 99999;
67
SELECT @@global.max_connections;
68
SET @@global.max_connections = 65536;
69
SELECT @@global.max_connections;
70
SET @@global.max_connections = 1;
71
SELECT @@global.max_connections;
72
SET @@global.max_connections = 2;
73
SELECT @@global.max_connections;
76
--echo '#--------------------FN_DYNVARS_074_04-------------------------#'
77
#####################################################################
78
# Change the value of max_connections to invalid value #
79
#####################################################################
81
SET @@global.max_connections = -1;
82
SELECT @@global.max_connections;
83
SET @@global.max_connections = 100000000000;
84
SELECT @@global.max_connections;
85
--Error ER_WRONG_TYPE_FOR_VAR
86
SET @@global.max_connections = 10000.01;
87
SELECT @@global.max_connections;
88
SET @@global.max_connections = -1024;
89
SELECT @@global.max_connections;
90
SET @@global.max_connections = 0;
91
SELECT @@global.max_connections;
92
SET @@global.max_connections = 100001;
93
SELECT @@global.max_connections;
95
--Error ER_WRONG_TYPE_FOR_VAR
96
SET @@global.max_connections = ON;
97
SELECT @@global.max_connections;
98
--Error ER_WRONG_TYPE_FOR_VAR
99
SET @@global.max_connections = 'test';
100
SELECT @@global.max_connections;
103
--echo '#-------------------FN_DYNVARS_074_05----------------------------#'
104
#####################################################################
105
# Test if accessing session max_connections gives error #
106
#####################################################################
108
--Error ER_GLOBAL_VARIABLE
109
SET @@session.max_connections = 4096;
110
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
111
SELECT @@session.max_connections;
114
--echo '#----------------------FN_DYNVARS_074_06------------------------#'
115
##############################################################################
116
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
117
##############################################################################
119
SELECT @@global.max_connections = VARIABLE_VALUE
120
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
121
WHERE VARIABLE_NAME='max_connections';
123
SELECT @@max_connections = VARIABLE_VALUE
124
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
125
WHERE VARIABLE_NAME='max_connections';
128
--echo '#---------------------FN_DYNVARS_074_07----------------------#'
129
###################################################################
130
# Check if TRUE and FALSE values can be used on variable #
131
###################################################################
133
SET @@global.max_connections = TRUE;
134
SELECT @@global.max_connections;
135
SET @@global.max_connections = FALSE;
136
SELECT @@global.max_connections;
139
--echo '#---------------------FN_DYNVARS_074_08----------------------#'
140
########################################################################################################
141
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
142
########################################################################################################
144
SET @@global.max_connections = 5000;
145
SELECT @@max_connections = @@global.max_connections;
148
--echo '#---------------------FN_DYNVARS_074_09----------------------#'
149
##########################################################################
150
# Check if max_connections can be accessed with and without @@ sign #
151
##########################################################################
153
--Error ER_GLOBAL_VARIABLE
154
SET max_connections = 6000;
155
SELECT @@max_connections;
156
--Error ER_PARSE_ERROR
157
SET local.max_connections = 7000;
158
--Error ER_UNKNOWN_TABLE
159
SELECT local.max_connections;
160
--Error ER_PARSE_ERROR
161
SET global.max_connections = 8000;
162
--Error ER_UNKNOWN_TABLE
163
SELECT global.max_connections;
164
--Error ER_BAD_FIELD_ERROR
165
SELECT max_connections = @@session.max_connections;
168
##############################
169
# Restore initial value #
170
##############################
172
SET @@global.max_connections = @start_value;
173
SELECT @@global.max_connections;
176
##################################################################
177
# END OF max_connections TESTS #
178
##################################################################