~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/default_week_format_basic.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############## mysql-test\t\default_week_format_basic.test #####################
 
2
#                                                                              #
 
3
# Variable Name: default_week_format                                           #
 
4
# Scope: GLOBAL & SESSION                                                      #
 
5
# Access Type: Dynamic                                                         #
 
6
# Data Type: Numeric                                                           #
 
7
# Default Value: 0                                                             #
 
8
# Range: 0 - 7                                                                 #
 
9
#                                                                              #
 
10
#                                                                              #
 
11
# Creation Date: 2008-02-07                                                    #
 
12
# Author:  Salman Rawala                                                       #
 
13
#                                                                              #
 
14
# Description: Test Cases of Dynamic System Variable "default_week_format"     #
 
15
#              that checks 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#option_mysqld_auto-increment-increment         #
 
23
#                                                                              #
 
24
################################################################################
 
25
 
 
26
--source include/load_sysvars.inc
 
27
 
 
28
###################################################################
 
29
#           START OF default_week_format TESTS                    #
 
30
###################################################################
 
31
 
 
32
 
 
33
#############################################################
 
34
#                 Save initial value                        #
 
35
#############################################################
 
36
 
 
37
SET @start_global_value = @@global.default_week_format;
 
38
SELECT @start_global_value;
 
39
SET @start_session_value = @@session.default_week_format;
 
40
SELECT @start_session_value;
 
41
 
 
42
--echo '#--------------------FN_DYNVARS_022_01-------------------------#'
 
43
###################################################################
 
44
#     Display the DEFAULT value of default_week_format            #
 
45
###################################################################
 
46
 
 
47
SET @@global.default_week_format = 100;
 
48
SET @@global.default_week_format = DEFAULT;
 
49
SELECT @@global.default_week_format;
 
50
 
 
51
SET @@session.default_week_format = 200;
 
52
SET @@session.default_week_format = DEFAULT;
 
53
SELECT @@session.default_week_format;
 
54
 
 
55
--echo '#--------------------FN_DYNVARS_022_02-------------------------#'
 
56
###################################################################
 
57
#     Check the DEFAULT value of default_week_format              #
 
58
###################################################################
 
59
 
 
60
SET @@global.default_week_format = @start_global_value;
 
61
SELECT @@global.default_week_format = 0;
 
62
 
 
63
SET @@session.default_week_format = @start_global_value;
 
64
SELECT @@session.default_week_format = 0;
 
65
 
 
66
--echo '#--------------------FN_DYNVARS_022_03-------------------------#'
 
67
#############################################################################
 
68
# Change the value of default_week_format to a valid value for GLOBAL Scope #
 
69
#############################################################################
 
70
 
 
71
SET @@global.default_week_format = 1;
 
72
SELECT @@global.default_week_format;
 
73
SET @@global.default_week_format = 0;
 
74
SELECT @@global.default_week_format;
 
75
SET @@global.default_week_format = 7;
 
76
SELECT @@global.default_week_format;
 
77
 
 
78
 
 
79
--echo '#--------------------FN_DYNVARS_022_04-------------------------#'
 
80
##############################################################################
 
81
# Change the value of default_week_format to a valid value for SESSION Scope #
 
82
##############################################################################
 
83
 
 
84
SET @@session.default_week_format = 1;
 
85
SELECT @@session.default_week_format;
 
86
SET @@session.default_week_format = 0;
 
87
SELECT @@session.default_week_format;
 
88
SET @@session.default_week_format = 7;
 
89
SELECT @@session.default_week_format;
 
90
 
 
91
 
 
92
--echo '#------------------FN_DYNVARS_022_05-----------------------#'
 
93
###############################################################
 
94
# Change the value of default_week_format to an invalid value #
 
95
###############################################################
 
96
 
 
97
SET @@global.default_week_format = 8;
 
98
SELECT @@global.default_week_format;
 
99
SET @@global.default_week_format = -1024;
 
100
SELECT @@global.default_week_format;
 
101
SET @@global.default_week_format = 65536;
 
102
SELECT @@global.default_week_format;
 
