1 ############## mysql-test\t\max_connect_errors_basic.test ############### 
    3 # Variable Name: max_connect_errors                                           # 
    5 # Access Type: Dynamic                                                        # 
    8 # Range:    1-4294967295                                                      # 
   11 # Creation Date: 2008-02-07                                                   # 
   14 # Description: Test Cases of Dynamic System Variable max_connect_errors       # 
   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_connect_errors TESTS                 # 
   30 ################################################################## 
   33 ###################################################################### 
   34 # Saving initial value of max_connect_errors in a temporary variable # 
   35 ###################################################################### 
   37 SET @start_value = @@global.max_connect_errors;
 
   41 --echo 
'#--------------------FN_DYNVARS_073_01------------------------#' 
   42 ################################################################## 
   43 #           Display the DEFAULT value of max_connect_errors         # 
   44 ################################################################## 
   46 SET @@global.max_connect_errors = 5000;
 
   47 SET @@global.max_connect_errors = DEFAULT;
 
   48 SELECT @@global.max_connect_errors;
 
   50 --echo 
'#---------------------FN_DYNVARS_073_02-------------------------#' 
   51 ###############################################  
   52 #     Verify default value of variable        # 
   53 ###############################################  
   55 SET @@global.max_connect_errors = @start_value;
 
   56 SELECT @@global.max_connect_errors = 100;
 
   58 --echo 
'#--------------------FN_DYNVARS_073_03------------------------#' 
   59 ################################################################## 
   60 #    Change the value of max_connect_errors to a valid value        # 
   61 ################################################################## 
   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;
 
   75 --echo 
'#--------------------FN_DYNVARS_073_04-------------------------#' 
   76 ##################################################################### 
   77 #      Change the value of max_connect_errors to invalid value         # 
   78 ##################################################################### 
   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;
 
   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;
 
  102 --echo 
'#-------------------FN_DYNVARS_073_05----------------------------#' 
  103 #####################################################################  
  104 #       Test if accessing session max_connect_errors gives error       # 
  105 ##################################################################### 
  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;
 
  113 --echo 
'#----------------------FN_DYNVARS_073_06------------------------#' 
  114 ##############################################################################  
  115 # Check if the value in GLOBAL & SESSION Tables matches values in variable   # 
  116 ############################################################################## 
  118 SELECT @@global.max_connect_errors = VARIABLE_VALUE 
 
  119 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 
  120 WHERE VARIABLE_NAME=
'max_connect_errors';
 
  122 SELECT @@max_connect_errors = VARIABLE_VALUE 
 
  123 FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 
  124 WHERE VARIABLE_NAME=
'max_connect_errors';
 
  127 --echo 
'#---------------------FN_DYNVARS_073_07----------------------#' 
  128 ###################################################################  
  129 #      Check if TRUE and FALSE values can be used on variable     # 
  130 ###################################################################  
  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;
 
  138 --echo 
'#---------------------FN_DYNVARS_073_08----------------------#' 
  139 ######################################################################################################## 
  140 #    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  # 
  141 ######################################################################################################## 
  143 SET @@global.max_connect_errors = 5000;
 
  144 SELECT @@max_connect_errors = @@global.max_connect_errors;
 
  147 --echo 
'#---------------------FN_DYNVARS_073_09----------------------#' 
  148 ########################################################################## 
  149 #   Check if max_connect_errors can be accessed with and without @@ sign    # 
  150 ########################################################################## 
  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;
 
  167 ##############################   
  168 #   Restore initial value    # 
  169 ############################## 
  171 SET @@global.max_connect_errors = @start_value;
 
  172 SELECT @@global.max_connect_errors;
 
  175 ################################################################## 
  176 #              END OF max_connect_errors TESTS                      # 
  177 ##################################################################