| 1 |
################# mysql-test\t\sql_log_off_basic.test ######################### |
| 2 |
# # |
| 3 |
# Variable Name: sql_log_off # |
| 4 |
# Scope: SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: boolean # |
| 7 |
# Default Value: # |
| 8 |
# Range: 0,1 # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Rizwan # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable sql_log_off # |
| 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 |
# START OF sql_log_off TESTS # |
| 29 |
######################################################################## |
| 30 |
|
| 31 |
|
| 32 |
################################################################################ |
| 33 |
# Saving initial value of sql_log_off in a temporary variable # |
| 34 |
################################################################################ |
| 35 |
|
| 36 |
SET @session_start_value = @@session.sql_log_off; |
| 37 |
SELECT @session_start_value; |
| 38 |
|
| 39 |
--echo '#--------------------FN_DYNVARS_157_01------------------------#' |
| 40 |
######################################################################## |
| 41 |
# Display the DEFAULT value of sql_log_off # |
| 42 |
######################################################################## |
| 43 |
|
| 44 |
SET @@session.sql_log_off = 0; |
| 45 |
SET @@session.sql_log_off = DEFAULT; |
| 46 |
SELECT @@session.sql_log_off; |
| 47 |
|
| 48 |
SET @@session.sql_log_off = 1; |
| 49 |
SET @@session.sql_log_off = DEFAULT; |
| 50 |
SELECT @@session.sql_log_off; |
| 51 |
|
| 52 |
|
| 53 |
--echo '#---------------------FN_DYNVARS_157_02-------------------------#' |
| 54 |
############################################################################# |
| 55 |
# Check if sql_log_off can be accessed with and without @@ sign # |
| 56 |
############################################################################# |
| 57 |
|
| 58 |
SET sql_log_off = 1; |
| 59 |
SELECT @@sql_log_off; |
| 60 |
|
| 61 |
--Error ER_UNKNOWN_TABLE |
| 62 |
SELECT session.sql_log_off; |
| 63 |
|
| 64 |
--Error ER_UNKNOWN_TABLE |
| 65 |
SELECT local.sql_log_off; |
| 66 |
|
| 67 |
SET session sql_log_off = 0; |
| 68 |
SELECT @@session.sql_log_off; |
| 69 |
|
| 70 |
|
| 71 |
--echo '#--------------------FN_DYNVARS_157_03------------------------#' |
| 72 |
######################################################################## |
| 73 |
# change the value of sql_log_off to a valid value # |
| 74 |
######################################################################## |
| 75 |
|
| 76 |
SET @@session.sql_log_off = 0; |
| 77 |
SELECT @@session.sql_log_off; |
| 78 |
SET @@session.sql_log_off = 1; |
| 79 |
SELECT @@session.sql_log_off; |
| 80 |
|
| 81 |
|
| 82 |
--echo '#--------------------FN_DYNVARS_157_04-------------------------#' |
| 83 |
########################################################################### |
| 84 |
# Change the value of sql_log_off to invalid value # |
| 85 |
########################################################################### |
| 86 |
|
| 87 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 88 |
SET @@session.sql_log_off = -1; |
| 89 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 90 |
SET @@session.sql_log_off = 2; |
| 91 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 92 |
SET @@session.sql_log_off = "T"; |
| 93 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 94 |
SET @@session.sql_log_off = "Y"; |
| 95 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 96 |
SET @@session.sql_log_off = TRÜE; |
| 97 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 98 |
SET @@session.sql_log_off = ÕN; |
| 99 |
--error ER_PARSE_ERROR |
| 100 |
SET @@session.sql_log_off = OF; |
| 101 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 102 |
SET @@session.sql_log_off = ÓFF; |
| 103 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 104 |
SET @@session.sql_log_off = '¹'; |
| 105 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 106 |
SET @@session.sql_log_off = NO; |
| 107 |
|
| 108 |
|
| 109 |
--echo '#-------------------FN_DYNVARS_157_05----------------------------#' |
| 110 |
########################################################################### |
| 111 |
# Test if accessing global sql_log_off gives error # |
| 112 |
########################################################################### |
| 113 |
|
| 114 |
SET @@global.sql_log_off = 1-@@global.sql_log_off; |
| 115 |
SELECT @@global.sql_log_off; |
| 116 |
SET @@global.sql_log_off = 1-@@global.sql_log_off; |
| 117 |
SELECT @@global.sql_log_off; |
| 118 |
|
| 119 |
--echo '#----------------------FN_DYNVARS_157_06------------------------#' |
| 120 |
######################################################################### |
| 121 |
# Check if the value in GLOBAL Table contains variable value # |
| 122 |
######################################################################### |
| 123 |
|
| 124 |
--disable_warnings |
| 125 |
SELECT count(VARIABLE_VALUE) |
| 126 |
FROM performance_schema.global_variables |
| 127 |
WHERE VARIABLE_NAME='sql_log_off'; |
| 128 |
--enable_warnings |
| 129 |
|
| 130 |
--echo '#----------------------FN_DYNVARS_157_07------------------------#' |
| 131 |
######################################################################### |
| 132 |
# Check if the value in GLOBAL Table matches value in variable # |
| 133 |
######################################################################### |
| 134 |
|
| 135 |
--disable_warnings |
| 136 |
SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE |
| 137 |
FROM performance_schema.session_variables |
| 138 |
WHERE VARIABLE_NAME='sql_log_off'; |
| 139 |
--enable_warnings |
| 140 |
SELECT @@session.sql_log_off; |
| 141 |
--disable_warnings |
| 142 |
SELECT VARIABLE_VALUE |
| 143 |
FROM performance_schema.session_variables |
| 144 |
WHERE VARIABLE_NAME='sql_log_off'; |
| 145 |
--enable_warnings |
| 146 |
|
| 147 |
--echo '#---------------------FN_DYNVARS_157_08-------------------------#' |
| 148 |
################################################################### |
| 149 |
# Check if ON and OFF values can be used on variable # |
| 150 |
################################################################### |
| 151 |
|
| 152 |
SET @@session.sql_log_off = OFF; |
| 153 |
SELECT @@session.sql_log_off; |
| 154 |
SET @@session.sql_log_off = ON; |
| 155 |
SELECT @@session.sql_log_off; |
| 156 |
|
| 157 |
--echo '#---------------------FN_DYNVARS_157_09----------------------#' |
| 158 |
################################################################### |
| 159 |
# Check if TRUE and FALSE values can be used on variable # |
| 160 |
################################################################### |
| 161 |
|
| 162 |
SET @@session.sql_log_off = TRUE; |
| 163 |
SELECT @@session.sql_log_off; |
| 164 |
SET @@session.sql_log_off = FALSE; |
| 165 |
SELECT @@session.sql_log_off; |
| 166 |
|
| 167 |
############################## |
| 168 |
# Restore initial value # |
| 169 |
############################## |
| 170 |
|
| 171 |
SET @@session.sql_log_off = @session_start_value; |
| 172 |
SELECT @@session.sql_log_off; |
| 173 |
|
| 174 |
############################################################### |
| 175 |
# END OF sql_log_off TESTS # |
| 176 |
############################################################### |