1
############## mysql-test\t\expire_logs_days_basic.test ###############
3
# Variable Name: expire_logs_days #
5
# Access Type: Dynamic #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable expire_logs_days #
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
29
########################################################################
30
# START OF expire_logs_days TESTS #
31
########################################################################
34
########################################################################
35
# Saving initial value of expire_logs_days in a temporary variable #
36
########################################################################
38
SET @start_value = @@global.expire_logs_days;
42
--echo '#--------------------FN_DYNVARS_029_01------------------------#'
43
########################################################################
44
# Display the DEFAULT value of expire_logs_days #
45
########################################################################
47
SET @@global.expire_logs_days = 99;
48
SET @@global.expire_logs_days = DEFAULT;
49
SELECT @@global.expire_logs_days;
52
--echo '#---------------------FN_DYNVARS_029_02-------------------------#'
53
###############################################
54
# Verify default value of variable #
55
###############################################
57
SET @@global.expire_logs_days = @start_value;
58
SELECT @@global.expire_logs_days = 0;
61
--echo '#--------------------FN_DYNVARS_029_03------------------------#'
62
########################################################################
63
# Change the value of expire_logs_days to a valid value #
64
########################################################################
66
SET @@global.expire_logs_days = 0;
67
SELECT @@global.expire_logs_days;
68
SET @@global.expire_logs_days = 99;
69
SELECT @@global.expire_logs_days;
70
SET @@global.expire_logs_days = 10;
71
SELECT @@global.expire_logs_days;
72
SET @@global.expire_logs_days = 21;
73
SELECT @@global.expire_logs_days;
76
--echo '#--------------------FN_DYNVARS_029_04-------------------------#'
77
###########################################################################
78
# Change the value of expire_logs_days to invalid value #
79
###########################################################################
81
SET @@global.expire_logs_days = -1;
82
SELECT @@global.expire_logs_days;
83
SET @@global.expire_logs_days = 100;
84
SELECT @@global.expire_logs_days;
85
SET @@global.expire_logs_days = 1024;
86
SELECT @@global.expire_logs_days;
87
--Error ER_WRONG_TYPE_FOR_VAR
88
SET @@global.expire_logs_days = 10000.01;
89
SELECT @@global.expire_logs_days;
90
SET @@global.expire_logs_days = -1024;
91
SELECT @@global.expire_logs_days;
92
SET @@global.expire_logs_days = 42949672950;
93
SELECT @@global.expire_logs_days;
95
--Error ER_WRONG_TYPE_FOR_VAR
96
SET @@global.expire_logs_days = ON;
97
SELECT @@global.expire_logs_days;
98
--Error ER_WRONG_TYPE_FOR_VAR
99
SET @@global.expire_logs_days = 'test';
100
SELECT @@global.expire_logs_days;
103
--echo '#-------------------FN_DYNVARS_029_05----------------------------#'
104
###########################################################################
105
# Test if accessing session expire_logs_days gives error #
106
###########################################################################
108
--Error ER_GLOBAL_VARIABLE
109
SET @@session.expire_logs_days = 0;
110
SELECT @@expire_logs_days;
113
--echo '#----------------------FN_DYNVARS_029_06------------------------#'
114
##############################################################################
115
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
116
##############################################################################
118
SELECT @@global.expire_logs_days = VARIABLE_VALUE
119
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
120
WHERE VARIABLE_NAME='expire_logs_days';
122
SELECT @@expire_logs_days = VARIABLE_VALUE
123
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
124
WHERE VARIABLE_NAME='expire_logs_days';
128
--echo '#---------------------FN_DYNVARS_029_07----------------------#'
129
###################################################################
130
# Check if TRUE and FALSE values can be used on variable #
131
###################################################################
133
SET @@global.expire_logs_days = TRUE;
134
SELECT @@global.expire_logs_days;
135
SET @@global.expire_logs_days = FALSE;
136
SELECT @@global.expire_logs_days;
139
--echo '#---------------------FN_DYNVARS_029_08----------------------#'
140
########################################################################################################
141
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
142
########################################################################################################
144
SET @@global.expire_logs_days = 1;
145
SELECT @@expire_logs_days = @@global.expire_logs_days;
148
--echo '#---------------------FN_DYNVARS_029_09----------------------#'
149
##########################################################################
150
# Check if expire_logs_days can be accessed with and without @@ sign #
151
##########################################################################
153
--Error ER_GLOBAL_VARIABLE
154
SET expire_logs_days = 1;
155
SELECT @@expire_logs_days;
156
--Error ER_PARSE_ERROR
157
SET local.expire_logs_days = 1;
158
--Error ER_UNKNOWN_TABLE
159
SELECT local.expire_logs_days;
160
--Error ER_PARSE_ERROR
161
SET global.expire_logs_days = 1;
162
--Error ER_UNKNOWN_TABLE
163
SELECT global.expire_logs_days;
164
--Error ER_BAD_FIELD_ERROR
165
SELECT expire_logs_days = @@session.expire_logs_days;
168
##############################
169
# Restore initial value #
170
##############################
172
SET @@global.expire_logs_days = @start_value;
173
SELECT @@global.expire_logs_days;
176
########################################################################
177
# END OF expire_logs_days TESTS #
178
########################################################################