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;
94
echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
96
--Error ER_WRONG_TYPE_FOR_VAR
97
SET @@global.expire_logs_days = ON;
98
SELECT @@global.expire_logs_days;
99
--Error ER_WRONG_TYPE_FOR_VAR
100
SET @@global.expire_logs_days = 'test';
101
SELECT @@global.expire_logs_days;
104
--echo '#-------------------FN_DYNVARS_029_05----------------------------#'
105
###########################################################################
106
# Test if accessing session expire_logs_days gives error #
107
###########################################################################
109
--Error ER_GLOBAL_VARIABLE
110
SET @@session.expire_logs_days = 0;
111
SELECT @@expire_logs_days;
114
--echo '#----------------------FN_DYNVARS_029_06------------------------#'
115
##############################################################################
116
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
117
##############################################################################
119
SELECT @@global.expire_logs_days = VARIABLE_VALUE
120
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
121
WHERE VARIABLE_NAME='expire_logs_days';
123
SELECT @@expire_logs_days = VARIABLE_VALUE
124
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
125
WHERE VARIABLE_NAME='expire_logs_days';
129
--echo '#---------------------FN_DYNVARS_029_07----------------------#'
130
###################################################################
131
# Check if TRUE and FALSE values can be used on variable #
132
###################################################################
134
SET @@global.expire_logs_days = TRUE;
135
SELECT @@global.expire_logs_days;
136
SET @@global.expire_logs_days = FALSE;
137
SELECT @@global.expire_logs_days;
140
--echo '#---------------------FN_DYNVARS_029_08----------------------#'
141
########################################################################################################
142
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
143
########################################################################################################
145
SET @@global.expire_logs_days = 1;
146
SELECT @@expire_logs_days = @@global.expire_logs_days;
149
--echo '#---------------------FN_DYNVARS_029_09----------------------#'
150
##########################################################################
151
# Check if expire_logs_days can be accessed with and without @@ sign #
152
##########################################################################
154
--Error ER_GLOBAL_VARIABLE
155
SET expire_logs_days = 1;
156
SELECT @@expire_logs_days;
157
--Error ER_PARSE_ERROR
158
SET local.expire_logs_days = 1;
159
--Error ER_UNKNOWN_TABLE
160
SELECT local.expire_logs_days;
161
--Error ER_PARSE_ERROR
162
SET global.expire_logs_days = 1;
163
--Error ER_UNKNOWN_TABLE
164
SELECT global.expire_logs_days;
165
--Error ER_BAD_FIELD_ERROR
166
SELECT expire_logs_days = @@session.expire_logs_days;
169
##############################
170
# Restore initial value #
171
##############################
173
SET @@global.expire_logs_days = @start_value;
174
SELECT @@global.expire_logs_days;
177
########################################################################
178
# END OF expire_logs_days TESTS #
179
########################################################################