| 1 |
--source include/load_sysvars.inc |
| 2 |
|
| 3 |
############################################################## |
| 4 |
# START OF histogram_size TESTS # |
| 5 |
############################################################## |
| 6 |
|
| 7 |
|
| 8 |
############################################################# |
| 9 |
# Save initial value # |
| 10 |
############################################################# |
| 11 |
|
| 12 |
SET @start_global_value = @@global.histogram_size; |
| 13 |
SET @start_session_value = @@session.histogram_size; |
| 14 |
SELECT @start_global_value = @start_session_value; |
| 15 |
|
| 16 |
--echo '#--------------------FN_DYNVARS_053_01-------------------------#' |
| 17 |
################################################################ |
| 18 |
# Display the DEFAULT value of histogram_size # |
| 19 |
################################################################ |
| 20 |
|
| 21 |
SET @@global.histogram_size = DEFAULT; |
| 22 |
SELECT @@global.histogram_size; |
| 23 |
|
| 24 |
SET @@session.histogram_size = DEFAULT; |
| 25 |
SELECT @@session.histogram_size; |
| 26 |
|
| 27 |
--echo '#--------------------FN_DYNVARS_053_03-------------------------#' |
| 28 |
######################################################################## |
| 29 |
# Change the value of histogram_size to a valid value for GLOBAL Scope # |
| 30 |
######################################################################## |
| 31 |
|
| 32 |
SET @@global.histogram_size = 1; |
| 33 |
SELECT @@global.histogram_size; |
| 34 |
SET @@global.histogram_size = 31; |
| 35 |
SELECT @@global.histogram_size; |
| 36 |
SET @@global.histogram_size = 255; |
| 37 |
SELECT @@global.histogram_size; |
| 38 |
|
| 39 |
--echo '#--------------------FN_DYNVARS_053_04-------------------------#' |
| 40 |
######################################################################### |
| 41 |
# Change the value of histogram_size to a valid value for SESSION Scope # |
| 42 |
######################################################################### |
| 43 |
|
| 44 |
SET @@session.histogram_size = 1; |
| 45 |
SELECT @@session.histogram_size; |
| 46 |
SET @@session.histogram_size = 31; |
| 47 |
SELECT @@session.histogram_size; |
| 48 |
SET @@session.histogram_size = 255; |
| 49 |
SELECT @@session.histogram_size; |
| 50 |
|
| 51 |
--echo '#------------------FN_DYNVARS_053_05-----------------------#' |
| 52 |
########################################################## |
| 53 |
# Change the value of histogram_size to an invalid value # |
| 54 |
########################################################### |
| 55 |
|
| 56 |
SET @@global.histogram_size = -1; |
| 57 |
SELECT @@global.histogram_size; |
| 58 |
SET @@global.histogram_size = 256; |
| 59 |
SELECT @@global.histogram_size; |
| 60 |
SET @@global.histogram_size = 1024; |
| 61 |
SELECT @@global.histogram_size; |
| 62 |
|
| 63 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 64 |
SET @@global.histogram_size = 4.5; |
| 65 |
SELECT @@global.histogram_size; |
| 66 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 67 |
SET @@global.histogram_size = test; |
| 68 |
SELECT @@global.histogram_size; |
| 69 |
|
| 70 |
SET @@session.histogram_size = -1; |
| 71 |
SELECT @@session.histogram_size; |
| 72 |
SET @@session.histogram_size = 256; |
| 73 |
SELECT @@session.histogram_size; |
| 74 |
SET @@session.histogram_size = 1024; |
| 75 |
SELECT @@session.histogram_size; |
| 76 |
|
| 77 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 78 |
SET @@session.histogram_size = 4.5; |
| 79 |
SELECT @@session.histogram_size; |
| 80 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 81 |
SET @@session.histogram_size = test; |
| 82 |
SELECT @@session.histogram_size; |
| 83 |
|
| 84 |
--echo '#------------------FN_DYNVARS_053_06-----------------------#' |
| 85 |
#################################################################### |
| 86 |
# Check if the value in GLOBAL Table matches value in variable # |
| 87 |
#################################################################### |
| 88 |
|
| 89 |
SELECT @@global.histogram_size = VARIABLE_VALUE |
| 90 |
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
| 91 |
WHERE VARIABLE_NAME='histogram_size'; |
| 92 |
|
| 93 |
--echo '#------------------FN_DYNVARS_053_07-----------------------#' |
| 94 |
#################################################################### |
| 95 |
# Check if the value in SESSION Table matches value in variable # |
| 96 |
#################################################################### |
| 97 |
|
| 98 |
SELECT @@session.histogram_size = VARIABLE_VALUE |
| 99 |
FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
| 100 |
WHERE VARIABLE_NAME='histogram_size'; |
| 101 |
|
| 102 |
|
| 103 |
--echo '#------------------FN_DYNVARS_053_08-----------------------#' |
| 104 |
#################################################################### |
| 105 |
# Check if TRUE and FALSE values can be used on variable # |
| 106 |
#################################################################### |
| 107 |
|
| 108 |
SET @@global.histogram_size = TRUE; |
| 109 |
SET @@global.histogram_size = FALSE; |
| 110 |
|
| 111 |
--echo '#---------------------FN_DYNVARS_001_09----------------------#' |
| 112 |
################################################################################# |
| 113 |
# Check if accessing variable with and without GLOBAL point to same variable # |
| 114 |
################################################################################# |
| 115 |
|
| 116 |
SET @@global.histogram_size = 10; |
| 117 |
SELECT @@histogram_size = @@global.histogram_size; |
| 118 |
|
| 119 |
--echo '#---------------------FN_DYNVARS_001_10----------------------#' |
| 120 |
######################################################################################################## |
| 121 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # |
| 122 |
######################################################################################################## |
| 123 |
|
| 124 |
SET @@histogram_size = 100; |
| 125 |
SELECT @@histogram_size = @@local.histogram_size; |
| 126 |
SELECT @@local.histogram_size = @@session.histogram_size; |
| 127 |
|
| 128 |
#################################### |
| 129 |
# Restore initial value # |
| 130 |
#################################### |
| 131 |
|
| 132 |
SET @@global.histogram_size = @start_global_value; |
| 133 |
SET @@session.histogram_size = @start_session_value; |
| 134 |
|
| 135 |
################################################### |
| 136 |
# END OF histogram_size TESTS # |
| 137 |
################################################### |
| 138 |
|