| 1 |
################# mysql-test\t\log_output_basic.test ########################## |
| 2 |
# # |
| 3 |
# Variable Name: log_output # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: enumeration # |
| 7 |
# Default Value: TABLE # |
| 8 |
# Range: TABLE, FILE, NONE # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Rizwan # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable log_output # |
| 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 log_output TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
######################################################################## |
| 34 |
# Saving initial value of log_output in a temporary variable # |
| 35 |
######################################################################## |
| 36 |
|
| 37 |
SET @start_value = @@global.log_output; |
| 38 |
SELECT @start_value; |
| 39 |
|
| 40 |
|
| 41 |
--echo '#--------------------FN_DYNVARS_065_01------------------------#' |
| 42 |
######################################################################## |
| 43 |
# Display the DEFAULT value of log_output # |
| 44 |
######################################################################## |
| 45 |
|
| 46 |
SET @@global.log_output = FILE; |
| 47 |
SET @@global.log_output = DEFAULT; |
| 48 |
SELECT @@global.log_output; |
| 49 |
|
| 50 |
--echo '#---------------------FN_DYNVARS_065_02-------------------------#' |
| 51 |
################################################## |
| 52 |
# Check if NULL or empty value is accepeted # |
| 53 |
################################################## |
| 54 |
|
| 55 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 56 |
SET @@global.log_output = NULL; |
| 57 |
|
| 58 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 59 |
SET @@global.log_output = ""; |
| 60 |
|
| 61 |
--echo '#--------------------FN_DYNVARS_065_03------------------------#' |
| 62 |
######################################################################## |
| 63 |
# Change the value of log_output to a valid value # |
| 64 |
######################################################################## |
| 65 |
|
| 66 |
SET @@global.log_output = 'TABLE'; |
| 67 |
SELECT @@global.log_output; |
| 68 |
|
| 69 |
SET @@global.log_output = 'FILE'; |
| 70 |
SELECT @@global.log_output; |
| 71 |
|
| 72 |
SET @@global.log_output = 'NONE'; |
| 73 |
SELECT @@global.log_output; |
| 74 |
|
| 75 |
SET @@global.log_output = 'FILE,TABLE'; |
| 76 |
SELECT @@global.log_output; |
| 77 |
|
| 78 |
SET @@global.log_output = 'TABLE,FILE'; |
| 79 |
SELECT @@global.log_output; |
| 80 |
|
| 81 |
SET @@global.log_output = 'NONE,TABLE'; |
| 82 |
SELECT @@global.log_output; |
| 83 |
|
| 84 |
SET @@global.log_output = 'NONE,FILE'; |
| 85 |
SELECT @@global.log_output; |
| 86 |
|
| 87 |
SET @@global.log_output = 'FILE,TABLE,NONE'; |
| 88 |
SELECT @@global.log_output; |
| 89 |
|
| 90 |
SET @@global.log_output = 'TABLE,NONE'; |
| 91 |
SELECT @@global.log_output; |
| 92 |
|
| 93 |
SET @@global.log_output = 'TABLE,TABLE'; |
| 94 |
SELECT @@global.log_output; |
| 95 |
|
| 96 |
SET @@global.log_output = ',TABLE'; |
| 97 |
SELECT @@global.log_output; |
| 98 |
|
| 99 |
SET @@global.log_output = 'TABLE,,FILE,,,'; |
| 100 |
SELECT @@global.log_output; |
| 101 |
|
| 102 |
|
| 103 |
--echo '#--------------------FN_DYNVARS_065_04-------------------------#' |
| 104 |
########################################################################### |
| 105 |
# Change the value of log_output to invalid value # |
| 106 |
########################################################################### |
| 107 |
|
| 108 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 109 |
SET @@global.log_output = -1; |
| 110 |
|
| 111 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 112 |
SET @@global.log_output = TAB; |
| 113 |
|
| 114 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 115 |
SET @@global.log_output = NIL; |
| 116 |
|
| 117 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 118 |
SET @@global.log_output = 'FIL'; |
| 119 |
|
| 120 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 121 |
SET @@global.log_output = 'T'; |
| 122 |
|
| 123 |
# use of space in value |
| 124 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 125 |
SET @@global.log_output = 'TABLE, FILE'; |
| 126 |
|
| 127 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 128 |
SET @@global.log_output = ' TABLE,FILE'; |
| 129 |
|
| 130 |
--echo '#-------------------FN_DYNVARS_065_05----------------------------#' |
| 131 |
###################################################################### |
| 132 |
# Test if accessing session log_output gives error # |
| 133 |
###################################################################### |
| 134 |
|
| 135 |
--Error ER_GLOBAL_VARIABLE |
| 136 |
SET @@log_output = 0; |
| 137 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 138 |
SELECT @@session.log_output; |
| 139 |
|
| 140 |
|
| 141 |
--echo '#----------------------FN_DYNVARS_065_06------------------------#' |
| 142 |
######################################################################## |
| 143 |
# Check if the value in GLOBAL Table matches value in variable # |
| 144 |
######################################################################## |
| 145 |
|
| 146 |
--disable_warnings |
| 147 |
SELECT @@log_output = VARIABLE_VALUE |
| 148 |
FROM performance_schema.global_variables |
| 149 |
WHERE VARIABLE_NAME='log_output'; |
| 150 |
--enable_warnings |
| 151 |
|
| 152 |
|
| 153 |
--echo '#---------------------FN_DYNVARS_065_07-------------------------#' |
| 154 |
################################################################### |
| 155 |
# Check if numbers can be used on variable # |
| 156 |
################################################################### |
| 157 |
|
| 158 |
# test if variable accepts 0,1,2 |
| 159 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 160 |
SET @@global.log_output = 0; |
| 161 |
SELECT @@global.log_output; |
| 162 |
|
| 163 |
SET @@global.log_output = 1; |
| 164 |
SELECT @@global.log_output; |
| 165 |
|
| 166 |
SET @@global.log_output = 2; |
| 167 |
SELECT @@global.log_output; |
| 168 |
|
| 169 |
SET @@global.log_output = 3; |
| 170 |
SELECT @@global.log_output; |
| 171 |
|
| 172 |
SET @@global.log_output = 4; |
| 173 |
SELECT @@global.log_output; |
| 174 |
|
| 175 |
SET @@global.log_output = 5; |
| 176 |
SELECT @@global.log_output; |
| 177 |
|
| 178 |
SET @@global.log_output = 6; |
| 179 |
SELECT @@global.log_output; |
| 180 |
|
| 181 |
SET @@global.log_output = 7; |
| 182 |
SELECT @@global.log_output; |
| 183 |
|
| 184 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 185 |
SET @@global.log_output = 8; |
| 186 |
|
| 187 |
|
| 188 |
--echo '#---------------------FN_DYNVARS_065_08----------------------#' |
| 189 |
################################################################### |
| 190 |
# Check if TRUE and FALSE values can be used on variable # |
| 191 |
################################################################### |
| 192 |
|
| 193 |
SET @@global.log_output = TRUE; |
| 194 |
SELECT @@global.log_output; |
| 195 |
|
| 196 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 197 |
SET @@global.log_output = FALSE; |
| 198 |
SELECT @@global.log_output; |
| 199 |
|
| 200 |
--echo '#---------------------FN_DYNVARS_065_09----------------------#' |
| 201 |
################################################################ |
| 202 |
# Check if log_output can be accessed with and without @@ sign # |
| 203 |
################################################################ |
| 204 |
--Error ER_GLOBAL_VARIABLE |
| 205 |
SET log_output = ON; |
| 206 |
|
| 207 |
SET global log_output = 'TABLE'; |
| 208 |
SELECT @@global.log_output; |
| 209 |
|
| 210 |
############################## |
| 211 |
# Restore initial value # |
| 212 |
############################## |
| 213 |
|
| 214 |
SET @@global.log_output = @start_value; |
| 215 |
SELECT @@global.log_output; |
| 216 |
|
| 217 |
TRUNCATE TABLE mysql.general_log; |
| 218 |
################################################################### |
| 219 |
# END OF log_output TESTS # |
| 220 |
################################################################### |