MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
max_connect_errors_basic.inc
1 ############## mysql-test\t\max_connect_errors_basic.test ###############
2 # #
3 # Variable Name: max_connect_errors #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value: 100 #
8 # Range: 1-4294967295 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable max_connect_errors #
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 --source include/load_sysvars.inc
27 
28 ##################################################################
29 # START OF max_connect_errors TESTS #
30 ##################################################################
31 
32 
33 ######################################################################
34 # Saving initial value of max_connect_errors in a temporary variable #
35 ######################################################################
36 
37 SET @start_value = @@global.max_connect_errors;
38 SELECT @start_value;
39 
40 
41 --echo '#--------------------FN_DYNVARS_073_01------------------------#'
42 ##################################################################
43 # Display the DEFAULT value of max_connect_errors #
44 ##################################################################
45 
46 SET @@global.max_connect_errors = 5000;
47 SET @@global.max_connect_errors = DEFAULT;
48 SELECT @@global.max_connect_errors;
49 
50 --echo '#---------------------FN_DYNVARS_073_02-------------------------#'
51 ###############################################
52 # Verify default value of variable #
53 ###############################################
54 
55 SET @@global.max_connect_errors = @start_value;
56 SELECT @@global.max_connect_errors = 100;
57 
58 --echo '#--------------------FN_DYNVARS_073_03------------------------#'
59 ##################################################################
60 # Change the value of max_connect_errors to a valid value #
61 ##################################################################
62 
63 SET @@global.max_connect_errors = 4096;
64 SELECT @@global.max_connect_errors;
65 SET @@global.max_connect_errors = 4294967294;
66 SELECT @@global.max_connect_errors;
67 SET @@global.max_connect_errors = 4294967295;
68 SELECT @@global.max_connect_errors;
69 SET @@global.max_connect_errors = 1;
70 SELECT @@global.max_connect_errors;
71 SET @@global.max_connect_errors = 2;
72 SELECT @@global.max_connect_errors;
73 
74 
75 --echo '#--------------------FN_DYNVARS_073_04-------------------------#'
76 #####################################################################
77 # Change the value of max_connect_errors to invalid value #
78 #####################################################################
79 
80 SET @@global.max_connect_errors = -1;
81 SELECT @@global.max_connect_errors;
82 SET @@global.max_connect_errors = 100000000000;
83 SELECT @@global.max_connect_errors;
84 --Error ER_WRONG_TYPE_FOR_VAR
85 SET @@global.max_connect_errors = 10000.01;
86 SELECT @@global.max_connect_errors;
87 SET @@global.max_connect_errors = -1024;
88 SELECT @@global.max_connect_errors;
89 SET @@global.max_connect_errors = 0;
90 SELECT @@global.max_connect_errors;
91 SET @@global.max_connect_errors = 4294967296;
92 SELECT @@global.max_connect_errors;
93 
94 --Error ER_WRONG_TYPE_FOR_VAR
95 SET @@global.max_connect_errors = ON;
96 SELECT @@global.max_connect_errors;
97 --Error ER_WRONG_TYPE_FOR_VAR
98 SET @@global.max_connect_errors = 'test';
99 SELECT @@global.max_connect_errors;
100 
101 
102 --echo '#-------------------FN_DYNVARS_073_05----------------------------#'
103 #####################################################################
104 # Test if accessing session max_connect_errors gives error #
105 #####################################################################
106 
107 --Error ER_GLOBAL_VARIABLE
108 SET @@session.max_connect_errors = 4096;
109 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
110 SELECT @@session.max_connect_errors;
111 
112 
113 --echo '#----------------------FN_DYNVARS_073_06------------------------#'
114 ##############################################################################
115 # Check if the value in GLOBAL & SESSION Tables matches values in variable #
116 ##############################################################################
117 
118 SELECT @@global.max_connect_errors = VARIABLE_VALUE
119 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
120 WHERE VARIABLE_NAME='max_connect_errors';
121 
122 SELECT @@max_connect_errors = VARIABLE_VALUE
123 FROM INFORMATION_SCHEMA.SESSION_VARIABLES
124 WHERE VARIABLE_NAME='max_connect_errors';
125 
126 
127 --echo '#---------------------FN_DYNVARS_073_07----------------------#'
128 ###################################################################
129 # Check if TRUE and FALSE values can be used on variable #
130 ###################################################################
131 
132 SET @@global.max_connect_errors = TRUE;
133 SELECT @@global.max_connect_errors;
134 SET @@global.max_connect_errors = FALSE;
135 SELECT @@global.max_connect_errors;
136 
137 
138 --echo '#---------------------FN_DYNVARS_073_08----------------------#'
139 ########################################################################################################
140 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
141 ########################################################################################################
142 
143 SET @@global.max_connect_errors = 5000;
144 SELECT @@max_connect_errors = @@global.max_connect_errors;
145 
146 
147 --echo '#---------------------FN_DYNVARS_073_09----------------------#'
148 ##########################################################################
149 # Check if max_connect_errors can be accessed with and without @@ sign #
150 ##########################################################################
151 
152 --Error ER_GLOBAL_VARIABLE
153 SET max_connect_errors = 6000;
154 SELECT @@max_connect_errors;
155 --Error ER_PARSE_ERROR
156 SET local.max_connect_errors = 7000;
157 --Error ER_UNKNOWN_TABLE
158 SELECT local.max_connect_errors;
159 --Error ER_PARSE_ERROR
160 SET global.max_connect_errors = 8000;
161 --Error ER_UNKNOWN_TABLE
162 SELECT global.max_connect_errors;
163 --Error ER_BAD_FIELD_ERROR
164 SELECT max_connect_errors = @@session.max_connect_errors;
165 
166 
167 ##############################
168 # Restore initial value #
169 ##############################
170 
171 SET @@global.max_connect_errors = @start_value;
172 SELECT @@global.max_connect_errors;
173 
174 
175 ##################################################################
176 # END OF max_connect_errors TESTS #
177 ##################################################################
178