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