| 1 |
# |
| 2 |
# WL#9636: Rename tx_{isolation,isolation} variables to transaction_* |
| 3 |
# |
| 4 |
############################################################# |
| 5 |
# Save initial value # |
| 6 |
############################################################# |
| 7 |
SET @start_global_value = @@global.transaction_read_only; |
| 8 |
SELECT @start_global_value; |
| 9 |
@start_global_value |
| 10 |
0 |
| 11 |
SET @start_session_value = @@session.transaction_read_only; |
| 12 |
SELECT @start_session_value; |
| 13 |
@start_session_value |
| 14 |
0 |
| 15 |
######################################################################## |
| 16 |
# Display the DEFAULT value of transaction_read_only # |
| 17 |
######################################################################## |
| 18 |
SET @@global.transaction_read_only = ON; |
| 19 |
SET @@global.transaction_read_only = DEFAULT; |
| 20 |
SELECT @@global.transaction_read_only; |
| 21 |
@@global.transaction_read_only |
| 22 |
0 |
| 23 |
SET @@session.transaction_read_only = ON; |
| 24 |
SET @@session.transaction_read_only = DEFAULT; |
| 25 |
SELECT @@session.transaction_read_only; |
| 26 |
@@session.transaction_read_only |
| 27 |
0 |
| 28 |
############################################################################## |
| 29 |
# Change the value of transaction_read_only to a valid value for GLOBAL Scope# |
| 30 |
############################################################################## |
| 31 |
SET @@global.transaction_read_only = ON; |
| 32 |
SELECT @@global.transaction_read_only; |
| 33 |
@@global.transaction_read_only |
| 34 |
1 |
| 35 |
SET @@global.transaction_read_only = OFF; |
| 36 |
SELECT @@global.transaction_read_only; |
| 37 |
@@global.transaction_read_only |
| 38 |
0 |
| 39 |
SET @@global.transaction_read_only = 0; |
| 40 |
SELECT @@global.transaction_read_only; |
| 41 |
@@global.transaction_read_only |
| 42 |
0 |
| 43 |
SET @@global.transaction_read_only = 1; |
| 44 |
SELECT @@global.transaction_read_only; |
| 45 |
@@global.transaction_read_only |
| 46 |
1 |
| 47 |
SET @@global.transaction_read_only = TRUE; |
| 48 |
SELECT @@global.transaction_read_only; |
| 49 |
@@global.transaction_read_only |
| 50 |
1 |
| 51 |
SET @@global.transaction_read_only = FALSE; |
| 52 |
SELECT @@global.transaction_read_only; |
| 53 |
@@global.transaction_read_only |
| 54 |
0 |
| 55 |
############################################################################### |
| 56 |
# Change the value of transaction_read_only to a valid value for SESSION Scope# |
| 57 |
############################################################################### |
| 58 |
SET @@session.transaction_read_only = ON; |
| 59 |
SELECT @@session.transaction_read_only; |
| 60 |
@@session.transaction_read_only |
| 61 |
1 |
| 62 |
SET @@session.transaction_read_only = OFF; |
| 63 |
SELECT @@session.transaction_read_only; |
| 64 |
@@session.transaction_read_only |
| 65 |
0 |
| 66 |
SET @@session.transaction_read_only = 0; |
| 67 |
SELECT @@session.transaction_read_only; |
| 68 |
@@session.transaction_read_only |
| 69 |
0 |
| 70 |
SET @@session.transaction_read_only = 1; |
| 71 |
SELECT @@session.transaction_read_only; |
| 72 |
@@session.transaction_read_only |
| 73 |
1 |
| 74 |
SET @@session.transaction_read_only = TRUE; |
| 75 |
SELECT @@session.transaction_read_only; |
| 76 |
@@session.transaction_read_only |
| 77 |
1 |
| 78 |
SET @@session.transaction_read_only = FALSE; |
| 79 |
SELECT @@session.transaction_read_only; |
| 80 |
@@session.transaction_read_only |
| 81 |
0 |
| 82 |
################################################################ |
| 83 |
# Change the value of transaction_read_only to an invalid value# |
| 84 |
################################################################ |
| 85 |
SET @@global.transaction_read_only = 'ONN'; |
| 86 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'ONN' |
| 87 |
SET @@global.transaction_read_only = "OFFF"; |
| 88 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'OFFF' |
| 89 |
SET @@global.transaction_read_only = TTRUE; |
| 90 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'TTRUE' |
| 91 |
SET @@global.transaction_read_only = FELSE; |
| 92 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'FELSE' |
| 93 |
SET @@global.transaction_read_only = -1024; |
| 94 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of '-1024' |
| 95 |
SET @@global.transaction_read_only = 65536; |
| 96 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of '65536' |
| 97 |
SET @@global.transaction_read_only = 65530.34; |
| 98 |
ERROR 42000: Incorrect argument type to variable 'transaction_read_only' |
| 99 |
SET @@global.transaction_read_only = test; |
| 100 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'test' |
| 101 |
SET @@session.transaction_read_only = ONN; |
| 102 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'ONN' |
| 103 |
SET @@session.transaction_read_only = ONF; |
| 104 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'ONF' |
| 105 |
SET @@session.transaction_read_only = OF; |
| 106 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OF' at line 1 |
| 107 |
SET @@session.transaction_read_only = 'OFN'; |
| 108 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'OFN' |
| 109 |
SET @@session.transaction_read_only = -2; |
| 110 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of '-2' |
| 111 |
SET @@session.transaction_read_only = 65530.34; |
| 112 |
ERROR 42000: Incorrect argument type to variable 'transaction_read_only' |
| 113 |
SET @@session.transaction_read_only = 65550; |
| 114 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of '65550' |
| 115 |
SET @@session.transaction_read_only = test; |
| 116 |
ERROR 42000: Variable 'transaction_read_only' can't be set to the value of 'test' |
| 117 |
SELECT @@session.transaction_read_only; |
| 118 |
@@session.transaction_read_only |
| 119 |
0 |
| 120 |
#################################################################### |
| 121 |
# Check if the value in GLOBAL Table matches value in variable # |
| 122 |
#################################################################### |
| 123 |
SELECT IF(@@global.transaction_read_only, "ON", "OFF") = VARIABLE_VALUE |
| 124 |
FROM performance_schema.global_variables |
| 125 |
WHERE VARIABLE_NAME='transaction_read_only'; |
| 126 |
IF(@@global.transaction_read_only, "ON", "OFF") = VARIABLE_VALUE |
| 127 |
1 |
| 128 |
#################################################################### |
| 129 |
# Check if the value in SESSION Table matches value in variable # |
| 130 |
#################################################################### |
| 131 |
SELECT IF(@@session.transaction_read_only, "ON", "OFF") = VARIABLE_VALUE |
| 132 |
FROM performance_schema.session_variables |
| 133 |
WHERE VARIABLE_NAME='transaction_read_only'; |
| 134 |
IF(@@session.transaction_read_only, "ON", "OFF") = VARIABLE_VALUE |
| 135 |
1 |
| 136 |
############################################################################### |
| 137 |
# Check if accessing variable with and without GLOBAL point to same variable # |
| 138 |
############################################################################### |
| 139 |
SET @@transaction_read_only = OFF; |
| 140 |
SET @@global.transaction_read_only = ON; |
| 141 |
SELECT @@transaction_read_only = @@global.transaction_read_only; |
| 142 |
@@transaction_read_only = @@global.transaction_read_only |
| 143 |
0 |
| 144 |
############################################################################## |
| 145 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE points # |
| 146 |
# to same session variable # |
| 147 |
############################################################################## |
| 148 |
SET @@transaction_read_only = ON; |
| 149 |
SELECT @@transaction_read_only = @@local.transaction_read_only; |
| 150 |
@@transaction_read_only = @@local.transaction_read_only |
| 151 |
1 |
| 152 |
SELECT @@local.transaction_read_only = @@session.transaction_read_only; |
| 153 |
@@local.transaction_read_only = @@session.transaction_read_only |
| 154 |
1 |
| 155 |
############################################################################### |
| 156 |
# Check if transaction_read_only can be accessed with and without @@ sign # |
| 157 |
############################################################################### |
| 158 |
# @@session is synonym for SESSION |
| 159 |
SET @@session.transaction_read_only= 0; |
| 160 |
# Without modifier, SET changes session variable |
| 161 |
SET transaction_read_only = 1; |
| 162 |
SELECT @@transaction_read_only; |
| 163 |
@@transaction_read_only |
| 164 |
1 |
| 165 |
# name1.name2 refers to database_name.table_name |
| 166 |
SELECT session.transaction_read_only; |
| 167 |
ERROR 42S02: Unknown table 'session' in field list |
| 168 |
#################################### |
| 169 |
# Restore initial value # |
| 170 |
#################################### |
| 171 |
SET @@global.transaction_read_only = @start_global_value; |
| 172 |
SELECT @@global.transaction_read_only; |
| 173 |
@@global.transaction_read_only |
| 174 |
0 |
| 175 |
SET @@session.transaction_read_only = @start_session_value; |
| 176 |
SELECT @@session.transaction_read_only; |
| 177 |
@@session.transaction_read_only |
| 178 |
0 |
| 179 |
######################################################### |
| 180 |
# END OF transaction_read_only TESTS # |
| 181 |
######################################################### |