| 1 |
######## mysql-test\suite\sys_vars\t\transaction_isolation_basic.test ######### |
| 2 |
# # |
| 3 |
# Variable Name: transaction_isolation # |
| 4 |
# Scope: GLOBAL | SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: enumeration # |
| 7 |
# Default Value: REPEATABLE-READ # |
| 8 |
# Valid Values: READ-UNCOMMITTED, READCOMMITTED, REPEATABLE-READ,SERIALIZABLE # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Rizwan # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable transaction_isolation # |
| 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 |
# START OF transaction_isolation TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
######################################################################### |
| 34 |
# Saving initial value of transaction_isolation in a temporary variable # |
| 35 |
######################################################################### |
| 36 |
|
| 37 |
SET @global_start_value = @@global.transaction_isolation; |
| 38 |
SELECT @global_start_value; |
| 39 |
|
| 40 |
SET @session_start_value = @@session.transaction_isolation; |
| 41 |
SELECT @session_start_value; |
| 42 |
|
| 43 |
--echo '#--------------------FN_DYNVARS_183_01------------------------#' |
| 44 |
#################################################################### |
| 45 |
# Display the DEFAULT value of transaction_isolation # |
| 46 |
#################################################################### |
| 47 |
|
| 48 |
SET @@global.transaction_isolation = 'READ-UNCOMMITTED'; |
| 49 |
SET @@global.transaction_isolation = DEFAULT; |
| 50 |
SELECT @@global.transaction_isolation; |
| 51 |
|
| 52 |
SET @@session.transaction_isolation = DEFAULT; |
| 53 |
SELECT @@session.transaction_isolation; |
| 54 |
|
| 55 |
--echo '#---------------------FN_DYNVARS_183_02-------------------------#' |
| 56 |
######################################################### |
| 57 |
# Check if NULL or empty value is accepeted # |
| 58 |
######################################################### |
| 59 |
|
| 60 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 61 |
SET @@global.transaction_isolation = NULL; |
| 62 |
|
| 63 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 64 |
SET @@global.transaction_isolation = ''; |
| 65 |
|
| 66 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 67 |
SET @@session.transaction_isolation = NULL; |
| 68 |
|
| 69 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 70 |
SET @@session.transaction_isolation = ''; |
| 71 |
|
| 72 |
--echo '#--------------------FN_DYNVARS_183_03------------------------#' |
| 73 |
##################################################################### |
| 74 |
# Change the value of transaction_isolation to a valid value # |
| 75 |
##################################################################### |
| 76 |
|
| 77 |
SET @@global.transaction_isolation = 'READ-UNCOMMITTED'; |
| 78 |
SELECT @@global.transaction_isolation; |
| 79 |
|
| 80 |
SET @@global.transaction_isolation = 'read-COMMITTED'; |
| 81 |
SELECT @@global.transaction_isolation; |
| 82 |
|
| 83 |
SET @@global.transaction_isolation = 'REPEATABLE-READ'; |
| 84 |
SELECT @@global.transaction_isolation; |
| 85 |
|
| 86 |
SET @@global.transaction_isolation = 'SERIALIZable'; |
| 87 |
SELECT @@global.transaction_isolation; |
| 88 |
|
| 89 |
|
| 90 |
SET @@session.transaction_isolation = 'READ-UNCOMMITTED'; |
| 91 |
SELECT @@session.transaction_isolation; |
| 92 |
|
| 93 |
SET @@session.transaction_isolation = 'READ-COMMITTED'; |
| 94 |
SELECT @@session.transaction_isolation; |
| 95 |
|
| 96 |
SET @@session.transaction_isolation = 'REPEATABLE-READ'; |
| 97 |
SELECT @@session.transaction_isolation; |
| 98 |
|
| 99 |
SET @@session.transaction_isolation = 'serializable'; |
| 100 |
SELECT @@session.transaction_isolation; |
| 101 |
|
| 102 |
|
| 103 |
--echo '#--------------------FN_DYNVARS_183_04-------------------------#' |
| 104 |
####################################################################### |
| 105 |
# Change the value of transaction_isolation to invalid value # |
| 106 |
####################################################################### |
| 107 |
|
| 108 |
# for global scope |
| 109 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 110 |
SET @@global.transaction_isolation = -1; |
| 111 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 112 |
SET @@global.transaction_isolation = READUNCOMMITTED; |
| 113 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 114 |
SET @@global.transaction_isolation = 'REPEATABLE'; |
| 115 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 116 |
SET @@global.transaction_isolation = OFF; |
| 117 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 118 |
SET @@global.transaction_isolation = ON; |
| 119 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 120 |
SET @@global.transaction_isolation = 'NON-SERIALIZABLE'; |
| 121 |
|
| 122 |
# for session scope |
| 123 |
|
| 124 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 125 |
SET @@transaction_isolation = -1; |
| 126 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 127 |
SET @@transaction_isolation = READUNCOMMITTED; |
| 128 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 129 |
SET @@transaction_isolation = 'REPEATABLE'; |
| 130 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 131 |
SET @@transaction_isolation = 'NONE'; |
| 132 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 133 |
SET @@transaction_isolation = 'ALL'; |
| 134 |
|
| 135 |
--echo '#-------------------FN_DYNVARS_183_05----------------------------#' |
| 136 |
######################################################################### |
| 137 |
# Check if the value in session Table matches value in variable # |
| 138 |
######################################################################### |
| 139 |
|
| 140 |
SELECT @@session.transaction_isolation = VARIABLE_VALUE |
| 141 |
FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
| 142 |
WHERE VARIABLE_NAME='transaction_isolation'; |
| 143 |
|
| 144 |
--echo '#----------------------FN_DYNVARS_183_06------------------------#' |
| 145 |
######################################################################### |
| 146 |
# Check if the value in GLOBAL Table matches value in variable # |
| 147 |
######################################################################### |
| 148 |
|
| 149 |
SELECT @@global.transaction_isolation = VARIABLE_VALUE |
| 150 |
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
| 151 |
WHERE VARIABLE_NAME='transaction_isolation'; |
| 152 |
|
| 153 |
|
| 154 |
--echo '#---------------------FN_DYNVARS_183_07-------------------------#' |
| 155 |
################################################################### |
| 156 |
# Check if numbers can be used on variable # |
| 157 |
################################################################### |
| 158 |
|
| 159 |
# test if variable accepts 0,1,2 |
| 160 |
SET @@global.transaction_isolation = 0; |
| 161 |
SELECT @@global.transaction_isolation; |
| 162 |
|
| 163 |
SET @@global.transaction_isolation = 1; |
| 164 |
SELECT @@global.transaction_isolation; |
| 165 |
|
| 166 |
SET @@global.transaction_isolation = 2; |
| 167 |
SELECT @@global.transaction_isolation; |
| 168 |
|
| 169 |
SET @@global.transaction_isolation = 3; |
| 170 |
SELECT @@global.transaction_isolation; |
| 171 |
|
| 172 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 173 |
SET @@global.transaction_isolation = 0.4; |
| 174 |
|
| 175 |
--echo '#---------------------FN_DYNVARS_183_08----------------------#' |
| 176 |
################################################################### |
| 177 |
# Check if TRUE and FALSE values can be used on variable # |
| 178 |
################################################################### |
| 179 |
|
| 180 |
SET @@global.transaction_isolation = TRUE; |
| 181 |
SELECT @@global.transaction_isolation; |
| 182 |
SET @@global.transaction_isolation = FALSE; |
| 183 |
SELECT @@global.transaction_isolation; |
| 184 |
|
| 185 |
--echo '#---------------------FN_DYNVARS_183_09----------------------#' |
| 186 |
########################################################################### |
| 187 |
# Check if transaction_isolation can be accessed with and without @@ sign # |
| 188 |
########################################################################### |
| 189 |
|
| 190 |
SET transaction_isolation = 'REPEATABLE-READ'; |
| 191 |
|
| 192 |
#using SET SESSION|GLOBAL syntax |
| 193 |
SET session transaction_isolation = 'REPEATABLE-READ'; |
| 194 |
SELECT @@transaction_isolation; |
| 195 |
|
| 196 |
SET global transaction_isolation = 'REPEATABLE-READ'; |
| 197 |
SELECT @@global.transaction_isolation; |
| 198 |
|
| 199 |
############################## |
| 200 |
# Restore initial value # |
| 201 |
############################## |
| 202 |
|
| 203 |
SET @@global.transaction_isolation = @global_start_value; |
| 204 |
SELECT @@global.transaction_isolation; |
| 205 |
|
| 206 |
SET @@session.transaction_isolation = @session_start_value; |
| 207 |
SELECT @@session.transaction_isolation; |
| 208 |
|
| 209 |
#################################################################### |
| 210 |
# END OF transaction_isolation TESTS # |
| 211 |
#################################################################### |
| 212 |
|