| 1 |
############## mysql-test\t\old_passwords_basic.test ########################## |
| 2 |
# # |
| 3 |
# Variable Name: old_passwords # |
| 4 |
# Scope: GLOBAL | SESSION # |
| 5 |
# Access Type: Dynamic # |
| 6 |
# Data Type: boolean # |
| 7 |
# Default Value: FALSE # |
| 8 |
# Range: # |
| 9 |
# # |
| 10 |
# # |
| 11 |
# Creation Date: 2008-02-14 # |
| 12 |
# Author: Salman # |
| 13 |
# # |
| 14 |
# Description: Test Cases of Dynamic System Variable old_passwords # |
| 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#option_mysqld_old-passwords # |
| 23 |
# # |
| 24 |
############################################################################### |
| 25 |
|
| 26 |
--source include/load_sysvars.inc |
| 27 |
################################################### |
| 28 |
# START OF old_passwords TESTS # |
| 29 |
################################################### |
| 30 |
|
| 31 |
|
| 32 |
############################################################# |
| 33 |
# Save initial value # |
| 34 |
############################################################# |
| 35 |
|
| 36 |
SET @start_global_value = @@global.old_passwords; |
| 37 |
SELECT @start_global_value; |
| 38 |
SET @start_session_value = @@session.old_passwords; |
| 39 |
SELECT @start_session_value; |
| 40 |
|
| 41 |
|
| 42 |
--echo '#--------------------FN_DYNVARS_114_01-------------------------#' |
| 43 |
################################################### |
| 44 |
# Display the DEFAULT value of old_passwords # |
| 45 |
################################################### |
| 46 |
|
| 47 |
SET @@global.old_passwords = ON; |
| 48 |
SET @@global.old_passwords = DEFAULT; |
| 49 |
SELECT @@global.old_passwords; |
| 50 |
|
| 51 |
SET @@session.old_passwords = ON; |
| 52 |
SET @@session.old_passwords = DEFAULT; |
| 53 |
SELECT @@session.old_passwords; |
| 54 |
|
| 55 |
|
| 56 |
--echo '#--------------------FN_DYNVARS_114_02-------------------------#' |
| 57 |
################################################### |
| 58 |
# Check the DEFAULT value of old_passwords # |
| 59 |
################################################### |
| 60 |
|
| 61 |
SET @@global.old_passwords = DEFAULT; |
| 62 |
SELECT @@global.old_passwords = FALSE; |
| 63 |
|
| 64 |
SET @@session.old_passwords = DEFAULT; |
| 65 |
SELECT @@session.old_passwords = FALSE; |
| 66 |
|
| 67 |
|
| 68 |
--echo '#--------------------FN_DYNVARS_114_03-------------------------#' |
| 69 |
####################################################################### |
| 70 |
# Change the value of old_passwords to a valid value for GLOBAL Scope # |
| 71 |
####################################################################### |
| 72 |
|
| 73 |
SET @@global.old_passwords = ON; |
| 74 |
SELECT @@global.old_passwords; |
| 75 |
SET @@global.old_passwords = OFF; |
| 76 |
SELECT @@global.old_passwords; |
| 77 |
SET @@global.old_passwords = 0; |
| 78 |
SELECT @@global.old_passwords; |
| 79 |
SET @@global.old_passwords = 1; |
| 80 |
SELECT @@global.old_passwords; |
| 81 |
SET @@global.old_passwords = TRUE; |
| 82 |
SELECT @@global.old_passwords; |
| 83 |
SET @@global.old_passwords = FALSE; |
| 84 |
SELECT @@global.old_passwords; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
--echo '#--------------------FN_DYNVARS_114_04-------------------------#' |
| 89 |
######################################################################## |
| 90 |
# Change the value of old_passwords to a valid value for SESSION Scope # |
| 91 |
######################################################################## |
| 92 |
|
| 93 |
SET @@session.old_passwords = ON; |
| 94 |
SELECT @@session.old_passwords; |
| 95 |
SET @@session.old_passwords = OFF; |
| 96 |
SELECT @@session.old_passwords; |
| 97 |
SET @@session.old_passwords = 0; |
| 98 |
SELECT @@session.old_passwords; |
| 99 |
SET @@session.old_passwords = 1; |
| 100 |
SELECT @@session.old_passwords; |
| 101 |
SET @@session.old_passwords = TRUE; |
| 102 |
SELECT @@session.old_passwords; |
| 103 |
SET @@session.old_passwords = FALSE; |
| 104 |
SELECT @@session.old_passwords; |
| 105 |
|
| 106 |
|
| 107 |
--echo '#------------------FN_DYNVARS_114_05-----------------------#' |
| 108 |
######################################################### |
| 109 |
# Change the value of old_passwords to an invalid value # |
| 110 |
######################################################### |
| 111 |
|
| 112 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 113 |
SET @@global.old_passwords = 'ONN'; |
| 114 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 115 |
SET @@global.old_passwords = "OFFF"; |
| 116 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 117 |
SET @@global.old_passwords = TTRUE; |
| 118 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 119 |
SET @@global.old_passwords = FELSE; |
| 120 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 121 |
SET @@global.old_passwords = -1024; |
| 122 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 123 |
SET @@global.old_passwords = 65536; |
| 124 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 125 |
SET @@global.old_passwords = 65530.34; |
| 126 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 127 |
SET @@global.old_passwords = test; |
| 128 |
|
| 129 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 130 |
SET @@session.old_passwords = ONN; |
| 131 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 132 |
SET @@session.old_passwords = ONF; |
| 133 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 134 |
SET @@session.old_passwords = OF; |
| 135 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 136 |
SET @@session.old_passwords = 'OFN'; |
| 137 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 138 |
SET @@session.old_passwords = -2; |
| 139 |
--Error ER_WRONG_TYPE_FOR_VAR |
| 140 |
SET @@session.old_passwords = 65530.34; |
| 141 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 142 |
SET @@session.old_passwords = 65550; |
| 143 |
|
| 144 |
--Error ER_WRONG_VALUE_FOR_VAR |
| 145 |
SET @@session.old_passwords = test; |
| 146 |
|
| 147 |
|
| 148 |
--echo '#------------------FN_DYNVARS_114_06-----------------------#' |
| 149 |
#################################################################### |
| 150 |
# Check if the value in GLOBAL Table matches value in variable # |
| 151 |
#################################################################### |
| 152 |
|
| 153 |
|
| 154 |
SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE |
| 155 |
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
| 156 |
WHERE VARIABLE_NAME='old_passwords'; |
| 157 |
|
| 158 |
--echo '#------------------FN_DYNVARS_114_07-----------------------#' |
| 159 |
#################################################################### |
| 160 |
# Check if the value in SESSION Table matches value in variable # |
| 161 |
#################################################################### |
| 162 |
|
| 163 |
SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE |
| 164 |
FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
| 165 |
WHERE VARIABLE_NAME='old_passwords'; |
| 166 |
|
| 167 |
|
| 168 |
--echo '#---------------------FN_DYNVARS_114_08----------------------#' |
| 169 |
############################################################################### |
| 170 |
# Check if global and session variable are independent of each other # |
| 171 |
############################################################################### |
| 172 |
|
| 173 |
SET @@old_passwords = OFF; |
| 174 |
SET @@global.old_passwords = ON; |
| 175 |
SELECT @@old_passwords = @@global.old_passwords; |
| 176 |
|
| 177 |
|
| 178 |
--echo '#---------------------FN_DYNVARS_114_09----------------------#' |
| 179 |
############################################################################### |
| 180 |
# Check if accessing variable with SESSION,LOCAL and without SCOPE points # |
| 181 |
# to same session variable # |
| 182 |
############################################################################### |
| 183 |
|
| 184 |
SET @@old_passwords = ON; |
| 185 |
SELECT @@old_passwords = @@local.old_passwords; |
| 186 |
SELECT @@local.old_passwords = @@session.old_passwords; |
| 187 |
|
| 188 |
|
| 189 |
--echo '#---------------------FN_DYNVARS_114_10----------------------#' |
| 190 |
######################################################################## |
| 191 |
# Check if old_passwords can be accessed with and without @@ sign # |
| 192 |
######################################################################## |
| 193 |
|
| 194 |
SET old_passwords = 1; |
| 195 |
SELECT @@old_passwords; |
| 196 |
--Error ER_UNKNOWN_TABLE |
| 197 |
SELECT local.old_passwords; |
| 198 |
--Error ER_UNKNOWN_TABLE |
| 199 |
SELECT session.old_passwords; |
| 200 |
--Error ER_BAD_FIELD_ERROR |
| 201 |
SELECT old_passwords = @@session.old_passwords; |
| 202 |
|
| 203 |
|
| 204 |
#################################### |
| 205 |
# Restore initial value # |
| 206 |
#################################### |
| 207 |
|
| 208 |
SET @@global.old_passwords = @start_global_value; |
| 209 |
SELECT @@global.old_passwords; |
| 210 |
SET @@session.old_passwords = @start_session_value; |
| 211 |
SELECT @@session.old_passwords; |
| 212 |
|
| 213 |
|
| 214 |
################################################## |
| 215 |
# END OF old_passwords TESTS # |
| 216 |
################################################## |
| 217 |
|