1################# mysql-test\t\connect_timeout_basic.test ######################
2#                                                                              #
3# Variable Name: connect_timeout                                               #
4# Scope: GLOBAL                                                                #
5# Access Type: Dynamic                                                         #
6# Data Type: Numeric                                                           #
7# Default Value: 5                                                             #
8# Range: 2 - 31536000                                                          #
9#                                                                              #
10#                                                                              #
11# Creation Date: 2008-02-07                                                    #
12# Author:  Salman Rawala                                                       #
13#                                                                              #
14# Description: Test Cases of Dynamic System Variable "connect_timeout"         #
15#              that checks 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#option_mysqld_connect_timeout           #
23#                                                                              #
24################################################################################
25
26--source include/load_sysvars.inc
27
28###############################################################
29#           START OF connect_timeout TESTS                    #
30###############################################################
31
32#######################################################################
33# Saving initial value of connect_timeout in a temporary variable     #
34#######################################################################
35
36SET @start_value = @@global.connect_timeout;
37SELECT @start_value;
38
39--echo '#--------------------FN_DYNVARS_019_01------------------------#'
40#######################################################################
41#              Display the DEFAULT value of connect_timeout           #
42#######################################################################
43
44SET @@global.connect_timeout = 100;
45SET @@global.connect_timeout = DEFAULT;
46SELECT @@global.connect_timeout;
47
48
49--echo '#---------------------FN_DYNVARS_019_02-------------------------#'
50###############################################
51#     Verify default value of variable        #
52###############################################
53
54SET @@global.connect_timeout = @start_value;
55SELECT @@global.connect_timeout = 5;
56
57
58--echo '#--------------------FN_DYNVARS_019_03------------------------#'
59#######################################################################
60#        Change the value of connect_timeout to a valid value         #
61#######################################################################
62
63SET @@global.connect_timeout = 2;
64SELECT @@global.connect_timeout;
65SET @@global.connect_timeout = 10000;
66SELECT @@global.connect_timeout;
67SET @@global.connect_timeout = 21221204;
68SELECT @@global.connect_timeout;
69
70
71--echo '#--------------------FN_DYNVARS_019_04-------------------------#'
72##########################################################################
73#         Change the value of connect_timeout to invalid value           #
74##########################################################################
75
76SET @@global.connect_timeout = 1;
77SELECT @@global.connect_timeout;
78SET @@global.connect_timeout = -1024;
79SELECT @@global.connect_timeout;
80SET @@global.connect_timeout = 42949672950;
81SELECT @@global.connect_timeout;
82--Error ER_WRONG_TYPE_FOR_VAR
83SET @@global.connect_timeout = 21221204.10;
84--Error ER_WRONG_TYPE_FOR_VAR
85SET @@global.connect_timeout = ON;
86
87
88--echo '#-------------------FN_DYNVARS_019_05----------------------------#'
89##########################################################################
90#       Test if accessing session connect_timeout gives error            #
91##########################################################################
92
93--Error ER_GLOBAL_VARIABLE
94SET @@session.connect_timeout = 0;
95--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
96SELECT @@session.connect_timeout;
97
98
99--echo '#----------------------FN_DYNVARS_019_06------------------------#'
100####################################################################
101# Check if the value in GLOBAL Tables matches values in variable   #
102####################################################################
103
104SELECT @@global.connect_timeout = VARIABLE_VALUE
105FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
106WHERE VARIABLE_NAME='connect_timeout';
107
108--echo '#---------------------FN_DYNVARS_019_07----------------------#'
109###################################################################
110#      Check if TRUE and FALSE values can be used on variable     #
111###################################################################
112
113SET @@global.connect_timeout = TRUE;
114SELECT @@global.connect_timeout;
115SET @@global.connect_timeout = FALSE;
116SELECT @@global.connect_timeout;
117
118
119--echo '#---------------------FN_DYNVARS_019_08----------------------#'
120###############################################################################
121#    Check if accessing variable without SCOPE points to same global variable #
122###############################################################################
123
124SET @@global.connect_timeout = 5;
125SELECT @@connect_timeout = @@global.connect_timeout;
126
127--echo '#---------------------FN_DYNVARS_019_09----------------------#'
128#########################################################################
129#   Check if connect_timeout can be accessed with and without @@ sign   #
130#########################################################################
131
132--Error ER_GLOBAL_VARIABLE
133SET connect_timeout = 1;
134--Error ER_PARSE_ERROR
135SET global.connect_timeout = 1;
136--Error ER_UNKNOWN_TABLE
137SELECT global.connect_timeout;
138--Error ER_BAD_FIELD_ERROR
139SELECT connect_timeout = @@session.connect_timeout;
140
141##############################
142#   Restore initial value    #
143##############################
144
145SET @@global.connect_timeout = @start_value;
146SELECT @@global.connect_timeout;
147
148
149#########################################################
150#              END OF connect_timeout TESTS             #
151#########################################################
152
153