| 1 |
##################### mysql-test\t\delay_key_write_basic.test ################# |
| 2 |
# # |
| 3 |
# Variable Name: delay_key_write # |
| 4 |
# Scope: GLOBAL # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: enumeration # |
| 7 |
# Default Value: ON # |
| 8 |
# Valid Values: ON, OFF & ALL # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-07 # |
| 12 |
# Author: Rizwan # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable delay_key_write # |
| 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 delay_key_write TESTS # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
|
| 33 |
######################################################################## |
| 34 |
# Saving initial value of delay_key_write in a temporary variable # |
| 35 |
######################################################################## |
| 36 |
|
| 37 |
SET @start_value = @@global.delay_key_write; |
| 38 |
SELECT @start_value; |
| 39 |
|
| 40 |
|
| 41 |
--echo '#--------------------FN_DYNVARS_023_01------------------------#' |
| 42 |
######################################################################## |
| 43 |
# Display the DEFAULT value of delay_key_write # |
| 44 |
######################################################################## |
| 45 |
|
| 46 |
SET @@global.delay_key_write = OFF; |
| 47 |
SET @@global.delay_key_write = DEFAULT; |
| 48 |
SELECT @@global.delay_key_write; |
| 49 |
|
| 50 |
|
| 51 |
--echo '#---------------------FN_DYNVARS_023_02-------------------------#' |
| 52 |
############################################### |
| 53 |
# Check if NULL is accepeted # |
| 54 |
############################################### |
| 55 |
|
| 56 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 57 |
SET @@global.delay_key_write = NULL; |
| 58 |
|
| 59 |
|
| 60 |
--echo '#--------------------FN_DYNVARS_023_03------------------------#' |
| 61 |
######################################################################## |
| 62 |
# Change the value of delay_key_write to a valid value # |
| 63 |
######################################################################## |
| 64 |
|
| 65 |
SET @@global.delay_key_write = ON; |
| 66 |
SELECT @@global.delay_key_write; |
| 67 |
|
| 68 |
SET @@global.delay_key_write = OFF; |
| 69 |
SELECT @@global.delay_key_write; |
| 70 |
|
| 71 |
SET @@global.delay_key_write = ALL; |
| 72 |
SELECT @@global.delay_key_write; |
| 73 |
|
| 74 |
|
| 75 |
--echo '#--------------------FN_DYNVARS_023_04-------------------------#' |
| 76 |
########################################################################### |
| 77 |
# Change the value of delay_key_write to invalid value # |
| 78 |
########################################################################### |
| 79 |
|
| 80 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 81 |
SET @@global.delay_key_write = 3; |
| 82 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 83 |
SET @@global.delay_key_write = -1; |
| 84 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 85 |
SET @@global.delay_key_write = TRU; |
| 86 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 87 |
SET @@global.delay_key_write = ERROR; |
| 88 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 89 |
SET @@global.delay_key_write = FALSE0; |
| 90 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 91 |
SET @@global.delay_key_write = ONN; |
| 92 |
--error ER_PARSE_ERROR |
| 93 |
SET @@global.delay_key_write = OF; |
| 94 |
|
| 95 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 96 |
SET @@global.delay_key_write = ' '; |
| 97 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 98 |
SET @@global.delay_key_write = ""; |
| 99 |
|
| 100 |
|
| 101 |
--echo '#-------------------FN_DYNVARS_023_05----------------------------#' |
| 102 |
########################################################################### |
| 103 |
# Test if accessing session delay_key_write gives error # |
| 104 |
########################################################################### |
| 105 |
|
| 106 |
--Error ER_GLOBAL_VARIABLE |
| 107 |
SET @@delay_key_write = 0; |
| 108 |
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR |
| 109 |
SELECT @@session.delay_key_write; |
| 110 |
|
| 111 |
|
| 112 |
--echo '#----------------------FN_DYNVARS_023_06------------------------#' |
| 113 |
######################################################################## |
| 114 |
# Check if the value in GLOBAL Table matches value in variable # |
| 115 |
######################################################################## |
| 116 |
|
| 117 |
--disable_warnings |
| 118 |
SELECT @@delay_key_write = VARIABLE_VALUE |
| 119 |
FROM performance_schema.global_variables |
| 120 |
WHERE VARIABLE_NAME='delay_key_write'; |
| 121 |
--enable_warnings |
| 122 |
|
| 123 |
|
| 124 |
--echo '#---------------------FN_DYNVARS_023_07-------------------------#' |
| 125 |
################################################################### |
| 126 |
# Check if numbers can be used on variable # |
| 127 |
################################################################### |
| 128 |
|
| 129 |
SET @@global.delay_key_write = 0; |
| 130 |
SELECT @@global.delay_key_write; |
| 131 |
|
| 132 |
SET @@global.delay_key_write = 1; |
| 133 |
SELECT @@global.delay_key_write; |
| 134 |
|
| 135 |
SET @@global.delay_key_write = 2; |
| 136 |
SELECT @@global.delay_key_write; |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
--echo '#---------------------FN_DYNVARS_023_08----------------------#' |
| 141 |
################################################################### |
| 142 |
# Check if TRUE and FALSE values can be used on variable # |
| 143 |
################################################################### |
| 144 |
|
| 145 |
SET @@global.delay_key_write = TRUE; |
| 146 |
SELECT @@global.delay_key_write; |
| 147 |
SET @@global.delay_key_write = FALSE; |
| 148 |
SELECT @@global.delay_key_write; |
| 149 |
|
| 150 |
--echo '#---------------------FN_DYNVARS_023_09----------------------#' |
| 151 |
##################################################################### |
| 152 |
# Check if delay_key_write can be accessed with and without @@ sign # |
| 153 |
##################################################################### |
| 154 |
--Error ER_GLOBAL_VARIABLE |
| 155 |
SET delay_key_write = ON; |
| 156 |
SELECT @@delay_key_write; |
| 157 |
|
| 158 |
SET GLOBAL delay_key_write = OFF; |
| 159 |
SELECT @@global.delay_key_write; |
| 160 |
|
| 161 |
############################## |
| 162 |
# Restore initial value # |
| 163 |
############################## |
| 164 |
|
| 165 |
SET @@global.delay_key_write = @start_value; |
| 166 |
SELECT @@global.delay_key_write; |
| 167 |
|
| 168 |
######################################################################## |
| 169 |
# END OF delay_key_write TESTS # |
| 170 |
######################################################################## |