103
--Error ER_WRONG_TYPE_FOR_VAR
 
104
SET @@global.default_week_format = 65530.30;
 
105
SELECT @@global.default_week_format;
 
106
--Error ER_WRONG_TYPE_FOR_VAR
 
107
SET @@global.default_week_format = OFF;
 
108
SELECT @@global.default_week_format;
 
109
--Error ER_WRONG_TYPE_FOR_VAR
 
110
SET @@session.default_week_format = ON;
 
111
SELECT @@session.default_week_format;
 
112
--Error ER_WRONG_TYPE_FOR_VAR
 
113
SET @@session.default_week_format = 65530.30;
 
114
SELECT @@session.default_week_format;
 
115
SET @@session.default_week_format = 10;
 
116
SELECT @@session.default_week_format;
 
117
SET @@session.default_week_format = -2;
 
118
SELECT @@session.default_week_format;
 
119
SET @@session.default_week_format = 65550;
 
120
SELECT @@session.default_week_format;
 
121
echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
 
122
 
 
123
--echo '#------------------FN_DYNVARS_022_06-----------------------#'
 
124
###############################################################################
 
125
#   Check if the value in GLOBAL & SESSION Tables matches value in variable   #
 
126
###############################################################################
 
127
 
 
128
SELECT @@global.default_week_format = VARIABLE_VALUE 
 
129
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 
130
WHERE VARIABLE_NAME='default_week_format';
 
131
 
 
132
SELECT @@session.default_week_format = VARIABLE_VALUE 
 
133
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
 
134
WHERE VARIABLE_NAME='default_week_format';
 
135
 
 
136
 
 
137
--echo '#------------------FN_DYNVARS_022_07-----------------------#'
 
138
####################################################################
 
139
#     Check if TRUE and FALSE values can be used on variable       #
 
140
####################################################################
 
141
 
 
142
SET @@global.default_week_format = TRUE;
 
143
SELECT @@global.default_week_format;
 
144
SET @@global.default_week_format = FALSE;
 
145
SELECT @@global.default_week_format;
 
146
 
 
147
 
 
148
--echo '#---------------------FN_DYNVARS_001_08----------------------#'
 
149
#################################################################################### 
 
150
#  Check if accessing variable with and without GLOBAL point to same variable      #
 
151
#################################################################################### 
 
152
 
 
153
SET @@global.default_week_format = 0;
 
154
SELECT @@default_week_format = @@global.default_week_format;
 
155
 
 
156
 
 
157
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
 
158
########################################################################################################
 
159
#    Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable  #
 
160
########################################################################################################
 
161
 
 
162
SET @@default_week_format = 1;
 
163
SELECT @@default_week_format = @@local.default_week_format;
 
164
SELECT @@local.default_week_format = @@session.default_week_format;
 
165
 
 
166
 
 
167
--echo '#---------------------FN_DYNVARS_001_10----------------------#'
 
168
###################################################################################  
 
169
#   Check if default_week_format can be accessed with and without @@ sign    #
 
170
###################################################################################
 
171
 
 
172
SET default_week_format = 1;
 
173
SELECT @@default_week_format;
 
174
--Error ER_PARSE_ERROR
 
175
SET local.default_week_format = 1;
 
176
--Error ER_UNKNOWN_TABLE
 
177
SELECT local.default_week_format;
 
178
--Error ER_PARSE_ERROR
 
179
SET session.default_week_format = 1;
 
180
--Error ER_UNKNOWN_TABLE
 
181
SELECT session.default_week_format;
 
182
--Error ER_BAD_FIELD_ERROR
 
183
SELECT default_week_format = @@session.default_week_format;
 
184
 
 
185
 
 
186
####################################
 
187
#     Restore initial value        #
 
188
####################################
 
189
 
 
190
SET @@global.default_week_format = @start_global_value;
 
191
SELECT @@global.default_week_format;
 
192
SET @@session.default_week_format = @start_session_value;
 
193
SELECT @@session.default_week_format;
 
194
 
 
195
 
 
196
#############################################################
 
197
#                 END OF default_week_format TESTS     #
 
198
#############################################################
 
199