1
################# mysql-test\t\connect_timeout_basic.test ######################
3
# Variable Name: connect_timeout #
5
# Access Type: Dynamic #
8
# Range: 2 - 31536000 #
11
# Creation Date: 2008-02-07 #
12
# Author: Salman Rawala #
14
# Description: Test Cases of Dynamic System Variable "connect_timeout" #
15
# that checks behavior of this variable in the following ways #
17
# * Valid & Invalid values #
18
# * Scope & Access method #
19
# * Data Integrity . #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html#option_mysqld_connect_timeout #
24
################################################################################
26
--source include/load_sysvars.inc
28
###############################################################
29
# START OF connect_timeout TESTS #
30
###############################################################
32
#######################################################################
33
# Saving initial value of connect_timeout in a temporary variable #
34
#######################################################################
36
SET @start_value = @@global.connect_timeout;
39
--echo '#--------------------FN_DYNVARS_019_01------------------------#'
40
#######################################################################
41
# Display the DEFAULT value of connect_timeout #
42
#######################################################################
44
SET @@global.connect_timeout = 100;
45
SET @@global.connect_timeout = DEFAULT;
46
SELECT @@global.connect_timeout;
49
--echo '#---------------------FN_DYNVARS_019_02-------------------------#'
50
###############################################
51
# Verify default value of variable #
52
###############################################
54
SET @@global.connect_timeout = @start_value;
55
SELECT @@global.connect_timeout = 5;
58
--echo '#--------------------FN_DYNVARS_019_03------------------------#'
59
#######################################################################
60
# Change the value of connect_timeout to a valid value #
61
#######################################################################
63
SET @@global.connect_timeout = 2;
64
SELECT @@global.connect_timeout;
65
SET @@global.connect_timeout = 10000;
66
SELECT @@global.connect_timeout;
67
SET @@global.connect_timeout = 21221204;
68
SELECT @@global.connect_timeout;
71
--echo '#--------------------FN_DYNVARS_019_04-------------------------#'
72
##########################################################################
73
# Change the value of connect_timeout to invalid value #
74
##########################################################################
76
SET @@global.connect_timeout = 1;
77
SELECT @@global.connect_timeout;
78
SET @@global.connect_timeout = -1024;
79
SELECT @@global.connect_timeout;
80
SET @@global.connect_timeout = 42949672950;
81
SELECT @@global.connect_timeout;
82
echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
83
--Error ER_WRONG_TYPE_FOR_VAR
84
SET @@global.connect_timeout = 21221204.10;
85
--Error ER_WRONG_TYPE_FOR_VAR
86
SET @@global.connect_timeout = ON;
89
--echo '#-------------------FN_DYNVARS_019_05----------------------------#'
90
##########################################################################
91
# Test if accessing session connect_timeout gives error #
92
##########################################################################
94
--Error ER_GLOBAL_VARIABLE
95
SET @@session.connect_timeout = 0;
96
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
97
SELECT @@session.connect_timeout;
100
--echo '#----------------------FN_DYNVARS_019_06------------------------#'
101
####################################################################
102
# Check if the value in GLOBAL Tables matches values in variable #
103
####################################################################
105
SELECT @@global.connect_timeout = VARIABLE_VALUE
106
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
107
WHERE VARIABLE_NAME='connect_timeout';
109
--echo '#---------------------FN_DYNVARS_019_07----------------------#'
110
###################################################################
111
# Check if TRUE and FALSE values can be used on variable #
112
###################################################################
114
SET @@global.connect_timeout = TRUE;
115
SELECT @@global.connect_timeout;
116
SET @@global.connect_timeout = FALSE;
117
SELECT @@global.connect_timeout;
120
--echo '#---------------------FN_DYNVARS_019_08----------------------#'
121
###############################################################################
122
# Check if accessing variable without SCOPE points to same global variable #
123
###############################################################################
125
SET @@global.connect_timeout = 5;
126
SELECT @@connect_timeout = @@global.connect_timeout;
128
--echo '#---------------------FN_DYNVARS_019_09----------------------#'
129
#########################################################################
130
# Check if connect_timeout can be accessed with and without @@ sign #
131
#########################################################################
133
--Error ER_GLOBAL_VARIABLE
134
SET connect_timeout = 1;
135
--Error ER_PARSE_ERROR
136
SET global.connect_timeout = 1;
137
--Error ER_UNKNOWN_TABLE
138
SELECT global.connect_timeout;
139
--Error ER_BAD_FIELD_ERROR
140
SELECT connect_timeout = @@session.connect_timeout;
142
##############################
143
# Restore initial value #
144
##############################
146
SET @@global.connect_timeout = @start_value;
147
SELECT @@global.connect_timeout;
150
#########################################################
151
# END OF connect_timeout TESTS #
152
#########################################################