~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/suite/sys_vars/t/unique_checks_basic.test

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############## mysql-test\t\unique_checks_basic.test ##########################
 
2
#                                                                             #
 
3
# Variable Name: unique_checks                                                #
 
4
# Scope: SESSION                                                              #
 
5
# Access Type: Dynamic                                                        #
 
6
# Data Type: boolean                                                          #
 
7
# Default Value: 1                                                            #
 
8
# Range:                                                                      #
 
9
#                                                                             #
 
10
#                                                                             #
 
11
# Creation Date: 2008-02-14                                                   #
 
12
# Author:  Sharique Abdullah                                                      #
 
13
#                                                                             #
 
14
# Description: Test Cases of Dynamic System Variable unique_checks            #
 
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#option_mysqld_UNIQUE_CHECKS                   #
 
23
#                                                                             #
 
24
###############################################################################
 
25
 
 
26
--source include/load_sysvars.inc
 
27
########################################################################
 
28
#           START OF transaction_allow_batching TESTS                  #
 
29
########################################################################
 
30
 
 
31
 
 
32
#############################################################
 
33
#                 Save initial value                        #
 
34
#############################################################
 
35
 
 
36
SET @start_session_value = @@session.unique_checks;
 
37
SELECT @start_session_value;
 
38
 
 
39
--echo '#--------------------FN_DYNVARS_005_01-------------------------#'
 
40
############################################################
 
41
#     Display the DEFAULT value of unique_checks           #
 
42
############################################################
 
43
 
 
44
 
 
45
SET @@session.unique_checks= 1;
 
46
SET @@session.unique_checks= DEFAULT;
 
47
SELECT @@session.unique_checks;
 
48
 
 
49
--echo '#--------------------FN_DYNVARS_005_04-------------------------#'
 
50
########################################################################
 
51
# Change the value of unique_checks to a valid value for SESSION Scope #
 
52
########################################################################
 
53
 
 
54
SET @@session.unique_checks =1;
 
55
SELECT @@session.unique_checks;
 
56
 
 
57
SET @@session.unique_checks = 0;
 
58
SELECT @@session.unique_checks;
 
59
 
 
60
SET @@session.unique_checks = True;
 
61
SELECT @@session.unique_checks;
 
62
 
 
63
SET @@session.unique_checks = False;
 
64
SELECT @@session.unique_checks;
 
65
 
 
66
SET @@session.unique_checks = "ON";
 
67
SELECT @@session.unique_checks;
 
68
 
 
69
SET @@session.unique_checks = "OFF";
 
70
SELECT @@session.unique_checks;
 
71
 
 
72
 
 
73
 
 
74
--echo '#------------------FN_DYNVARS_005_05-----------------------#'
 
75
###########################################################
 
76
# Change the value of 'unique_checks' to an invalid value #
 
77
###########################################################
 
78
 
 
79
--Error ER_WRONG_VALUE_FOR_VAR
 
80
SET @@session.unique_checks = 'No';
 
81
 
 
82
--Error ER_WRONG_VALUE_FOR_VAR
 
83
SET @@session.unique_checks = "yes";
 
84
 
 
85
--Error ER_WRONG_VALUE_FOR_VAR
 
86
SET @@session.unique_checks = yes;
 
87
 
 
88
--Error ER_WRONG_VALUE_FOR_VAR
 
89
SET @@session.unique_checks = NO;
 
90
 
 
91
 
 
92
--Error ER_WRONG_VALUE_FOR_VAR
 
93
SET @@session.unique_checks = "True";
 
94
 
 
95
--Error ER_WRONG_VALUE_FOR_VAR
 
96
SET @@session.unique_checks = "False";
 
97
 
 
98
--Error ER_WRONG_VALUE_FOR_VAR
 
99
SET @@session.unique_checks = "Test";
 
100
 
 
101
 
 
102
--Error ER_WRONG_VALUE_FOR_VAR
 
103
SET @@session.unique_checks = 'test';
 
104
 
 
105
--Error ER_WRONG_VALUE_FOR_VAR
 
106
SET @@session.unique_checks = 123456789031;
 
107
 
 
108
 
 
109
--echo '#------------------FN_DYNVARS_005_07-----------------------#'
 
110
####################################################################
 
111
#  Check if the value in SESSION Table matches value in variable   #
 
112
####################################################################
 
113
 
 
114
SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE 
 
115
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 
116
WHERE VARIABLE_NAME='unique_checks';
 
117
 
 
118
 
 
119
--echo '#---------------------FN_DYNVARS_001_08----------------------#'
 
120
########################################################################
 
121
#    Check if accessing variable with SESSION,LOCAL and without SCOPE  #
 
122
#    points to same session variable                                   #
 
123
########################################################################
 
124
SET @@unique_checks = 1;
 
125
SELECT @@unique_checks = @@local.unique_checks;
 
126
SELECT @@local.unique_checks = @@session.unique_checks;
 
127
 
 
128
 
 
129
--echo '#---------------------FN_DYNVARS_001_09----------------------#'
 
130
########################################################################
 
131
#   Check if unique_checks can be accessed with and without @@ sign    #
 
132
########################################################################
 
133
 
 
134
--Error ER_WRONG_VALUE_FOR_VAR
 
135
SET unique_checks = 1027;
 
136
SELECT @@unique_checks;
 
137
 
 
138
--Error ER_UNKNOWN_TABLE
 
139
SELECT local.unique_checks;
 
140
 
 
141
--Error ER_UNKNOWN_TABLE
 
142
SELECT session.unique_checks;
 
143
 
 
144
--Error ER_BAD_FIELD_ERROR
 
145
SELECT unique_checks = @@session.unique_checks;
 
146
 
 
147
 
 
148
####################################
 
149
#     Restore initial value        #
 
150
####################################
 
151
 
 
152
 
 
153
SET @@session.unique_checks = @start_session_value;
 
154
SELECT @@session.unique_checks;
 
155
 
 
156
 
 
157
##################################################
 
158
#                 END OF unique_checks TESTS     #
 
159
##################################################
 
160