diff options
Diffstat (limited to 'mysql-test/suite/sys_vars/t')
262 files changed, 38549 insertions, 0 deletions
diff --git a/mysql-test/suite/sys_vars/t/auto_commit_basic.test b/mysql-test/suite/sys_vars/t/auto_commit_basic.test new file mode 100644 index 00000000000..0ea070ded59 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/auto_commit_basic.test @@ -0,0 +1,190 @@ +############## mysql-test\t\auto_commit_basic.test ############################# +# # +# Variable Name: autocommit # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: NA # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "autocommit" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: (Not Mentioned on website) # +# # +################################################################################ + +--source include/load_sysvars.inc + +######################################################################## +# START OF autocommit TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of autocommit in a temporary variable # +######################################################################## + +SET @start_value = @@autocommit; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_003_01------------------------#' +######################################################################## +# Display the DEFAULT value of autocommit # +######################################################################## + +SET @@autocommit = 0; +SET @@autocommit = DEFAULT; +SELECT @@autocommit; +echo 'Bug: variable DEFAULT value not working and is not throwing error'; + +--echo '#---------------------FN_DYNVARS_003_02-------------------------#' +############################################### +# Check default value of variable # +############################################### + +SET @@autocommit = @start_value; +SELECT @@autocommit = 1; + + +--echo '#--------------------FN_DYNVARS_003_03------------------------#' +######################################################################## +# Change the value of autocommit to a valid value # +######################################################################## +SET @@autocommit = 0; +SELECT @@autocommit; +SET @@autocommit = 1; +SELECT @@autocommit; + + +--echo '#--------------------FN_DYNVARS_003_04-------------------------#' +########################################################################### +# Change the value of autocommit to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@autocommit = ''; + + +--echo '#-------------------FN_DYNVARS_003_05----------------------------#' +########################################################################### +# Test if accessing global autocommit gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.autocommit = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.autocommit; + + +--echo '#----------------------FN_DYNVARS_003_06------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.autocommit = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='autocommit'; +--echo Bug # 34839: Values in variable and information_schema do not match for autocommit + +--echo '#----------------------FN_DYNVARS_003_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SET @@autocommit = 1; +SELECT @@autocommit = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='autocommit'; + +--echo '#---------------------FN_DYNVARS_003_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@autocommit = OFF; +SELECT @@autocommit; +SET @@autocommit = ON; +SELECT @@autocommit; + +--echo '#---------------------FN_DYNVARS_003_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@autocommit = TRUE; +SELECT @@autocommit; +SET @@autocommit = FALSE; +SELECT @@autocommit; + + +--echo '#---------------------FN_DYNVARS_003_10----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@autocommit = 0; +SELECT @@autocommit = @@local.autocommit; +SELECT @@local.autocommit = @@session.autocommit; +SET @@autocommit = 1; +SELECT @@autocommit = @@local.autocommit; +SELECT @@session.autocommit = @@autocommit; + + +--echo '#---------------------FN_DYNVARS_003_11----------------------#' +##################################################################### +# Check if autocommit can be accessed with and without @@ sign # +##################################################################### + +SET autocommit = 1; +SELECT @@autocommit; +--Error ER_UNKNOWN_TABLE +SELECT local.autocommit; +--Error ER_UNKNOWN_TABLE +SELECT session.autocommit; +--Error ER_BAD_FIELD_ERROR +SELECT autocommit = @@session.autocommit; + + +############################## +# Restore initial value # +############################## + +SET @@autocommit = @start_value; +SELECT @@autocommit; + +######################################################################## +# END OF autocommit TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test new file mode 100644 index 00000000000..4acfb8f503b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_basic.test @@ -0,0 +1,208 @@ +############## mysql-test\t\auto_increment_increment_basic.test ################ +# # +# Variable Name: auto_increment_increment # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "auto_increment_increment"# +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_auto-increment-increment # +# # +################################################################################ + +--source include/load_sysvars.inc + +######################################################################## +# START OF auto_increment_increment TESTS # +######################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.auto_increment_increment; +SELECT @start_global_value; +SET @start_session_value = @@session.auto_increment_increment; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_001_01-------------------------#' +######################################################################## +# Display the DEFAULT value of auto_increment_increment # +######################################################################## + +SET @@global.auto_increment_increment = 100; +SET @@global.auto_increment_increment = DEFAULT; +SELECT @@global.auto_increment_increment; + +SET @@session.auto_increment_increment = 200; +SET @@session.auto_increment_increment = DEFAULT; +SELECT @@session.auto_increment_increment; + + +--echo '#--------------------FN_DYNVARS_001_02-------------------------#' +######################################################################## +# Check the DEFAULT value of auto_increment_increment # +######################################################################## + +SET @@global.auto_increment_increment = DEFAULT; +SELECT @@global.auto_increment_increment = 1; + +SET @@session.auto_increment_increment = DEFAULT; +SELECT @@session.auto_increment_increment = 1; + + +--echo '#--------------------FN_DYNVARS_001_03-------------------------#' +################################################################## +# Change the value of variable to a valid value for GLOBAL Scope # +################################################################## + +SET @@global.auto_increment_increment = 1; +SELECT @@global.auto_increment_increment; +SET @@global.auto_increment_increment = 60020; +SELECT @@global.auto_increment_increment; +SET @@global.auto_increment_increment = 65535; +SELECT @@global.auto_increment_increment; + + +--echo '#--------------------FN_DYNVARS_001_04-------------------------#' +################################################################### +# Change the value of variable to a valid value for SESSION Scope # +################################################################### + +SET @@session.auto_increment_increment = 1; +SELECT @@session.auto_increment_increment; +SET @@session.auto_increment_increment = 50050; +SELECT @@session.auto_increment_increment; +SET @@session.auto_increment_increment = 65535; +SELECT @@session.auto_increment_increment; + + +--echo '#------------------FN_DYNVARS_001_05-----------------------#' +#################################################################### +# Change the value of auto_increment_increment to an invalid value # +#################################################################### + +SET @@global.auto_increment_increment = 0; +SELECT @@global.auto_increment_increment; +SET @@global.auto_increment_increment = -1024; +SELECT @@global.auto_increment_increment; +SET @@global.auto_increment_increment = 65536; +SELECT @@global.auto_increment_increment; +--Error ER_PARSE_ERROR +SET @@global.auto_increment_increment = 65530.34.; +SELECT @@global.auto_increment_increment; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.auto_increment_increment = test; +SELECT @@global.auto_increment_increment; + +SET @@session.auto_increment_increment = 0; +SELECT @@session.auto_increment_increment; +SET @@session.auto_increment_increment = -2; +SELECT @@session.auto_increment_increment; +--Error ER_PARSE_ERROR +SET @@session.auto_increment_increment = 65530.34.; +SET @@session.auto_increment_increment = 65550; +SELECT @@session.auto_increment_increment; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.auto_increment_increment = test; +SELECT @@session.auto_increment_increment; + + +--echo '#------------------FN_DYNVARS_001_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.auto_increment_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='auto_increment_increment'; + + +--echo '#------------------FN_DYNVARS_001_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.auto_increment_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='auto_increment_increment'; + + +--echo '#------------------FN_DYNVARS_001_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.auto_increment_increment = TRUE; +SELECT @@global.auto_increment_increment; +SET @@global.auto_increment_increment = FALSE; +SELECT @@global.auto_increment_increment; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +############################################################################### +# Check if global and session variables are independant of each other # +############################################################################### + +SET @@global.auto_increment_increment = 10; +SET @@session.auto_increment_increment = 11; +SELECT @@auto_increment_increment = @@global.auto_increment_increment; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@auto_increment_increment = 100; +SELECT @@auto_increment_increment = @@local.auto_increment_increment; +SELECT @@local.auto_increment_increment = @@session.auto_increment_increment; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +############################################################################### +# Check if auto_increment_increment can be accessed with and without @@ sign # +############################################################################### + +SET auto_increment_increment = 1; +SELECT @@auto_increment_increment; +--Error ER_UNKNOWN_TABLE +SELECT local.auto_increment_increment; +--Error ER_UNKNOWN_TABLE +SELECT session.auto_increment_increment; +--Error ER_BAD_FIELD_ERROR +SELECT auto_increment_increment = @@session.auto_increment_increment; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.auto_increment_increment = @start_global_value; +SELECT @@global.auto_increment_increment; +SET @@session.auto_increment_increment = @start_session_value; +SELECT @@session.auto_increment_increment; + + +############################################################# +# END OF auto_increment_increment TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test new file mode 100644 index 00000000000..7822775fb35 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/auto_increment_increment_func.test @@ -0,0 +1,202 @@ +############## mysql-test\t\auto_increment_increment_func.test ################ +# # +# Variable Name: auto_increment_increment # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "auto_increment_increment"# +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_auto-increment-increment # +# # +################################################################################ + +# save vars +SET @global_auto_increment_increment = @@global.auto_increment_increment; +SET @session_auto_increment_increment = @@session.auto_increment_increment; +SET @global_auto_increment_offset = @@global.auto_increment_offset; +SET @session_auto_increment_offset = @@session.auto_increment_offset; + + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_001_01-------------------------#' +########################################################## +# Setting initial value of auto_increment_increment # +########################################################## + +--echo ## Setting initial value of auto_increment_increment to 5 ## +SET @@auto_increment_increment = 5; + + +--echo '#--------------------FN_DYNVARS_001_02-------------------------#' +########################################################################### +# Inserting first value in table to check auto_increment_increment initial +# behavior +########################################################################### + +--echo ## Inserting first record in table to check behavior of the variable ## +INSERT into t1(name) values('Record_1'); +SELECT * from t1; + +--echo ## Changing value of variable to 10 ## +SET @@global.auto_increment_increment = 10; + +--echo ## Inserting record and verifying value of column id ## +INSERT into t1(name) values('Record_2'); +SELECT * from t1; + + +--echo ## Test behavior of variable after assigning some larger value to it ## +SELECT @@auto_increment_increment; +SET @@auto_increment_increment = 100; +INSERT into t1(name) values('Record_5'); +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_001_03-------------------------#' +########################################################## +# Test behavior of variable on new connection # 01 # +########################################################## + +--echo ## Creating new connection test_con1 ## +CONNECT (test_con1,localhost,root,,); +CONNECTION test_con1; + +--echo ## Value of session & global vairable here should be 10 ## +SELECT @@global.auto_increment_increment = 10; +SELECT @@session.auto_increment_increment = 10; + +--echo ## Setting global value of variable and inserting data in table ## +SET @@global.auto_increment_increment = 20; +SELECT @@global.auto_increment_increment; +INSERT into t1(name) values('Record_6'); +SELECT * from t1; + +--echo ## Setting session value of variable and inserting data in table ## +SET @@session.auto_increment_increment = 2; +SELECT @@session.auto_increment_increment; +INSERT into t1(name) values('Record_8'); +INSERT into t1(name) values('Record_9'); +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_001_04-------------------------#' +########################################################## +# Test behavior of variable on new connection # 02 # +########################################################## + +--echo ## Creating another new connection test_con2 ## +CONNECT (test_con2,localhost,root,,); +connection test_con2; + +--echo ## Verifying initial values of variable in global & session scope ## +--echo ## global & session initial value should be 20 ## +SELECT @@global.auto_increment_increment = 20; +SELECT @@session.auto_increment_increment = 20; + +--echo ## Setting value of session variable to 5 and verifying its behavior ## +SET @@session.auto_increment_increment = 5; +INSERT into t1(name) values('Record_10'); +SELECT * from t1; +--echo 'Bug#35362: Here Record_10 id should be 120 instead of 115 because we' +--echo 'have set the value of variable to 5' + +SET @@session.auto_increment_increment = 1; +SELECT @@auto_increment_increment; +SELECT @@global.auto_increment_increment; + + +--echo '#--------------------FN_DYNVARS_001_05-------------------------#' +##################################################################### +# Verify variable's value of connection # 01 after processing on +# connection # 02 +##################################################################### + +--echo ## Switching to test_con1 ## +connection test_con1; + +--echo ## Verifying values of global & session value of variable ## +--echo ## global value should be 20 ## +SELECT @@global.auto_increment_increment = 20; + +--echo ## session value should be 2 ## +SELECT @@session.auto_increment_increment = 2; + +INSERT into t1(name) values('Record_11'); +INSERT into t1(name) values('Record_12'); +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_001_06-------------------------#' +############################################################################### +# Altering table field to different datatypes and checking their behavior # +############################################################################### + +--echo ## Changing column's datatype to SmallInt and verifying variable's behavior ## +ALTER table t1 MODIFY id SMALLINT NOT NULL auto_increment; +INSERT into t1(name) values('Record_13'); +INSERT into t1(name) values('Record_14'); +SELECT * from t1; + +--echo ## Changing column's datatype to BigInt and verifying variable's behavior ## +ALTER table t1 MODIFY id BIGINT NOT NULL auto_increment; +INSERT into t1(name) values('Record_15'); +INSERT into t1(name) values('Record_16'); +SELECT * from t1; + +--echo '#--------------------FN_DYNVARS_001_07-------------------------#' +############################################################################### +# Check behavior of variable after assigning invalid value # +############################################################################### + +--echo ## Verifying behavior of variable with negative value ## +SET @@auto_increment_increment = -10; +INSERT into t1(name) values('Record_17'); +INSERT into t1(name) values('Record_18'); +SELECT * from t1; + +--echo 'Bug#35364: Variable is incrementing some random values on assigning -ve value' + + +############################################################ +# Disconnecting all connection & dropping table # +############################################################ + +--echo ## Disconnecting test_con2 ## +DISCONNECT test_con2; + +--echo ## Dropping table t1 ## +DROP table if exists t1; + +--echo ## Disconnecting test_con1 ## +DISCONNECT test_con1; + +--echo ## switching to default connection ## +connection default; + +# restore vars +SET @@global.auto_increment_increment = @global_auto_increment_increment; +SET @@session.auto_increment_increment = @session_auto_increment_increment; +SET @@global.auto_increment_offset = @global_auto_increment_offset; +SET @@session.auto_increment_offset = @session_auto_increment_offset; diff --git a/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test new file mode 100644 index 00000000000..a98fd6467ad --- /dev/null +++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_basic.test @@ -0,0 +1,214 @@ +############## mysql-test\t\auto_increment_offset_basic.test ################### +# # +# Variable Name: auto_increment_offset # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "auto_increment_offset" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_auto-increment-offset # +# # +################################################################################ + +--source include/load_sysvars.inc + +##################################################################### +# START OF auto_increment_offset TESTS # +##################################################################### + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.auto_increment_offset; +SELECT @start_global_value; +SET @start_session_value = @@session.auto_increment_offset; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_002_01-------------------------#' +##################################################################### +# Display the DEFAULT value of auto_increment_offset # +##################################################################### + +SET @@global.auto_increment_offset = 100; +SET @@global.auto_increment_offset = DEFAULT; +SELECT @@global.auto_increment_offset; + +SET @@session.auto_increment_offset = 200; +SET @@session.auto_increment_offset = DEFAULT; +SELECT @@session.auto_increment_offset; + + +--echo '#--------------------FN_DYNVARS_002_02-------------------------#' +##################################################################### +# Check the DEFAULT value of auto_increment_offset # +##################################################################### + +SET @@global.auto_increment_offset = @start_global_value; +SELECT @@global.auto_increment_offset = 1; +SET @@session.auto_increment_offset = @start_session_value; +SELECT @@session.auto_increment_offset = 1; + + +--echo '#--------------------FN_DYNVARS_002_03-------------------------#' +############################################################################### +# Change the value of auto_increment_offset to a valid value for GLOBAL Scope # +############################################################################### + +SET @@global.auto_increment_offset = 1; +SELECT @@global.auto_increment_offset; +SET @@global.auto_increment_offset = 60020; +SELECT @@global.auto_increment_offset; +SET @@global.auto_increment_offset = 65535; +SELECT @@global.auto_increment_offset; + + +--echo '#--------------------FN_DYNVARS_002_04-------------------------#' +############################################################################### +# Change the value of auto_increment_offset to a valid value for SESSION Scope# +############################################################################### + +SET @@session.auto_increment_offset = 1; +SELECT @@session.auto_increment_offset; +SET @@session.auto_increment_offset = 50050; +SELECT @@session.auto_increment_offset; +SET @@session.auto_increment_offset = 65535; +SELECT @@session.auto_increment_offset; + + +--echo '#------------------FN_DYNVARS_002_05-----------------------#' +################################################################# +# Change the value of auto_increment_offset to an invalid value # +################################################################# +# for global scope +SET @@global.auto_increment_offset = 0; +SELECT @@global.auto_increment_offset; +SET @@global.auto_increment_offset = -1024; +SELECT @@global.auto_increment_offset; +SET @@global.auto_increment_offset = 65536; +SELECT @@global.auto_increment_offset; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.auto_increment_offset = ON; +SELECT @@global.auto_increment_offset; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.auto_increment_offset = OFF; +SELECT @@global.auto_increment_offset; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.auto_increment_offset = test; +SELECT @@global.auto_increment_offset; +# for session scope +SET @@session.auto_increment_offset = 0; +SELECT @@session.auto_increment_offset; +SET @@session.auto_increment_offset = -2; +SELECT @@session.auto_increment_offset; +SET @@session.auto_increment_offset = 65550; +SELECT @@session.auto_increment_offset; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.auto_increment_offset = ON; +SELECT @@session.auto_increment_offset; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.auto_increment_offset = OFF; +SELECT @@session.auto_increment_offset; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.auto_increment_offset = test; +SELECT @@session.auto_increment_offset; + + + +--echo '#------------------FN_DYNVARS_002_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.auto_increment_offset = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='auto_increment_offset'; + + +--echo '#------------------FN_DYNVARS_002_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.auto_increment_offset = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='auto_increment_offset'; + + +--echo '#------------------FN_DYNVARS_002_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.auto_increment_offset = TRUE; +SELECT @@global.auto_increment_offset; +SET @@global.auto_increment_offset = FALSE; +SELECT @@global.auto_increment_offset; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +############################################################################### +# Check if global and session variables are independant of each other # +############################################################################### + +SET @@global.auto_increment_offset = 10; +SET @@session.auto_increment_offset = 11; +SELECT @@auto_increment_offset = @@global.auto_increment_offset; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@auto_increment_offset = 100; +SELECT @@auto_increment_offset = @@local.auto_increment_offset; +SELECT @@local.auto_increment_offset = @@session.auto_increment_offset; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +############################################################################### +# Check if auto_increment_offset can be accessed with and without @@ sign # +############################################################################### + +SET auto_increment_offset = 1; +SELECT @@auto_increment_offset; +--Error ER_UNKNOWN_TABLE +SELECT local.auto_increment_offset; +--Error ER_UNKNOWN_TABLE +SELECT session.auto_increment_offset; +--Error ER_BAD_FIELD_ERROR +SELECT auto_increment_offset = @@session.auto_increment_offset; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.auto_increment_offset = @start_global_value; +SELECT @@global.auto_increment_offset; +SET @@session.auto_increment_offset = @start_session_value; +SELECT @@session.auto_increment_offset; + + +################################################### +# END OF auto_increment_offset TESTS # +################################################### + diff --git a/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test new file mode 100644 index 00000000000..7e1668452cc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/auto_increment_offset_func.test @@ -0,0 +1,200 @@ +############## mysql-test\t\auto_increment_offset_func.test #################### +# # +# Variable Name: auto_increment_offset # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "auto_increment_offset" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_auto-increment-offset # +# # +################################################################################ + +# save vars +SET @global_auto_increment_increment = @@global.auto_increment_increment; +SET @session_auto_increment_increment = @@session.auto_increment_increment; +SET @global_auto_increment_offset = @@global.auto_increment_offset; +SET @session_auto_increment_offset = @@session.auto_increment_offset; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating New Table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_002_01-------------------------#' +####################################################### +# Setting initial value of auto_increment_offset # +####################################################### + +--echo ## Setting initial value of variable to 5 ## +SET @@auto_increment_increment = 10; +SET @@auto_increment_offset = 5; + + +--echo '#--------------------FN_DYNVARS_002_02-------------------------#' +########################################################################### +# Inserting first value in table to check auto_increment_offset initial +# behavior +########################################################################### + +--echo ## Inserting records in table and verifying variable's behavior ## +INSERT into t1(name) values('Record_1'); +SELECT * from t1; +INSERT into t1(name) values('Record_2'); +SELECT * from t1; + +--echo ## Test behavior of variable after updating value of variable ## +SET @@auto_increment_offset = 24; +SELECT @@auto_increment_offset; +INSERT into t1(name) values('Record_3'); +SELECT * from t1; +INSERT into t1(name) values('Record_4'); +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_002_03-------------------------#' +########################################################## +# Test behavior of variable on new connection # 01 # +########################################################## + +--echo ## Changing value of global scope before opening new connection ## + +SET @@global.auto_increment_increment = 15; +SET @@global.auto_increment_offset = 36; + +--echo ## New connection test_con1 ## +CONNECT (test_con1,localhost,root,,); +CONNECTION test_con1; + +--echo ## Value of session & global vairable here should be 10 ## +SELECT @@global.auto_increment_offset = 36; +SELECT @@session.auto_increment_offset = 36; + +--echo ## Verify global value effect of variable by inserting new rows in table ## +INSERT into t1(name) values('Record_5'); +INSERT into t1(name) values('Record_6'); +SELECT * from t1; + +--echo ## Setting session value of variable and inserting data in table ## +SET @@session.auto_increment_offset = 54; +INSERT into t1(name) values('Record_7'); +INSERT into t1(name) values('Record_8'); +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_002_04-------------------------#' +###################################################################### +# Test behavior of variable on assigning value to variable that is +# less than last index id +###################################################################### + +--echo ## Setting value of variable less than last insert id ## +SET @@session.auto_increment_offset = 5; +INSERT into t1(name) values('Record_9'); +--echo 'Bug#35367: Random value of id is increasing on assigning value to'; +--echo 'variable that is less than current offset'; +INSERT into t1(name) values('Record_10'); +INSERT into t1(name) values('Record_11'); +INSERT into t1(name) values('Record_12'); +SELECT * from t1; + + + +--echo '#--------------------FN_DYNVARS_002_05-------------------------#' +##################################################################### +# Verify variable's behavior on assigning value greater than +# auto_increment_increment value +##################################################################### + +--echo ## Assigning value to variable greater than auto_increment_incrent value ## +SET @@auto_increment_offset = 140; +SET @@auto_increment_increment = 10; + +INSERT into t1(name) values('Record_13'); +INSERT into t1(name) values('Record_14'); +SELECT * from t1; +--echo 'Bug#35369: Some invalid value of id is increasing on assigning value to'; +--echo 'variable that is greater than auto_increment_increment'; + + +--echo '#--------------------FN_DYNVARS_002_06-------------------------#' +############################################################################### +# Altering table field to different datatypes and checking their behavior # +############################################################################### + +--echo ## Changing datatype of column id with primary key to SmallInt ## +ALTER table t1 modify id SMALLINT NOT NULL auto_increment; +INSERT into t1(name) values('Record_15'); +INSERT into t1(name) values('Record_16'); +SELECT * from t1; + +--echo ## Changing datatype of column id with primary key to BigInt ## +ALTER table t1 modify id BIGINT NOT NULL auto_increment; +INSERT into t1(name) values('Record_17'); +INSERT into t1(name) values('Record_18'); +SELECT * from t1; + +--echo '#--------------------FN_DYNVARS_002_07-------------------------#' +############################################################################### +# Check behavior of variable after assigning invalid values to variable # +############################################################################### + +--echo ## Assigning -ve value to variable ## +SET @@auto_increment_offset = -10; +SELECT @@auto_increment_offset = -10; +INSERT into t1(name) values('Record_17'); +INSERT into t1(name) values('Record_18'); +SELECT * from t1; +--echo 'Bug#35370: Some invalid value of id is increasing on assigning negative'; +--echo ' value in variable'; + +--echo ## Assigning value that is out of range of variable ## +SET @@auto_increment_offset = 65536; +SELECT @@auto_increment_offset; +INSERT into t1(name) values('Record_17'); +INSERT into t1(name) values('Record_18'); +INSERT into t1(name) values('Record_19'); +INSERT into t1(name) values('Record_20'); +SELECT * from t1; + +--echo ## No effect of auto_increment_offset since value of this variable is greater ## +--echo ## than auto_increment_increment ## + +############################################################ +# Disconnecting all connection & dropping table # +############################################################ + +--echo ## Dropping table ## +DROP table if exists t1; + +--echo ## Disconnecting connection ## +DISCONNECT test_con1; + +--echo ## switching to default connection ## +connection default; + +# restore vars +SET @@global.auto_increment_increment = @global_auto_increment_increment; +SET @@session.auto_increment_increment = @session_auto_increment_increment; +SET @@global.auto_increment_offset = @global_auto_increment_offset; +SET @@session.auto_increment_offset = @session_auto_increment_offset; diff --git a/mysql-test/suite/sys_vars/t/autocommit_func-master.opt b/mysql-test/suite/sys_vars/t/autocommit_func-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/sys_vars/t/autocommit_func.test b/mysql-test/suite/sys_vars/t/autocommit_func.test new file mode 100644 index 00000000000..07e15ce40da --- /dev/null +++ b/mysql-test/suite/sys_vars/t/autocommit_func.test @@ -0,0 +1,164 @@ +############## mysql-test\t\auto_commit_func.test ############################# +# # +# Variable Name: autocommit # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: NA # +# Range: NA # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "autocommit" # +# that checks functionality of this variable # +# # +# Reference: (Not Mentioned on website) # +# # +################################################################################ + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name varchar(30) +) ENGINE = INNODB; + +--echo '#--------------------FN_DYNVARS_003_01-------------------------#' +##################################################### +# Setting initial value of auto_commit to zero # +##################################################### + +--echo ## Setting variable's value to 0 i.e false ## +SET @@autocommit = 0; + + +--echo '#--------------------FN_DYNVARS_003_02-------------------------#' +###################################################################### +# Creating 2 different connections & testing behavior of autocommit +# after updating record in 1st connection +###################################################################### + +--echo ## Creating new connection ## +CONNECT (test_con1,localhost,root,,); +CONNECTION test_con1; + +--echo ## Checking value of variable after opening new connection ## + +SELECT @@autocommit; + +--echo ## Setting value of variable to zero and inserting some rows ## +SET @@autocommit = 0; + +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; + +--echo ## Creating another connection and verifying records in table ## + +--echo ## New Connection test_con2 ## +CONNECT (test_con2,localhost,root,,); +CONNECTION test_con2; +SELECT * from t1; + + +--echo '#--------------------FN_DYNVARS_003_03-------------------------#' +###################################################################### +# Creating 2 different connections & testing behavior of autocommit +# after updating record in 1st connection and using COMMIT in first +# connection +###################################################################### + +--echo ## Verifying behavior of variable by commiting rows in test_con1 ## +--echo ## Connecting with connection # 01 ## +CONNECTION test_con1; +SELECT * from t1; +COMMIT; + + +--echo ## New Connection test_con2 ## +--echo ## Now verifying records in table from connection # 02 ## +CONNECTION test_con2; +SELECT * from t1; + +--echo '#--------------------FN_DYNVARS_003_04-------------------------#' +###################################################################### +# Creating 2 different connections & testing behavior of autocommit +# after updating record in 1st connection and using ROLLBACK in +# first connection +###################################################################### + +--echo ## Connecting to connection # 01 ## +CONNECTION test_con1; +SELECT * from t1; + +--echo ## Updating value of first row ## +UPDATE t1 set name = 'Record_12' where name = 'Record_1'; +SELECT * from t1; + +--echo ## Connecting to connecting # 02 and verifying effect of update query ## +CONNECTION test_con2; +SELECT * from t1; + +--echo ## Now connecting with connection # 01 and using ROLLBACK after it ## +CONNECTION test_con1; +ROLLBACK; +SELECT * from t1; + + + +--echo '#--------------------FN_DYNVARS_003_05-------------------------#' +###################################################################### +# Creating 2 different connections & testing behavior of autocommit +# after updating records in 1st connection and setting AUTOCOMMIT +# to 1 in second connection +###################################################################### + + +--echo ## Connecting with connection # 01 ## +CONNECTION test_con1; +INSERT into t1(name) values('Record_3'); + + +--echo ## Connection test_con2 ## +--echo ## Now verifying records in table from connection # 02 and changing value ## +--echo ## of autocommit to true ## +CONNECTION test_con2; +SELECT * from t1; +SET @@autocommit = 1; +INSERT into t1(name) values('Record_4'); +INSERT into t1(name) values('Record_5'); +SELECT * from t1; + +--echo ## Connecting with connection # 01 and inserting few records ## +CONNECTION test_con1; +SELECT * from t1; +--echo 'Bug#35373: Records donot get committed in transaction on switching connections' +INSERT into t1(name) values('Record_6'); +SELECT * from t1; + +--echo ## Now verifying the effect of these new records in second connection ## +CONNECTION test_con2; +SELECT * from t1; + +--echo ## Dropping table t1 ## +DROP table t1; + +--echo ## Disconnecting both connections ## +DISCONNECT test_con1; +DISCONNECT test_con2; + + + diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test new file mode 100644 index 00000000000..74da0904454 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test @@ -0,0 +1,179 @@ +############## mysql-test\t\automatic_sp_privileges_basic.test ################# +# # +# Variable Name: automatic_sp_privileges # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: TRUE # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "automatic_sp_privileges" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_automatic_sp_privileges # +# # +################################################################################ + +--source include/load_sysvars.inc + +####################################################################### +# START OF automatic_sp_privileges TESTS # +####################################################################### + + +############################################################################### +# Saving initial value of automatic_sp_privileges in a temporary variable # +############################################################################### + +SET @start_value = @@global.automatic_sp_privileges; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_004_01------------------------#' +############################################################################### +# Display the DEFAULT value of automatic_sp_privileges # +############################################################################### + +SET @@global.automatic_sp_privileges = 0; +SET @@global.automatic_sp_privileges = DEFAULT; +SELECT @@global.automatic_sp_privileges; + + +--echo '#---------------------FN_DYNVARS_004_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.automatic_sp_privileges = @start_value; +SELECT @@global.automatic_sp_privileges = TRUE; + + +--echo '#--------------------FN_DYNVARS_004_03------------------------#' +############################################################################### +# Change the value of automatic_sp_privileges to a valid value # +############################################################################### + +SET @@global.automatic_sp_privileges = 0; +SELECT @@global.automatic_sp_privileges; +SET @@global.automatic_sp_privileges = 1; +SELECT @@global.automatic_sp_privileges; + +--echo '#--------------------FN_DYNVARS_004_04-------------------------#' +############################################################################### +# Change the value of automatic_sp_privileges to invalid value # +############################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.automatic_sp_privileges = ''; + + +--echo '#-------------------FN_DYNVARS_004_05----------------------------#' +########################################################################### +# Test if accessing session automatic_sp_privileges gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.automatic_sp_privileges = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.automatic_sp_privileges; + + +--echo '#----------------------FN_DYNVARS_004_06------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.automatic_sp_privileges = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='automatic_sp_privileges'; +echo 'Bug# 34839: Values in variable and information_schema donot match'; + +--echo '#---------------------FN_DYNVARS_004_07----------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@global.automatic_sp_privileges = OFF; +SELECT @@global.automatic_sp_privileges; +SET @@global.automatic_sp_privileges = ON; +SELECT @@global.automatic_sp_privileges; + +--echo '#---------------------FN_DYNVARS_004_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.automatic_sp_privileges = TRUE; +SELECT @@global.automatic_sp_privileges; +SET @@global.automatic_sp_privileges = FALSE; +SELECT @@global.automatic_sp_privileges; + +--echo '#---------------------FN_DYNVARS_004_09----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@global.automatic_sp_privileges = 1; +SELECT @@automatic_sp_privileges = @@global.automatic_sp_privileges; + +--echo '#---------------------FN_DYNVARS_004_10----------------------#' +############################################################################### +# Check if automatic_sp_privileges can be accessed with and without @@ sign # +############################################################################### +--Error ER_GLOBAL_VARIABLE +SET automatic_sp_privileges = 1; +--Error ER_PARSE_ERROR +SET local.automatic_sp_privileges = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.automatic_sp_privileges; +--Error ER_PARSE_ERROR +SET global.automatic_sp_privileges = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.automatic_sp_privileges; +--Error ER_BAD_FIELD_ERROR +SELECT automatic_sp_privileges = @@session.automatic_sp_privileges; + + + +############################## +# Restore initial value # +############################## + +SET @@global.automatic_sp_privileges = @start_value; +SELECT @@global.automatic_sp_privileges; + + +############################################################# +# END OF automatic_sp_privileges TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test new file mode 100644 index 00000000000..ae5edbb078e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_func.test @@ -0,0 +1,150 @@ +############# mysql-test\t\automatic_sp_privileges_func.test ############################ +# # +# Variable Name: automatic_sp_privileges # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-03-04 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "automatic_sp_privileges" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_automatic_sp_privileges # +# # +######################################################################################### + +# +# Setup +# + +--source include/not_embedded.inc + +--echo ** Setup ** +SET @global_automatic_sp_privileges = @@GLOBAL.automatic_sp_privileges; + +CREATE TABLE t1 (a varchar(200)); + +INSERT INTO t1 VALUES('Procedure Executed.'); + +# +# Creating test user +# + +CREATE USER 'userTest'@'localhost'; +CREATE USER 'userTest1'@'localhost'; + +# +# Value TRUE +# +--echo ** Connection default ** +connection default; +SET GLOBAL automatic_sp_privileges = TRUE; + +--echo ** Connecting using userTest ** +connect (conUser,localhost,userTest,,); +--echo ** Connection conUser ** +connection conUser; + +delimiter |; + +CREATE PROCEDURE testProc () +BEGIN +SELECT * FROM t1; +END;| + +delimiter ;| + +CALL testProc(); +--echo Expecting SELECT executed + +# +# Value FALSE +# +--echo ** Connection default** +connection default; +SET GLOBAL automatic_sp_privileges = FALSE; + +--echo ** Connecting using userTest1 ** +connect (conUser1,localhost,userTest1,,); +--echo ** Connection conUser1 ** +connection conUser1; + +delimiter |; + +CREATE PROCEDURE testProc1 () +BEGIN +SELECT * FROM t1; +END;| + +delimiter ;| + +--echo +--echo Expected error access denied +--error ER_PROCACCESS_DENIED_ERROR +CALL testProc1(); + +--echo +--echo Expected error access denied +--error ER_PROCACCESS_DENIED_ERROR +ALTER PROCEDURE testProc1 COMMENT 'My Comment'; + +--echo +--echo Expected error access denied +--error ER_PROCACCESS_DENIED_ERROR +DROP PROCEDURE testProc1; + +--echo ** Connection default ** +connection default; + +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE testProc1 TO 'userTest1'@'localhost'; + +--echo ** Connection conUser1 ** +connection conUser1; + +CALL testProc1(); +--echo Expecting seelect executed + +ALTER PROCEDURE testProc1 COMMENT 'My Comment'; + +--echo +# +# Cleanup +# +--echo ** Cleanup ** +--echo ** Connection default ** +connection default; + +--echo disconnecting connections +disconnect conUser; +disconnect conUser1; + +SET GLOBAL automatic_sp_privileges = @global_automatic_sp_privileges; + +# Disabled due to differences in results: Bug#35384 +#SHOW GRANTS FOR 'userTest'@'localhost'; + +# on Linux (5.1.24) successful, on Windows (5.1.23) error +--error 0,ER_NONEXISTING_PROC_GRANT +REVOKE EXECUTE, ALTER ROUTINE ON PROCEDURE testProc FROM 'userTest'@'localhost'; + +--error 0,ER_NONEXISTING_PROC_GRANT +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'userTest'@'localhost'; + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'userTest1'@'localhost'; + +--disable_warnings +DROP PROCEDURE testProc; +--enable_warnings +DROP PROCEDURE testProc1; + +DROP USER 'userTest'@'localhost'; +DROP USER 'userTest1'@'localhost'; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/basedir_basic.test b/mysql-test/suite/sys_vars/t/basedir_basic.test new file mode 100644 index 00000000000..480e46ca8a0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/basedir_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\basedir_basic.test ############################ +# # +# Variable Name: basedir # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable basedir # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_001_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.basedir); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_001_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.basedir=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.basedir); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_001_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.basedir = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='basedir'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.basedir); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='basedir'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_001_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@basedir = @@GLOBAL.basedir; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_001_05----------------------#' +################################################################################ +# Check if basedir can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@basedir); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.basedir); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.basedir); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.basedir); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT basedir = @@SESSION.basedir; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/big_tables_basic.test b/mysql-test/suite/sys_vars/t/big_tables_basic.test new file mode 100644 index 00000000000..8665895bb19 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/big_tables_basic.test @@ -0,0 +1,179 @@ +##################### mysql-test\t\big_tables_basic.test ####################### +# # +# Variable Name: big_tables # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: NA # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "big_tables" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-options.html#option_mysqld_big-tables # +# # +################################################################################ + +--source include/load_sysvars.inc + +########################################################## +# START OF big_tables TESTS # +########################################################## + + +################################################################## +# Saving initial value of big_tables in a temporary variable # +################################################################## + +SET @start_value = @@big_tables; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_005_01------------------------#' +############################################################# +# Display the DEFAULT value of big_tables # +############################################################# + +SET @@big_tables = 1; +SET @@big_tables = DEFAULT; +SELECT @@big_tables; +--echo 'Bug# 34829: No default value for variable and setting default does not raise error'; + + +--echo '#--------------------FN_DYNVARS_005_02------------------------#' +############################################################# +# Change the value of big_tables to a valid value # +############################################################# + +SET @@big_tables = 0; +SELECT @@big_tables; +SET @@big_tables = 1; +SELECT @@big_tables; + + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +########################################################################### +# Change the value of big_tables to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@big_tables = ''; + + + +--echo '#-------------------FN_DYNVARS_005_04----------------------------#' +########################################################################### +# Test if accessing global big_tables gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.big_tables = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.big_tables; + + +--echo '#----------------------FN_DYNVARS_005_05------------------------#' +############################################################################## +# Check if the value in SESSION Tables matches values in variable # +############################################################################## + +SELECT @@big_tables = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='big_tables'; +--echo Bug # 34839: Values in variable and information_schema do not match for autocommit + + +--echo '#---------------------FN_DYNVARS_005_06----------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@big_tables = OFF; +SELECT @@big_tables; +SET @@big_tables = ON; +SELECT @@big_tables; + +--echo '#---------------------FN_DYNVARS_005_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@big_tables = TRUE; +SELECT @@big_tables; +SET @@big_tables = FALSE; +SELECT @@big_tables; + + +--echo '#---------------------FN_DYNVARS_005_08----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@big_tables = 0; +SELECT @@big_tables = @@session.big_tables; +SET @@big_tables = 1; +SELECT @@big_tables = @@local.big_tables and @@local.big_tables = @@session.big_tables; + +--echo '#---------------------FN_DYNVARS_005_09----------------------#' +########################################################################## +# Check if big_tables can be accessed with and without @@ sign # +########################################################################## + +SET big_tables = 1; +SELECT @@big_tables; +--Error ER_PARSE_ERROR +SET local.big_tables = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.big_tables; +--Error ER_PARSE_ERROR +SET session.big_tables = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.big_tables; +--Error ER_BAD_FIELD_ERROR +select big_tables; + + +############################## +# Restore initial value # +############################## + +SET @@big_tables = @start_value; +SELECT @@big_tables; + + +####################################################### +# END OF big_tables TESTS # +####################################################### + + diff --git a/mysql-test/suite/sys_vars/t/binlog_format_basic.test b/mysql-test/suite/sys_vars/t/binlog_format_basic.test new file mode 100644 index 00000000000..cd2b772fcb1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/binlog_format_basic.test @@ -0,0 +1,105 @@ +################## mysql-test\t\binlog_format_basic.test ###################### +# # +# Variable Name: binlog_format # +# Scope: Global & Session # +# Access Type: Static # +# Data Type: enumeration # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable binlog_format # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +################################################################### +# BUG#39812: Make statement replication default for 5.1 (to match 5.0) +# We just verify that the default binlog_format is STATEMENT in 5.1. +# In 6.0, it should be MIXED. +################################################################### +SELECT @@GLOBAL.binlog_format; + +--echo '#---------------------BS_STVARS_002_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SET @start_value= @@global.binlog_format; + +SELECT COUNT(@@GLOBAL.binlog_format); +--echo 1 Expected + +SELECT COUNT(@@SESSION.binlog_format); +--echo 1 Expected + +--echo '#---------------------BS_STVARS_002_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### +SET @@GLOBAL.binlog_format=1; +SELECT @@GLOBAL.binlog_format; + +SET @@SESSION.binlog_format=1; +SELECT @@SESSION.binlog_format; + +--echo '#---------------------BS_STVARS_002_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.binlog_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_format'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.binlog_format); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='binlog_format'; +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_002_04----------------------#' +################################################################# +# Check if the value in SESSION Table matches value in variable # +################################################################# + +SELECT @@SESSION.binlog_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_format'; +--echo 1 Expected + +SELECT COUNT(@@SESSION.binlog_format); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='binlog_format'; +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_002_05----------------------#' +################################################################################ +# Check if binlog_format can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@binlog_format); +--echo 1 Expected +SELECT COUNT(@@local.binlog_format); +--echo 1 Expected +SELECT COUNT(@@SESSION.binlog_format); +--echo 1 Expected +SELECT COUNT(@@GLOBAL.binlog_format); +--echo 1 Expected + +SET @@global.binlog_format= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/character_set_client_basic.test b/mysql-test/suite/sys_vars/t/character_set_client_basic.test new file mode 100644 index 00000000000..177a663c112 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_client_basic.test @@ -0,0 +1,346 @@ +############## mysql-test\t\character_set_client_basic.test ################### +# # +# Variable Name: character_set_client # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_client # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc +################################################### +## START OF character_set_client TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_client; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_client; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_client; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_client; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_010_01------------------#' +############################################################################### +# Test Variable access and assignment with and withoud @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_client; +# assign value without @@ +SET character_set_client=utf8; +SELECT @@session.character_set_client; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_client=utf8; +# using another syntax for accessing session variable +SET session character_set_client=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_client; +# using another syntax for accessing dynamic variable +SET global character_set_client=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_client; + +--echo '#--------------------FN_DYNVARS_010_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_client for session and global # +############################################################################### +SET @@character_set_client = latin5; +SET @@character_set_client = DEFAULT; +SELECT @@character_set_client AS DEFAULT_VALUE; + +SET @@global.character_set_client = latin5; +SET @@global.character_set_client = DEFAULT; +SELECT @@global.character_set_client; + +--echo '#--------------------FN_DYNVARS_010_03-------------------------#' +############################################################################### +# see if setting global value changes session value and vice versa # +############################################################################### +SET @@session.character_set_client = utf8; +SELECT @@session.character_set_client; +SET @@global.character_set_client = latin2; +SELECT @@global.character_set_client; +SELECT @@session.character_set_client AS res_is_utf8; + +SET @@session.character_set_client = latin5; +SELECT @@session.character_set_client; +SELECT @@global.character_set_client AS res_is_latin2; +# composite check +SELECT @@global.character_set_client=@@session.character_set_client +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_010_04-------------------------#' +############################################################################## +# Check if accessing variable with and without session point to session # +# variable # +############################################################################## +SELECT @@character_set_client = @@session.character_set_client AS res; +SELECT @@character_set_client = @@local.character_set_client AS res; + +--echo '#--------------------FN_DYNVARS_010_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_client = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_010_06-------------------------#' +############################################################################## +# Change the value of character_set_client to a valid value for session # +############################################################################## +SET @@character_set_client = big5; +SELECT @@character_set_client; +SET @@character_set_client = dec8; +SELECT @@character_set_client; +SET @@character_set_client = cp850; +SELECT @@character_set_client; +SET @@character_set_client = hp8; +SELECT @@character_set_client; +SET @@character_set_client = koi8r; +SELECT @@character_set_client; +SET @@character_set_client = latin1; +SELECT @@character_set_client; +SET @@character_set_client = latin2; +SELECT @@character_set_client; +SET @@character_set_client = swe7; +SELECT @@character_set_client; +SET @@character_set_client = ascii; +SELECT @@character_set_client; +SET @@character_set_client = ujis; +SELECT @@character_set_client; +SET @@character_set_client = sjis; +SELECT @@character_set_client; +SET @@character_set_client = hebrew; +SELECT @@character_set_client; +SET @@character_set_client = tis620; +SELECT @@character_set_client; +SET @@character_set_client = euckr; +SELECT @@character_set_client; +SET @@character_set_client = koi8u; +SELECT @@character_set_client; +SET @@character_set_client = gb2312; +SELECT @@character_set_client; +SET @@character_set_client = greek; +SELECT @@character_set_client; +SET @@character_set_client = cp1250; +SELECT @@character_set_client; +SET @@character_set_client = gbk; +SELECT @@character_set_client; +SET @@character_set_client = latin5; +SELECT @@character_set_client; +SET @@character_set_client = armscii8; +SELECT @@character_set_client; +SET @@character_set_client = utf8; +SELECT @@character_set_client; + +#SET @@character_set_client = ucs2; +#--Error ER_PARSE_ERROR +#SELECT @@session.character_set_client; +--echo 'Bug: Assignment of ucs2 to session character-set does not raise error'; +--echo 'but selecting variable after setting it does.'; +--echo 'Even catching this does not allow any further character-set to be set.'; +--echo 'Offending querry seems to be:'; +--echo 'SET @@character_set_client = ucs2;' + +SET @@character_set_client = cp866; +SELECT @@character_set_client; +SET @@character_set_client = keybcs2; +SELECT @@character_set_client; +SET @@character_set_client = macce; +SELECT @@character_set_client; +SET @@character_set_client = macroman; +SELECT @@character_set_client; +SET @@character_set_client = cp852; +SELECT @@character_set_client; +SET @@character_set_client = latin7; +SELECT @@character_set_client; +SET @@character_set_client = cp1251; +SELECT @@character_set_client; +SET @@character_set_client = cp1256; +SELECT @@character_set_client; +SET @@character_set_client = cp1257; +SELECT @@character_set_client; +SET @@character_set_client = binary; +SELECT @@character_set_client; +SET @@character_set_client = geostd8; +SELECT @@character_set_client; +SET @@character_set_client = cp932; +SELECT @@character_set_client; +SET @@character_set_client = eucjpms; +SELECT @@character_set_client; + +--echo '#--------------------FN_DYNVARS_010_07-------------------------#' +############################################################################### +# Change the value of character_set_client to a valid value for global # +############################################################################### + +let charset_variable = @@global.character_set_client; + +--source suite/sys_vars/inc/charset_basic.inc + +--echo '#--------------------FN_DYNVARS_010_08-------------------------#' +################################################################################ +# Change the value of character_set_client to a valid value with uppercase,# +# lowercase and mixedcase # +################################################################################ +SET @@character_set_client = UTF8; +SELECT @@character_set_client; +SET @@character_set_client = utf8; +SELECT @@character_set_client; +SET @@global.character_set_client = uTf8; +SELECT @@global.character_set_client; + +--echo '#--------------------FN_DYNVARS_010_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_client = 1; +SELECT @@character_set_client; +SET @@character_set_client = 2; +SELECT @@character_set_client; +SET @@character_set_client = 3; +SELECT @@character_set_client; +SET @@character_set_client = 36; +SELECT @@character_set_client; +SET @@character_set_client = 99; +SELECT @@character_set_client; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = 100; + +SET @@global.character_set_client = 1; +SELECT @@global.character_set_client; +SET @@global.character_set_client = 2; +SELECT @@global.character_set_client; +SET @@global.character_set_client = 3; +SELECT @@global.character_set_client; +SET @@global.character_set_client = 36; +SELECT @@global.character_set_client; +SET @@global.character_set_client = 99; +SELECT @@global.character_set_client; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = 100; + + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following'; +--echo 'numbers gives error, and before 100 the 36 mapped wraps arround'; +--echo 'several times.'; + +--echo '#--------------------FN_DYNVARS_010_10-------------------------#' +############################################################################### +# Change the value of character_set_client to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_client = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = 'utf'; +SET @@character_set_client = true; +SELECT @@character_set_client AS res_with_true; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_client = ON; + +--echo '#--------------------FN_DYNVARS_010_11-------------------------#' +############################################################################### +# Change the value of character_set_client to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_client = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = 'utf'; + +SET @@global.character_set_client = true; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_client = ON; + +--echo '#--------------------FN_DYNVARS_010_12-------------------------#' +########################################################################## +# Check if the value in GLOBAL Table matches value in variable # +########################################################################## +SELECT @@global.character_set_client = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_client') AS res; +SET @@global.character_set_client = 1; +SELECT @@global.character_set_client; +SELECT @@global.character_set_client = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_client') AS res; + +--echo '#--------------------FN_DYNVARS_010_13-------------------------#' +############################################################################### +# Check if the value in SESSION Table matches value in variable # +############################################################################### +SELECT @@character_set_client = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_client') AS res; +SELECT @@local.character_set_client = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_client') AS res; +SELECT @@session.character_set_client = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_client') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_client = @global_start_value; +SELECT @@global.character_set_client; +SET @@session.character_set_client = @session_start_value; +SELECT @@session.character_set_client; + +############################################################# +# END OF character_set_client TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_client_func.test b/mysql-test/suite/sys_vars/t/character_set_client_func.test new file mode 100644 index 00000000000..19994672fa4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_client_func.test @@ -0,0 +1,84 @@ +############## mysql-test\t\character_set_client_func.test ################### +# # +# Variable Name: character_set_client # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_client # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_010_01-------------------------#' +###################################################################### +# Check if setting character_set_client is changed in new connection # +###################################################################### + +# save +SET @global_character_set_client = @@global.character_set_client; +SET @session_character_set_client = @@session.character_set_client; + + +SET @@global.character_set_client = utf8; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.character_set_client; +SELECT @@session.character_set_client; +disconnect con1; + +--echo 'Bug# 35372: session character_set_client is not effected by global character_set_client' + +--echo '#--------------------FN_DYNVARS_010_02-------------------------#' +############################################################# +# Begin the functionality Testing of character_set_client # +############################################################# + +--echo 'connection default' +connection default; + +SHOW VARIABLES like 'character_set_client'; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a CHAR(3) character set utf8); + +#============================================================================== +--echo '---verifying character_set_client with a utf8 character----' +#============================================================================== +--echo 'For latin1 characterset'; +SET @@session.character_set_client = latin1; +INSERT INTO t1 values('è'); +SELECT a,CHAR_LENGTH(a) FROM t1; +DELETE FROM t1; + +--echo 'For utf8 characterset'; +SET @@session.character_set_client = utf8; +INSERT INTO t1 values('è'); +SELECT a,CHAR_LENGTH(a) FROM t1; +DELETE FROM t1; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# restore +SET @@global.character_set_client = @global_character_set_client; +SET @@session.character_set_client = @session_character_set_client; + +############################################################ +# End of functionality Testing for character_set_client # +############################################################ diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_basic.test b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test new file mode 100644 index 00000000000..5e28d43ce3e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_connection_basic.test @@ -0,0 +1,273 @@ +############## mysql-test\t\character_set_connection_basic.test ############### +# # +# Variable Name: character_set_connection # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_connection # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc +################################################### +## START OF character_set_connection TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_connection; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_connection; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_connection; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_connection; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_011_01------------------#' +############################################################################### +# Test Variable access and assignment with and withoud @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_connection; +# assign value without @@ +SET character_set_connection=utf8; +SELECT @@session.character_set_connection; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_connection=utf8; +# using another syntax for accessing session variable +SET session character_set_connection=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_connection; +# using another syntax for accessing dynamic variable +SET global character_set_connection=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_connection; + +--echo '#--------------------FN_DYNVARS_011_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_connection for session and global # +############################################################################### +SET @@character_set_connection = latin5; +SET @@character_set_connection = DEFAULT; +SELECT @@character_set_connection AS DEFAULT_VALUE; + +SET @@global.character_set_connection = latin5; +SET @@global.character_set_connection = DEFAULT; +SELECT @@global.character_set_connection; + +--echo '#--------------------FN_DYNVARS_011_03-------------------------#' +############################################################################### +# see if setting global value changes session value and vice versa # +############################################################################### +SET @@session.character_set_connection = utf8; +SELECT @@session.character_set_connection; +SET @@global.character_set_connection = latin2; +SELECT @@global.character_set_connection; +SELECT @@session.character_set_connection AS res_is_utf8; + +SET @@session.character_set_connection = latin5; +SELECT @@session.character_set_connection; +SELECT @@global.character_set_connection AS res_is_latin2; +# composite check +SELECT @@global.character_set_connection=@@session.character_set_connection +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_011_04-------------------------#' +############################################################################# +# Check if accessing variable with and without session point to # +# session variable # +############################################################################# +SELECT @@character_set_connection = @@session.character_set_connection AS res; +SELECT @@character_set_connection = @@local.character_set_connection AS res; + +--echo '#--------------------FN_DYNVARS_011_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_connection = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_011_06-------------------------#' +############################################################################## +# Change the value of character_set_connection to a valid value # +# for session # +############################################################################## + +let charset_variable = @@session.character_set_connection; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_011_07-------------------------#' +############################################################################## +# Change the value of character_set_connection to a valid value for global # +############################################################################## + +let charset_variable = @@global.character_set_connection; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_011_08-------------------------#' +############################################################################## +# Change the value of character_set_connection to a valid value with # +# uppercase,lowercase and mixedcase # +############################################################################## +SET @@character_set_connection = UTF8; +SELECT @@character_set_connection; +SET @@character_set_connection = utf8; +SELECT @@character_set_connection; + +SET @@global.character_set_connection = uTf8; +SELECT @@global.character_set_connection; + +--echo '#--------------------FN_DYNVARS_011_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_connection = 1; +SELECT @@character_set_connection; +SET @@character_set_connection = 2; +SELECT @@character_set_connection; +SET @@character_set_connection = 3; +SELECT @@character_set_connection; +SET @@character_set_connection = 36; +SELECT @@character_set_connection; +SET @@character_set_connection = 99; +SELECT @@character_set_connection; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 100; + + +SET @@global.character_set_connection = 1; +SELECT @@global.character_set_connection; +SET @@global.character_set_connection = 2; +SELECT @@global.character_set_connection; +SET @@global.character_set_connection = 3; +SELECT @@global.character_set_connection; +SET @@global.character_set_connection = 36; +SELECT @@global.character_set_connection; +SET @@global.character_set_connection = 99; +SELECT @@global.character_set_connection; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = 100; + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following '; +--echo 'numbers gives error, and before 100 the 36 mapped wraps arround'; +--echo 'several times.'; + +--echo '#--------------------FN_DYNVARS_011_10-------------------------#' +################################################################################ +# Change the value of character_set_connection to an invalid value for session # +################################################################################ +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_connection = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 'utf8 '; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = 'lätin2'; +SET @@character_set_connection = true; +SELECT @@character_set_connection AS res_with_true; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_connection = ON; + +--echo '#--------------------FN_DYNVARS_011_11-------------------------#' +############################################################################### +# Change the value of character_set_connection to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_connection = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = 'utf'; + +SET @@global.character_set_connection = true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_connection = ON; + +--echo '#--------------------FN_DYNVARS_011_12-------------------------#' +########################################################################## +# Check if the value in GLOBAL Table matches value in variable # +########################################################################## +SELECT @@global.character_set_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_connection') AS res; +SET @@global.character_set_connection = 1; +SELECT @@global.character_set_connection; +SELECT @@global.character_set_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_connection') AS res; + +--echo '#--------------------FN_DYNVARS_011_13-------------------------#' +############################################################################ +# Check if the value in SESSION Table matches value in variable # +############################################################################ +SELECT @@character_set_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_connection') AS res; +SELECT @@local.character_set_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_connection') AS res; +SELECT @@session.character_set_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_connection') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_connection = @global_start_value; +SELECT @@global.character_set_connection; +SET @@session.character_set_connection = @session_start_value; +SELECT @@session.character_set_connection; + +############################################################# +# END OF character_set_connection TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_func.test b/mysql-test/suite/sys_vars/t/character_set_connection_func.test new file mode 100644 index 00000000000..11a8e311fd1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_connection_func.test @@ -0,0 +1,105 @@ +############## mysql-test\t\character_set_connection_func.test ############### +# # +# Variable Name: character_set_connection # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_connection # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_011_01-------------------------#' +########################################################################## +# Check if setting character_set_connection is changed in new connection # +########################################################################## + +#save +SET @global_character_set_connection = @@global.character_set_connection; +SET @session_character_set_connection = @@session.character_set_connection; +SET @session_character_set_client = @@session.character_set_client; +SET @session_character_set_results = @@session.character_set_results; + + +SET @@global.character_set_connection = utf8; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.character_set_connection; +SELECT @@session.character_set_connection; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_011_02-------------------------#' +############################################################### +# Begin the functionality Testing of character_set_connection # +############################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8); +#============================================================================== +--echo '--verify that character_set_connection converts character_set_client--' +#============================================================================== + +SET @@session.character_set_client = utf8; +SET @@session.character_set_results = utf8; + +SET @@session.character_set_connection = latin1; +SELECT 'ÐЂЃЄ' AS utf_text; + +SET @@session.character_set_connection = utf8; +SELECT 'ÐЂЃЄ' AS utf_text; +#============================================================================== +--echo '---now inserting utf8 string with different character_set_connection--' +#============================================================================== +SET @@session.character_set_connection = ascii; +INSERT INTO t1 VALUES('ÐЂЃЄ'); +SELECT * FROM t1; +TRUNCATE TABLE t1; + +#============================================================================== +--echo '--now client & results charset in latin1 & connection charset in ascii-' +#============================================================================== +SET @@session.character_set_connection = ascii; +SET @@session.character_set_client = latin1; +SET @@session.character_set_results = latin1; +INSERT INTO t1 VALUES('ÐЂЃЄ'); +SELECT * FROM t1; +TRUNCATE TABLE t1; + +#============================================================================== +# set names should set character sets [client,connection,results] +#============================================================================== +SET NAMES utf8; +INSERT INTO t1 VALUES('ÐЂЃЄ'); +SELECT * FROM t1; +TRUNCATE TABLE t1; + + +# Cleanup +SET @@global.character_set_connection = @global_character_set_connection; +SET @@session.character_set_connection = @session_character_set_connection; +SET @@session.character_set_client = @session_character_set_client; +SET @@session.character_set_results = @session_character_set_results; + +DROP TABLE t1; + +############################################################# +# End of functionality Testing for character_set_connection # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/character_set_database_basic.test b/mysql-test/suite/sys_vars/t/character_set_database_basic.test new file mode 100644 index 00000000000..08069c00ae0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_database_basic.test @@ -0,0 +1,273 @@ +############## mysql-test\t\character_set_database_basic.test ################# +# # +# Variable Name: character_set_database # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: latin1 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_database # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc +################################################### +## START OF character_set_database TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_database; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_database; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_database; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_database; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_012_01------------------#' +############################################################################## +# Test Variable access and assignment with and withoud @@ # +############################################################################## +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_database; +# assign value without @@ +SET character_set_database=utf8; +SELECT @@session.character_set_database; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_database=utf8; +# using another syntax for accessing session variable +SET session character_set_database=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_database; +# using another syntax for accessing dynamic variable +SET global character_set_database=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_database; + +--echo '#--------------------FN_DYNVARS_012_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_database for session and global # +############################################################################### +SET @@character_set_database = latin5; +SET @@character_set_database = DEFAULT; +SELECT @@character_set_database AS DEFAULT_VALUE; + +SET @@global.character_set_database = latin5; +SET @@global.character_set_database = DEFAULT; +SELECT @@global.character_set_database; + +--echo '#--------------------FN_DYNVARS_012_03-------------------------#' +############################################################################## +# see if setting global value changes session value and vice versa # +############################################################################## +SET @@session.character_set_database = utf8; +SELECT @@session.character_set_database; +SET @@global.character_set_database = latin2; +SELECT @@global.character_set_database; +SELECT @@session.character_set_database AS res_is_utf8; + +SET @@session.character_set_database = latin5; +SELECT @@session.character_set_database; +SELECT @@global.character_set_database AS res_is_latin2; +# composite check +SELECT @@global.character_set_database=@@session.character_set_database +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_012_04-------------------------#' +############################################################################## +# Check if accessing variable with and without session point to session # +# variable # +############################################################################## +SELECT @@character_set_database = @@session.character_set_database AS res; +SELECT @@character_set_database = @@local.character_set_database AS res; + +--echo '#--------------------FN_DYNVARS_012_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_database = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_012_06-------------------------#' +############################################################################# +# Change the value of character_set_database to a valid value for session # +############################################################################# + +let charset_variable = @@session.character_set_database; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_012_07-------------------------#' +############################################################################## +# Change the value of character_set_database to a valid value for global # +############################################################################## + +let charset_variable = @@global.character_set_database; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_012_08-------------------------#' +############################################################################## +# Change the value of character_set_database to a valid value with uppercase,# +# lowercase and mixedcase # +############################################################################## +SET @@character_set_database = UTF8; +SELECT @@character_set_database; +SET @@character_set_database = utf8; +SELECT @@character_set_database; + +SET @@global.character_set_database = uTf8; +SELECT @@global.character_set_database; + +--echo '#--------------------FN_DYNVARS_012_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_database = 1; +SELECT @@character_set_database; +SET @@character_set_database = 2; +SELECT @@character_set_database; +SET @@character_set_database = 3; +SELECT @@character_set_database; +SET @@character_set_database = 36; +SELECT @@character_set_database; +SET @@character_set_database = 99; +SELECT @@character_set_database; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = 100; + + +SET @@global.character_set_database = 1; +SELECT @@global.character_set_database; +SET @@global.character_set_database = 2; +SELECT @@global.character_set_database; +SET @@global.character_set_database = 3; +SELECT @@global.character_set_database; +SET @@global.character_set_database = 36; +SELECT @@global.character_set_database; +SET @@global.character_set_database = 99; +SELECT @@global.character_set_database; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = 100; + + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following'; +--echo 'numbers gives error, and before 100 the 36 mapped wraps arround several times.'; + +--echo '#--------------------FN_DYNVARS_012_10-------------------------#' +############################################################################## +# Change the value of character_set_database to an invalid value for session # +############################################################################## +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = "grek"; +--Error ER_PARSE_ERROR +SET @@character_set_database = utf 8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_database = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = 'latin 2'; +SET @@character_set_database = true; +SELECT @@character_set_database AS res_with_true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_database = ON; + +--echo '#--------------------FN_DYNVARS_012_11-------------------------#' +############################################################################### +# Change the value of character_set_database to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_database = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = 'utf'; + +SET @@global.character_set_database = true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_database = ON; + +--echo '#--------------------FN_DYNVARS_012_12-------------------------#' +############################################################################ +# Check if the value in GLOBAL Table matches value in variable # +############################################################################ +SELECT @@global.character_set_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_database') AS res; +SET @@global.character_set_database = 1; +SELECT @@global.character_set_database; +SELECT @@global.character_set_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_database') AS res; + +--echo '#--------------------FN_DYNVARS_012_13-------------------------#' +############################################################################## +# Check if the value in SESSION Table matches value in variable # +############################################################################## +SELECT @@character_set_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_database') AS res; +SELECT @@local.character_set_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_database') AS res; +SELECT @@session.character_set_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_database') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_database = @global_start_value; +SELECT @@global.character_set_database; +SET @@session.character_set_database = @session_start_value; +SELECT @@session.character_set_database; + +############################################################# +# END OF character_set_database TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_database_func.test b/mysql-test/suite/sys_vars/t/character_set_database_func.test new file mode 100644 index 00000000000..88c77ef8c51 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_database_func.test @@ -0,0 +1,115 @@ +############## mysql-test\t\character_set_database_func.test ################# +# # +# Variable Name: character_set_database # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: latin1 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_database # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_utf8.inc + +--echo '#--------------------FN_DYNVARS_008_01-------------------------#' +######################################################################## +# Check if setting character_set_database is changed in new connection # +######################################################################## +#save +SET @global_character_set_database = @@global.character_set_database; +SET @session_character_set_database = @@session.character_set_database; +SET @session_character_set_server = @@session.character_set_server; + +SET @@global.character_set_database = utf8; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.character_set_database; +SELECT @@session.character_set_database; +--echo 'Bug#35356: session character_set_database differ from global character_set_database' +disconnect con1; + +--echo '#--------------------FN_DYNVARS_008_02-------------------------#' +############################################################# +# Begin the functionality Testing of character_set_database # +############################################################# + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +#============================================================================== +--echo '--check if setting session character_set_database effects new databases' +#============================================================================== + +SET @@session.character_set_server = utf8; +SELECT @@session.character_set_database; +SET @@session.character_set_database = latin5; +SELECT @@session.character_set_database; + +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +CREATE TABLE t1(a INT, b VARCHAR(40)); +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP DATABASE db1; + +--echo 'Bug#35357: character_set_database does not effects CREATE DATABASE without characater set' + +#============================================================================== +--echo '--ascii character set specified--' +#============================================================================== +CREATE DATABASE db1 CHARACTER SET ascii; +USE db1; +SHOW CREATE DATABASE db1; +CREATE TABLE t1(a INT, b VARCHAR(40)); +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP DATABASE db1; + +#============================================================================== +--echo '------Check if load data uses character_set_database----------' +#============================================================================== + +USE test; +CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; + +--echo 'Verify with latin'; +SET @@session.character_set_database = latin1; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; +SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; +TRUNCATE TABLE t1; + +--echo 'Verify with utf8'; +SET @@session.character_set_database = utf8; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1; +SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +#restore +SET @@global.character_set_database = @global_character_set_database; +SET @@session.character_set_database = @session_character_set_database; +SET @@session.character_set_server = @session_character_set_server; +############################################################ +# End of functionality Testing for character_set_database # +############################################################ diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test new file mode 100644 index 00000000000..3ba9c269a84 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_basic.test @@ -0,0 +1,255 @@ +############## mysql-test\t\character_set_filesystem_basic.test ############### +# # +# Variable Name: character_set_filesystem # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: latin5 # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_filesystem # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc + +################################################### +## START OF character_set_filesystem TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_filesystem; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_filesystem; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_filesystem; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_filesystem; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_008_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_filesystem; +# assign value without @@ +SET character_set_filesystem=utf8; +SELECT @@session.character_set_filesystem; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_filesystem=utf8; +# using another syntax for accessing session variable +SET session character_set_filesystem=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_filesystem; +# using another syntax for accessing dynamic variable +SET global character_set_filesystem=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_filesystem; + +--echo '#--------------------FN_DYNVARS_008_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_filesystem for session and global # +############################################################################### +SET @@character_set_filesystem = latin5; +SET @@character_set_filesystem = DEFAULT; +SELECT @@character_set_filesystem AS DEFAULT_VALUE; + +SET @@global.character_set_filesystem = latin5; +SET @@global.character_set_filesystem = DEFAULT; +SELECT @@global.character_set_filesystem AS DEFAULT_VALUE; + +--echo '#--------------------FN_DYNVARS_008_03-------------------------#' +############################################################################ +# see if setting global value changes session value and vice versa # +############################################################################ +SET @@session.character_set_filesystem = utf8; +SELECT @@session.character_set_filesystem; +SET @@global.character_set_filesystem = latin2; +SELECT @@global.character_set_filesystem; +SELECT @@session.character_set_filesystem AS res_is_utf8; + +SET @@session.character_set_filesystem = latin5; +SELECT @@session.character_set_filesystem; +SELECT @@global.character_set_filesystem AS res_is_latin2; +# composite check +SELECT @@global.character_set_filesystem= + @@session.character_set_filesystem AS res_is_false; + +--echo '#--------------------FN_DYNVARS_008_04-------------------------#' +################################################################################ +# Check if accessing variable with & without session point to session variable # +################################################################################ +SELECT @@character_set_filesystem = @@session.character_set_filesystem AS res; +SELECT @@character_set_filesystem = @@local.character_set_filesystem AS res; + +--echo '#--------------------FN_DYNVARS_008_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_filesystem = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_008_06-------------------------#' +############################################################################### +# Change the value of character_set_filesystem to a valid value for session # +############################################################################### + +let charset_variable = @@session.character_set_filesystem; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_008_07-------------------------#' +############################################################################## +# Change the value of character_set_filesystem to a valid value for global # +############################################################################## + +let charset_variable = @@global.character_set_filesystem; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_008_08-------------------------#' +######################################################################### +# Change the value of character_set_filesystem to a valid value with # +# uppercase,lowercase and mixedcase # +######################################################################### +SET @@character_set_filesystem = UTF8; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = utf8; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = uTf8; +SELECT @@character_set_filesystem; + +--echo '#--------------------FN_DYNVARS_008_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_filesystem = 1; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = 2; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = 3; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = 36; +SELECT @@character_set_filesystem; +SET @@character_set_filesystem = 99; +SELECT @@character_set_filesystem; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = 100; + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +echo 'Bug # 34843: character sets are mapped in such a way that 100 and following '; +echo 'numbers give error, and before 100 the 36 mapped wraps arround several times.'; + +--echo '#--------------------FN_DYNVARS_008_10-------------------------#' +################################################################################ +# Change the value of character_set_filesystem to an invalid value for session # +################################################################################ +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_filesystem = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = 'utf'; +SET @@character_set_filesystem = true; +SELECT @@character_set_filesystem AS res_with_true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_filesystem = ON; + +--echo '#--------------------FN_DYNVARS_008_11-------------------------#' +################################################################################ +# Change the value of character_set_filesystem to an invalid value for global # +################################################################################ +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_filesystem = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = 'utf'; + +SET @@global.character_set_filesystem = true; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_filesystem = ON; + +--echo '#--------------------FN_DYNVARS_008_12-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## +SELECT @@global.character_set_filesystem = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_filesystem') AS res; +SET @@global.character_set_filesystem = 1; +SELECT @@global.character_set_filesystem; +SELECT @@global.character_set_filesystem = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_filesystem') AS res; + +--echo '#--------------------FN_DYNVARS_008_13-------------------------#' +############################################################################# +# Check if the value in SESSION Table matches value in variable # +############################################################################# +SELECT @@character_set_filesystem = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_filesystem') AS res; +SELECT @@local.character_set_filesystem = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_filesystem') AS res; +SELECT @@session.character_set_filesystem = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_filesystem') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_filesystem = @global_start_value; +SELECT @@global.character_set_filesystem; +SET @@session.character_set_filesystem = @session_start_value; +SELECT @@session.character_set_filesystem; + +############################################################# +# END OF character_set_filesystem TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt new file mode 100644 index 00000000000..52a49182a53 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_filesystem_func-master.opt @@ -0,0 +1 @@ +--secure-file-priv=$MYSQL_TEST_DIR --innodb diff --git a/mysql-test/suite/sys_vars/t/character_set_results_basic.test b/mysql-test/suite/sys_vars/t/character_set_results_basic.test new file mode 100644 index 00000000000..98635c00287 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_results_basic.test @@ -0,0 +1,271 @@ +############## mysql-test\t\character_set_results_basic.test ################## +# # +# Variable Name: character_set_results # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_results # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc +################################################ +## START OF character_set_results TESTS ## +################################################ + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_results; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_results; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_results; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_results; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_013_01------------------#' +############################################################################## +# Test Variable access and assignment with and withoud @@ # +############################################################################## +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_results; +# assign value without @@ +SET character_set_results=utf8; +SELECT @@session.character_set_results; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_results=utf8; +# using another syntax for accessing session variable +SET session character_set_results=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_results; +# using another syntax for accessing dynamic variable +SET global character_set_results=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_results; + +--echo '#--------------------FN_DYNVARS_013_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_results for session and global # +############################################################################### +SET @@character_set_results = latin5; +SET @@character_set_results = DEFAULT; +SELECT @@character_set_results AS DEFAULT_VALUE; + +SET @@global.character_set_results = latin5; +SET @@global.character_set_results = DEFAULT; +SELECT @@global.character_set_results; + +--echo '#--------------------FN_DYNVARS_013_03-------------------------#' +############################################################################### +# see if setting global value changes session value and vice versa # +############################################################################### +SET @@session.character_set_results = utf8; +SELECT @@session.character_set_results; +SET @@global.character_set_results = latin2; +SELECT @@global.character_set_results; +SELECT @@session.character_set_results AS res_is_utf8; + +SET @@session.character_set_results = latin5; +SELECT @@session.character_set_results; +SELECT @@global.character_set_results AS res_is_latin2; +# composite check +SELECT @@global.character_set_results=@@session.character_set_results +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_013_04-------------------------#' +################################################################### +# Check if accessing variable with and without session point to # +# session variable # +################################################################### +SELECT @@character_set_results = @@session.character_set_results AS res; +SELECT @@character_set_results = @@local.character_set_results AS res; + +--echo '#--------------------FN_DYNVARS_013_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_results = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_013_06-------------------------#' +############################################################################## +# Change the value of character_set_results to a valid value for session # +############################################################################## + +let charset_variable = @@session.character_set_results; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_013_07-------------------------#' +############################################################################### +# Change the value of character_set_results to a valid value for global # +############################################################################### + +let charset_variable = @@global.character_set_results; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_013_08-------------------------#' +################################################################################ +# Change the value of character_set_results to a valid value with uppercase, # +# lowercase and mixedcase # +################################################################################ +SET @@character_set_results = UTF8; +SELECT @@character_set_results; +SET @@character_set_results = utf8; +SELECT @@character_set_results; + +SET @@global.character_set_results = uTf8; +SELECT @@global.character_set_results; + +--echo '#--------------------FN_DYNVARS_013_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_results = 1; +SELECT @@character_set_results; +SET @@character_set_results = 2; +SELECT @@character_set_results; +SET @@character_set_results = 3; +SELECT @@character_set_results; +SET @@character_set_results = 36; +SELECT @@character_set_results; +SET @@character_set_results = 99; +SELECT @@character_set_results; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = 100; + +SET @@global.character_set_results = 1; +SELECT @@global.character_set_results; +SET @@global.character_set_results = 2; +SELECT @@global.character_set_results; +SET @@global.character_set_results = 3; +SELECT @@global.character_set_results; +SET @@global.character_set_results = 36; +SELECT @@global.character_set_results; +SET @@global.character_set_results = 99; +SELECT @@global.character_set_results; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = 100; + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following'; +--echo 'numbers gives error, and before 100 the 36 mapped wraps arround several times.'; + +--echo '#--------------------FN_DYNVARS_013_10-------------------------#' +############################################################################### +# Change the value of character_set_results to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_results = .1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = ""; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = 'utf'; +SET @@character_set_results = true; +SELECT @@character_set_results AS res_with_true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_results = ON; + +--echo '#--------------------FN_DYNVARS_013_11-------------------------#' +############################################################################### +# Change the value of character_set_results to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = "'latin2'"; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_results = 0.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = ""; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = 'utf'; + +SET @@global.character_set_results = true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_results = ON; + +--echo '#--------------------FN_DYNVARS_013_12-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## +SELECT @@global.character_set_results = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_results') AS res; +SET @@global.character_set_results = 1; +SELECT @@global.character_set_results; +SELECT @@global.character_set_results = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_results') AS res; + +--echo '#--------------------FN_DYNVARS_013_13-------------------------#' +############################################################################## +# Check if the value in SESSION Table matches value in variable # +############################################################################## +SELECT @@character_set_results = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_results') AS res; +SELECT @@local.character_set_results = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_results') AS res; +SELECT @@session.character_set_results = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_results') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_results = @global_start_value; +SELECT @@global.character_set_results; +SET @@session.character_set_results = @session_start_value; +SELECT @@session.character_set_results; + +############################################################# +# END OF character_set_results TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_results_func.test b/mysql-test/suite/sys_vars/t/character_set_results_func.test new file mode 100644 index 00000000000..df7437f225f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_results_func.test @@ -0,0 +1,102 @@ +############## mysql-test\t\character_set_results_func.test ################## +# # +# Variable Name: character_set_results # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_results # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_012_01-------------------------#' +####################################################################### +# Check if setting character_set_results is changed in new connection # +####################################################################### + +# save +SET @global_character_set_results = @@global.character_set_results; +SET @session_character_set_results = @@session.character_set_results; + + +SET @@global.character_set_results = utf8; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.character_set_results; +SELECT @@session.character_set_results; +disconnect con1; + + +--echo '#--------------------FN_DYNVARS_012_02-------------------------#' +############################################################# +# Begin the functionality Testing of character_set_results # +############################################################# + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(b CHAR(40) character set utf8); +SET NAMES utf8; + +#============================================================================== +--echo '----check string literals against different character_set_results---' +#============================================================================== +--echo check if results are converted to character_set_results +SET @@session.character_set_results = greek; +SELECT 'ÐЂЃЄ' AS utf_text; + +--echo check effect of character_set_results when introducers are used +SET @@session.character_set_results = latin1; +SELECT _latin1'Müller' AS latin1_text; +SET @@session.character_set_results = ascii; +SELECT _latin1'Müller' AS latin1_text; + +--echo check when we dont want any conversion +SET @@session.character_set_results = NULL; +SELECT 'ÐЂЃЄ' AS utf_text; + +#============================================================================== +--echo '---check results from table against different character_set_results--' +#============================================================================== +INSERT INTO t1 VALUES(_utf8'ÐЂЃЄ'); +INSERT INTO t1 VALUES('ФХЦЧШ'); + +SET @@session.character_set_results = NULL; +SELECT b, CHAR_LENGTH(b) FROM t1; + +SET @@session.character_set_results = utf8; +SELECT b, CHAR_LENGTH(b) FROM t1; + +SET @@session.character_set_results = koi8r; +SELECT b, CHAR_LENGTH(b) FROM t1; + +SET @@session.character_set_results = cp1250; +SELECT b, CHAR_LENGTH(b) FROM t1; + +DROP TABLE t1; +# restore +--echo 'connection default;' +connection default; +SET @@global.character_set_results = @global_character_set_results; +SET @@session.character_set_results = @session_character_set_results; + +########################################################## +# End of functionality Testing for character_set_results # +########################################################## + diff --git a/mysql-test/suite/sys_vars/t/character_set_server_basic.test b/mysql-test/suite/sys_vars/t/character_set_server_basic.test new file mode 100644 index 00000000000..21eb3fb36dc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_server_basic.test @@ -0,0 +1,272 @@ +############## mysql-test\t\character_set_server_basic.test ################### +# # +# Variable Name: character_set_server # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_server # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc + +################################################### +## START OF character_set_server TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.character_set_server; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@character_set_server; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.character_set_server; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.character_set_server; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_009_01------------------#' +############################################################################### +# Test Variable access and assignment with and withoud @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT character_set_server; +# assign value without @@ +SET character_set_server=utf8; +SELECT @@session.character_set_server; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.character_set_server=utf8; +# using another syntax for accessing session variable +SET session character_set_server=utf8; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session character_set_server; +# using another syntax for accessing dynamic variable +SET global character_set_server=utf8; +--Error ER_BAD_FIELD_ERROR +SELECT global character_set_server; + +--echo '#--------------------FN_DYNVARS_009_02-------------------------#' +############################################################################### +# Check the DEFAULT value of character_set_server for session and global # +############################################################################### +SET @@character_set_server = latin5; +SET @@character_set_server = DEFAULT; +SELECT @@character_set_server AS DEFAULT_VALUE; + +SET @@global.character_set_server = latin5; +SET @@global.character_set_server = DEFAULT; +SELECT @@global.character_set_server; + +--echo '#--------------------FN_DYNVARS_009_03-------------------------#' +############################################################################### +# see if setting global value changes session value and vice versa # +############################################################################### +SET @@session.character_set_server = utf8; +SELECT @@session.character_set_server; +SET @@global.character_set_server = latin2; +SELECT @@global.character_set_server; +SELECT @@session.character_set_server AS res_is_utf8; + +SET @@session.character_set_server = latin5; +SELECT @@session.character_set_server; +SELECT @@global.character_set_server AS res_is_latin2; +# composite check +SELECT @@global.character_set_server=@@session.character_set_server +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_009_04-------------------------#' +############################################################################### +# Check if accessing variable with and without session point # +# to session variable # +############################################################################### +SELECT @@character_set_server = @@session.character_set_server AS res; +SELECT @@character_set_server = @@local.character_set_server AS res; + +--echo '#--------------------FN_DYNVARS_009_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@character_set_server = utf8 + latin2; + +--echo '#--------------------FN_DYNVARS_009_06-------------------------#' +############################################################################### +# Change the value of character_set_server to a valid value for session # +############################################################################### + +let charset_variable = @@session.character_set_server; + +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_009_07-------------------------#' +############################################################################### +# Change the value of character_set_server to a valid value for global # +############################################################################### + +let charset_variable = @@global.character_set_server; +--source suite/sys_vars/inc/charset_basic.inc + + +--echo '#--------------------FN_DYNVARS_009_08-------------------------#' +############################################################################### +# Change the value of character_set_server to a valid value with uppercase, # +# lowercase and mixedcase # +############################################################################### +SET @@character_set_server = UTF8; +SELECT @@character_set_server; +SET @@character_set_server = utf8; +SELECT @@character_set_server; + +SET @@global.character_set_server = uTf8; +SELECT @@global.character_set_server; + +--echo '#--------------------FN_DYNVARS_009_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@character_set_server = 1; +SELECT @@character_set_server; +SET @@character_set_server = 2; +SELECT @@character_set_server; +SET @@character_set_server = 3; +SELECT @@character_set_server; +SET @@character_set_server = 36; +SELECT @@character_set_server; +SET @@character_set_server = 99; +SELECT @@character_set_server; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = 100; + +SET @@global.character_set_server = 1; +SELECT @@global.character_set_server; +SET @@global.character_set_server = 2; +SELECT @@global.character_set_server; +SET @@global.character_set_server = 36; +SELECT @@global.character_set_server; +SET @@global.character_set_server = 99; +SELECT @@global.character_set_server; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = 100; + +SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); +SELECT @total_charset; +--echo 'Bug # 34843: character sets are mapped in such a way that 100 and following '; +--echo 'numbers gives error, and before 100 the 36 mapped wraps arround '; +--echo 'several times.'; + +--echo '#--------------------FN_DYNVARS_009_10-------------------------#' +############################################################################### +# Change the value of character_set_server to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@character_set_server = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = 'utf'; +SET @@character_set_server = true; +SELECT @@character_set_server AS res_with_true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@character_set_server = ON; + +--echo '#--------------------FN_DYNVARS_009_11-------------------------#' +############################################################################### +# Change the value of character_set_server to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = abc; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = 1utf8; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.character_set_server = 1.1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = -1; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = ''; +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = 'utf'; + +SET @@global.character_set_server = true; + +--Error ER_UNKNOWN_CHARACTER_SET +SET @@global.character_set_server = ON; + +--echo '#--------------------FN_DYNVARS_009_12-------------------------#' +############################################################################### +# Check if the value in GLOBAL Table matches value in variable # +############################################################################### +SELECT @@global.character_set_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_server') AS res; +SET @@global.character_set_server = 1; +SELECT @@global.character_set_server; +SELECT @@global.character_set_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='character_set_server') AS res; + +--echo '#--------------------FN_DYNVARS_009_13-------------------------#' +############################################################################### +# Check if the value in SESSION Table matches value in variable # +############################################################################### +SELECT @@character_set_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_server') AS res; +SELECT @@local.character_set_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_server') AS res; +SELECT @@session.character_set_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='character_set_server') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.character_set_server = @global_start_value; +SELECT @@global.character_set_server; +SET @@session.character_set_server = @session_start_value; +SELECT @@session.character_set_server; + +############################################################# +# END OF character_set_server TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/character_set_server_func.test b/mysql-test/suite/sys_vars/t/character_set_server_func.test new file mode 100644 index 00000000000..c17568c35ea --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_server_func.test @@ -0,0 +1,106 @@ +############## mysql-test\t\character_set_server_func.test ################### +# # +# Variable Name: character_set_server # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: utf8 (session), latin1 (global) # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable character_set_server # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--echo '#--------------------FN_DYNVARS_009_01-------------------------#' +###################################################################### +# Check if setting character_set_server is changed in new connection # +###################################################################### + +#save +SET @global_character_set_server = @@global.character_set_server; +SET @session_character_set_server = @@session.character_set_server; + + +SET @@global.character_set_server = utf8; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.character_set_server; +SELECT @@session.character_set_server; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_009_02-------------------------#' +############################################################# +# Begin the functionality Testing of character_set_server # +############################################################# + +--echo 'connection default' +connection default; +#The server character set and collation are used as default values if the database +#character set and collation are not specified in CREATE DATABASE statements. + +#============================================================================== +--echo '---global character_set_server should not effects current connection---' +#============================================================================== + +SET @@global.character_set_server = utf8; +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; +select @@character_set_database; + +#============================================================================== +--echo '---session character_set_server should effects current connection---' +#============================================================================== +SET @@session.character_set_server = utf8; +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; +select @@character_set_database; + +#============================================================================== +--echo '----test with new connection----' +#============================================================================== + +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; + +SELECT @@session.character_set_server; + +--echo '----------character set not specified---------' +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; +SELECT @@character_set_database; + +--echo '----------ascii character set specified----------' +CREATE DATABASE db1 character set ascii; +USE db1; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; +select @@character_set_database; + +disconnect con1; + +#restore +--echo 'connection default;' +connection default; +SET @@global.character_set_server = @global_character_set_server; +SET @@session.character_set_server = @session_character_set_server; + +############################################################ +# End of functionality Testing for character_set_server # +############################################################ diff --git a/mysql-test/suite/sys_vars/t/character_set_system_basic.test b/mysql-test/suite/sys_vars/t/character_set_system_basic.test new file mode 100644 index 00000000000..9d59b313efc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/character_set_system_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\character_set_system_basic.test ############### +# # +# Variable Name: character_set_system # +# Scope: Global # +# Access Type: Static # +# Data Type: string # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable character_set_system # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_003_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.character_set_system); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_003_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.character_set_system=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.character_set_system); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_003_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.character_set_system = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='character_set_system'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.character_set_system); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='character_set_system'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_003_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@character_set_system = @@GLOBAL.character_set_system; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_003_05----------------------#' +################################################################################ +# Check if character_set_system can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@character_set_system); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.character_set_system); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.character_set_system); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.character_set_system); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT character_set_system = @@SESSION.character_set_system; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/collation_connection_basic.test b/mysql-test/suite/sys_vars/t/collation_connection_basic.test new file mode 100644 index 00000000000..bf82ea321b7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_connection_basic.test @@ -0,0 +1,265 @@ +############## mysql-test\t\collation_connection_basic.test ################### +# # +# Variable Name: collation_connection # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_connection # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc + +################################################### +## START OF collation_connection TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.collation_connection; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@collation_connection; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.collation_connection; +SELECT @session_start_value; +# save using implicit session scope +SET @session_start_value = @@session.collation_connection; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_015_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT collation_connection; +# assign value without @@ +SET collation_connection=utf8_unicode_ci; +SELECT @@session.collation_connection; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.collation_connection=utf8_unicode_ci; +# using another syntax for accessing session variable +SET session collation_connection=utf8_unicode_ci; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session collation_connection; +# using another syntax for accessing dynamic variable +SET global collation_connection=utf8_unicode_ci; +--Error ER_BAD_FIELD_ERROR +SELECT global collation_connection; + +--echo '#--------------------FN_DYNVARS_015_02-------------------------#' +############################################################################### +# Check the DEFAULT value of collation_connection for session and global # +############################################################################### +SET @@collation_connection = latin1_bin; +SET @@collation_connection = DEFAULT; +SELECT @@collation_connection AS DEFAULT_VALUE; + +SET @@global.collation_connection = latin1_bin; +SET @@global.collation_connection = DEFAULT; +SELECT @@global.collation_connection; + +--echo '#--------------------FN_DYNVARS_015_03-------------------------#' +############################################################################## +# see if setting global value changes session value and vice versa # +############################################################################## +SET @@session.collation_connection = utf8_polish_ci; +SELECT @@session.collation_connection; +SET @@global.collation_connection = latin7_general_ci; +SELECT @@global.collation_connection; +SELECT @@session.collation_connection AS res_is_utf8_polish_ci; + +SET @@session.collation_connection = latin7_bin; +SELECT @@session.collation_connection; +SELECT @@global.collation_connection AS res_is_latin7_general_ci; +# composite check +SELECT @@global.collation_connection=@@session.collation_connection +AS res_is_false; + +--echo '#--------------------FN_DYNVARS_015_04-------------------------#' +############################################################################### +# Check if accessing variable with and without session point to session # +# variable # +############################################################################### +SELECT @@collation_connection = @@session.collation_connection AS res; +SELECT @@collation_connection = @@local.collation_connection AS res; + +--echo '#--------------------FN_DYNVARS_015_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@collation_connection = latin7_general_ci + latin7_general_cs; + +--echo '#--------------------FN_DYNVARS_015_06-------------------------#' +############################################################################### +# Change the value of collation_connection to a valid value for session # +############################################################################### + +let collation_variable = @@session.collation_connection; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_015_07-------------------------#' +############################################################################### +# Change the value of collation_connection to a valid value for global # +############################################################################### + +let collation_variable = @@global.collation_connection; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_015_08-------------------------#' +############################################################################## +# Change the value of collation_connection to a valid value with uppercase, # +# lowercase and mixedcase # +############################################################################## +SET @@collation_connection = LATIN7_GENERAL_CS; +SELECT @@collation_connection; +SET @@collation_connection = latin7_general_cs; +SELECT @@collation_connection; + +SET @@global.collation_connection = Latin7_GeneRal_cS; +SELECT @@global.collation_connection; + + +--echo '#--------------------FN_DYNVARS_015_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@collation_connection = 1; +SELECT @@collation_connection; +SET @@collation_connection = 2; +SELECT @@collation_connection; +SET @@collation_connection = 3; +SELECT @@collation_connection; +SET @@collation_connection = 99; +SELECT @@collation_connection; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = 100; + +SET @@global.collation_connection = 1; +SELECT @@global.collation_connection; +SET @@global.collation_connection = 2; +SELECT @@global.collation_connection; +SET @@global.collation_connection = 3; +SELECT @@global.collation_connection; +SET @@global.collation_connection = 99; +SELECT @@global.collation_connection; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = 100; + +SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS); +SELECT @total_collations > 120; + +--echo '#--------------------FN_DYNVARS_015_10-------------------------#' +############################################################################### +# Change the value of collation_connection to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@collation_connection = 1.01; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = -1; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = ''; +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = ' eucjpms_bin'; +SET @@collation_connection = true; +SELECT @@collation_connection AS res_with_true; + +--Error ER_UNKNOWN_COLLATION +SET @@collation_connection = ON; + +--echo '#--------------------FN_DYNVARS_015_11-------------------------#' +############################################################################### +# Change the value of collation_connection to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.collation_connection = 1.1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = -1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = ""; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = ' eucjpms_bin'; + +SET @@global.collation_connection = true; + +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_connection = ON; + +--echo '#--------------------FN_DYNVARS_015_12-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## +SELECT @@global.collation_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_connection') AS res; +SET @@global.collation_connection = 1; +SELECT @@global.collation_connection; +SELECT @@global.collation_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_connection') AS res; + +--echo '#--------------------FN_DYNVARS_015_13-------------------------#' +############################################################################### +# Check if the value in SESSION Table matches value in variable # +############################################################################### +SELECT @@collation_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_connection') AS res; +SELECT @@local.collation_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_connection') AS res; +SELECT @@session.collation_connection = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_connection') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.collation_connection = @global_start_value; +SELECT @@global.collation_connection; +SET @@session.collation_connection = @session_start_value; +SELECT @@session.collation_connection; + +############################################################# +# END OF collation_connection TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/collation_connection_func.test b/mysql-test/suite/sys_vars/t/collation_connection_func.test new file mode 100644 index 00000000000..bdb2efd9959 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_connection_func.test @@ -0,0 +1,95 @@ +############## mysql-test\t\collation_connection_func.test ################### +# # +# Variable Name: collation_connection # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_connection # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_015_01-------------------------#' +###################################################################### +# Check if setting collation_connection is changed in new connection # +###################################################################### +SET @global_collation_connection = @@global.collation_connection; +SET @session_collation_connection = @@session.collation_connection; + +SET @@global.collation_connection = latin1_danish_ci; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.collation_connection; +SELECT @@session.collation_connection; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_015_02-------------------------#' +########################################################### +# Begin the functionality Testing of collation_connection # +########################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +#============================================================================== +--echo '----check if collation_connection update character_set_connection---' +#============================================================================== + +SET @@session.collation_connection = utf8_spanish_ci; +SELECT @@collation_connection, @@character_set_database; + +#============================================================================== +--echo '---check if collation_connection works for literal string comparision--' +#============================================================================== +SET @@session.collation_connection = latin1_swedish_ci; +SELECT 'mysql'='MySql'; +SELECT _latin2'mysql' COLLATE latin2_general_ci='MySql'; +SELECT _utf8'mysql'=_utf8'MySql' COLLATE utf8_unicode_ci; + +SET @@session.collation_connection = latin1_general_cs; +SELECT 'mysql'='MySql'; +SELECT _latin2'mysql'COLLATE latin2_general_ci='MySql'; +--Error ER_CANT_AGGREGATE_2COLLATIONS +SELECT _utf8'mysql'COLLATE utf8_danish_ci=_utf8'MySql'COLLATE utf8_unicode_ci; + +#============================================================================== +--echo '---collation_connection does not effect comparision with column---' +#============================================================================== +# fill table with some test data +CREATE TABLE t1(a CHAR(20)CHARACTER SET latin1 COLLATE latin1_german2_ci); +INSERT INTO t1 VALUES('Müller'); + + +SET @@session.collation_connection = latin2_hungarian_ci; +SELECT * FROM t1 WHERE a='Müller'; + +SET @@session.collation_connection = latin1_general_cs; +SELECT * FROM t1 WHERE a='müller'; + +--echo 'check if string literal collation is used'; +SELECT * FROM t1 WHERE a='müller' COLLATE latin1_general_cs; +SELECT * FROM t1 WHERE a='müller' COLLATE latin1_german1_ci; + +# clean up +DROP TABLE t1; +SET @@global.collation_connection = @global_collation_connection; +SET @@session.collation_connection = @session_collation_connection; +######################################################### +# End of functionality Testing for collation_connection # +######################################################### diff --git a/mysql-test/suite/sys_vars/t/collation_database_basic.test b/mysql-test/suite/sys_vars/t/collation_database_basic.test new file mode 100644 index 00000000000..557f32b86a0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_database_basic.test @@ -0,0 +1,264 @@ +############## mysql-test\t\collation_database_basic.test ##################### +# # +# Variable Name: collation_database # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_database # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc + +################################################### +## START OF collation_database TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.collation_database; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@collation_database; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.collation_database; +SELECT @session_start_value; +# save using implicit session scope +SET @session_start_value = @@session.collation_database; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_016_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT collation_database; +# assign value without @@ +SET collation_database=utf8_unicode_ci; +SELECT @@session.collation_database; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.collation_database=utf8_unicode_ci; +# using another syntax for accessing session variable +SET session collation_database=utf8_unicode_ci; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session collation_database; +# using another syntax for accessing dynamic variable +SET global collation_database=utf8_unicode_ci; +--Error ER_BAD_FIELD_ERROR +SELECT global collation_database; + +--echo '#--------------------FN_DYNVARS_016_02-------------------------#' +############################################################################## +# Check the DEFAULT value of collation_database for session and global # +############################################################################## +SET @@collation_database = latin1_bin; +SET @@collation_database = DEFAULT; +SELECT @@collation_database AS DEFAULT_VALUE; + +SET @@global.collation_database = latin1_bin; +SET @@global.collation_database = DEFAULT; +SELECT @@global.collation_database; + +--echo '#--------------------FN_DYNVARS_016_03-------------------------#' +############################################################################## +# see if setting global value changes session value and vice versa # +############################################################################## +SET @@session.collation_database = utf8_polish_ci; +SELECT @@session.collation_database; +SET @@global.collation_database = latin7_general_ci; +SELECT @@global.collation_database; +SELECT @@session.collation_database AS res_is_utf8_polish_ci; + +SET @@session.collation_database = latin7_bin; +SELECT @@session.collation_database; +SELECT @@global.collation_database AS res_is_latin7_general_ci; +# composite check +SELECT @@global.collation_database=@@session.collation_database AS res_is_false; + +--echo '#--------------------FN_DYNVARS_016_04-------------------------#' +############################################################################### +# Check if accessing variable with and without session point to session # +# variable # +############################################################################### +SELECT @@collation_database = @@session.collation_database AS res; +SELECT @@collation_database = @@local.collation_database AS res; + +--echo '#--------------------FN_DYNVARS_016_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@collation_database = latin7_general_ci + latin7_general_cs; + +--echo '#--------------------FN_DYNVARS_016_06-------------------------#' +########################################################################### +# Change the value of collation_database to a valid value for session # +########################################################################### + +let collation_variable = @@session.collation_database; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_016_07-------------------------#' +############################################################################### +# Change the value of collation_database to a valid value for global # +############################################################################### + +let collation_variable = @@global.collation_database; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_016_08-------------------------#' +############################################################################# +# Change the value of collation_database to a valid value with uppercase, # +# lowercase and mixedcase # +############################################################################# +SET @@collation_database = LATIN7_GENERAL_CS; +SELECT @@collation_database; +SET @@collation_database = latin7_general_cs; +SELECT @@collation_database; + +SET @@global.collation_database = Latin7_GeneRal_cS; +SELECT @@global.collation_database; + +--echo '#--------------------FN_DYNVARS_016_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@collation_database = 1; +SELECT @@collation_database; +SET @@collation_database = 2; +SELECT @@collation_database; +SET @@collation_database = 3; +SELECT @@collation_database; +SET @@collation_database = 99; +SELECT @@collation_database; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = 100; + +SET @@global.collation_database = 1; +SELECT @@global.collation_database; +SET @@global.collation_database = 2; +SELECT @@global.collation_database; +SET @@global.collation_database = 3; +SELECT @@global.collation_database; +SET @@global.collation_database = 99; +SELECT @@global.collation_database; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = 100; + +SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS); +SELECT @total_collations > 120; + + +--echo '#--------------------FN_DYNVARS_016_10-------------------------#' +############################################################################### +# Change the value of collation_database to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@collation_database = 1.01; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = -1; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = ''; +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = ' eucjpms_bin'; +SET @@collation_database = true; +SELECT @@collation_database AS res_with_true; + +--Error ER_UNKNOWN_COLLATION +SET @@collation_database = ON; + +--echo '#--------------------FN_DYNVARS_016_11-------------------------#' +############################################################################### +# Change the value of collation_database to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.collation_database = 1.1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = -1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = ""; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = ' eucjpms_bin'; + +SET @@global.collation_database = true; + +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_database = ON; + +--echo '#--------------------FN_DYNVARS_016_12-------------------------#' +############################################################################### +# Check if the value in GLOBAL Table matches value in variable # +############################################################################### +SELECT @@global.collation_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_database') AS res; +SET @@global.collation_database = 1; +SELECT @@global.collation_database; +SELECT @@global.collation_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_database') AS res; + +--echo '#--------------------FN_DYNVARS_016_13-------------------------#' +############################################################################## +# Check if the value in SESSION Table matches value in variable # +############################################################################## +SELECT @@collation_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_database') AS res; +SELECT @@local.collation_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_database') AS res; +SELECT @@session.collation_database = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_database') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.collation_database = @global_start_value; +SELECT @@global.collation_database; +SET @@session.collation_database = @session_start_value; +SELECT @@session.collation_database; + +########################################################### +# END OF collation_database TESTS # +########################################################### diff --git a/mysql-test/suite/sys_vars/t/collation_database_func.test b/mysql-test/suite/sys_vars/t/collation_database_func.test new file mode 100644 index 00000000000..ba8fc5a3d5e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_database_func.test @@ -0,0 +1,138 @@ +############## mysql-test\t\collation_database_func.test ##################### +# # +# Variable Name: collation_database # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_database # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + + +--echo '#--------------------FN_DYNVARS_011_01-------------------------#' +#################################################################### +# Check if setting collation_database is changed in new connection # +#################################################################### +SET @global_collation_database = @@global.collation_database; +SET @session_collation_database = @@session.collation_database; +SET @session_collation_server = @@session.collation_server; + + +SET @@global.collation_database = latin1_danish_ci; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.collation_database; +SELECT @@session.collation_database; +disconnect con1; + +--echo 'Bug#35378: New session collation_database is not change by global collation_database' + +--echo '#--------------------FN_DYNVARS_011_02-------------------------#' +######################################################### +# Begin the functionality Testing of collation_database # +######################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + + +SELECT @@character_set_server,@@collation_server; +#============================================================================== +--echo '--check if setting collation_database update character_set_database--' +#============================================================================== + +SET @@session.collation_database = utf8_spanish_ci; +SELECT @@collation_database, @@character_set_database; + +#============================================================================== +--echo '--check if collation_database effects database/tables charset/collation' +#============================================================================== +SET @@session.collation_server = utf8_roman_ci; +SET @@session.collation_database = latin2_croatian_ci; +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +--echo 'Bug#35380: collation_database does not effects CREATE DATABASE without characater set' + +CREATE TABLE t1(a CHAR(20)); +SHOW CREATE TABLE t1; + +#============================================================================== +--echo '---check if updating collation_database effects new table/column---' +#============================================================================== +SET @@session.collation_database = latin7_general_cs; +CREATE TABLE t2(a CHAR(10)); +SHOW CREATE TABLE t2; + +DROP TABLE t1,t2; + + +#============================================================================== +--echo '--check value of collation and character set when current db is dropped' +#============================================================================== +DROP DATABASE db1; +SELECT @@collation_database,@@collation_server,@@character_set_database,@@character_set_server; +USE test; +SELECT @@collation_database,@@collation_server,@@character_set_database,@@character_set_server; + + +--echo 'fill table with some test data'; +CREATE TABLE t1(a CHAR(20))CHARACTER SET=latin1; +INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems'); + +#============================================================================== +--echo '---check if collation_database effects results sort order---' +#============================================================================== + +SET @@session.collation_database = latin1_swedish_ci; +SELECT * FROM t1 ORDER BY a; + +SET @@session.collation_database = latin1_german1_ci; +SELECT * FROM t1 ORDER BY a; + +--echo 'explicit Collate clause should effects results sort order'; + +SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci; +SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci; + + +#============================================================================== +--echo '----check if indexing is effected by collation_database---' +#============================================================================== +SET @@session.collation_database = latin1_swedish_ci; +ALTER TABLE t1 ADD PRIMARY KEY (a); +REPAIR TABLE t1; +SELECT * FROM t1 ORDER BY a; + +ALTER TABLE t1 DROP PRIMARY KEY; +SET @@session.collation_database = latin1_german1_ci; +ALTER TABLE t1 ADD PRIMARY KEY (a); +REPAIR TABLE t1; +SELECT * FROM t1 ORDER BY a; + +# clean up +DROP TABLE t1; +SET @@global.collation_database = @global_collation_database; +SET @@session.collation_database = @session_collation_database; +SET @@session.collation_server = @session_collation_server; + +####################################################### +# End of functionality Testing for collation_database # +####################################################### diff --git a/mysql-test/suite/sys_vars/t/collation_server_basic.test b/mysql-test/suite/sys_vars/t/collation_server_basic.test new file mode 100644 index 00000000000..a8af13c13ae --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_server_basic.test @@ -0,0 +1,266 @@ +############## mysql-test\t\collation_server_basic.test ####################### +# # +# Variable Name: collation_server # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_server # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_big5.inc +--source include/have_ujis.inc +--source include/have_sjis.inc +--source include/have_utf8.inc +--source include/have_ucs2.inc + +--source include/load_sysvars.inc + +################################################### +## START OF collation_server TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +SET @global_start_value = @@global.collation_server; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@collation_server; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.collation_server; +SELECT @session_start_value; +# save using implicit session scope +SET @session_start_value = @@session.collation_server; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_014_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT collation_server; +# assign value without @@ +SET collation_server=utf8_unicode_ci; +SELECT @@session.collation_server; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.collation_server=utf8_unicode_ci; +# using another syntax for accessing session variable +SET session collation_server=utf8_unicode_ci; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session collation_server; +# using another syntax for accessing dynamic variable +SET global collation_server=utf8_unicode_ci; +--Error ER_BAD_FIELD_ERROR +SELECT global collation_server; + +--echo '#--------------------FN_DYNVARS_014_02-------------------------#' +############################################################################### +# Check the DEFAULT value of collation_server for session and global # +############################################################################### +SET @@collation_server = latin1_bin; +SET @@collation_server = DEFAULT; +SELECT @@collation_server AS DEFAULT_VALUE; + +SET @@global.collation_server = latin1_bin; +SET @@global.collation_server = DEFAULT; +SELECT @@global.collation_server; + +--echo '#--------------------FN_DYNVARS_014_03-------------------------#' +########################################################################### +# Check if setting global value changes session value and vice versa # +########################################################################### +SET @@session.collation_server = utf8_polish_ci; +SELECT @@session.collation_server; +SET @@global.collation_server = latin7_general_ci; +SELECT @@global.collation_server; +SELECT @@session.collation_server AS res_is_utf8_polish_ci; + +SET @@session.collation_server = latin7_bin; +SELECT @@session.collation_server; +SELECT @@global.collation_server AS res_is_latin7_general_ci; +# composite check +SELECT @@global.collation_server=@@session.collation_server AS res_is_false; + +--echo '#--------------------FN_DYNVARS_014_04-------------------------#' +############################################################################# +# Check if accessing variable with and without session point to # +# session variable # +############################################################################# +SELECT @@collation_server = @@session.collation_server AS res; +SELECT @@collation_server = @@local.collation_server AS res; + +--echo '#--------------------FN_DYNVARS_014_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@collation_server = latin7_general_ci + latin7_general_cs; + +--echo '#--------------------FN_DYNVARS_014_06-------------------------#' +############################################################################## +# Change the value of collation_server to a valid value for session # +############################################################################## + +let collation_variable = @@session.collation_server; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_014_07-------------------------#' +############################################################################# +# Change the value of collation_server to a valid value for global # +############################################################################# + +let collation_variable = @@global.collation_server; +--source suite/sys_vars/inc/collation_basic.inc + + +--echo '#--------------------FN_DYNVARS_014_08-------------------------#' +############################################################################# +# Change the value of collation_server to a valid value with uppercase, # +# lowercase and mixedcase # +############################################################################# + +SET @@collation_server = LATIN7_GENERAL_CS; +SELECT @@collation_server; +SET @@collation_server = latin7_general_cs; +SELECT @@collation_server; + +SET @@global.collation_server = Latin7_GeneRal_cS; +SELECT @@global.collation_server; + + +--echo '#--------------------FN_DYNVARS_014_09-------------------------#' +############################################################## +# Check if 1,2,3, ... values can be used on variable # +############################################################## +SET @@collation_server = 1; +SELECT @@collation_server; +SET @@collation_server = 2; +SELECT @@collation_server; +SET @@collation_server = 3; +SELECT @@collation_server; +SET @@collation_server = 99; +SELECT @@collation_server; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = 100; + + +SET @@global.collation_server = 1; +SELECT @@global.collation_server; +SET @@global.collation_server = 2; +SELECT @@global.collation_server; +SET @@global.collation_server = 3; +SELECT @@global.collation_server; +SET @@global.collation_server = 99; +SELECT @@global.collation_server; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = 100; + + +SET @total_collations = (SELECT count(*) FROM INFORMATION_SCHEMA.COLLATIONS); +SELECT @total_collations > 120; + +--echo '#--------------------FN_DYNVARS_014_10-------------------------#' +############################################################################### +# Change the value of collation_server to an invalid value for session # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@collation_server = 1.01; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = -1; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = ''; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = ' eucjpms_bin'; +SET @@collation_server = true; +SELECT @@collation_server AS res_with_true; +--Error ER_UNKNOWN_COLLATION +SET @@collation_server = ON; + +--echo '#--------------------FN_DYNVARS_014_11-------------------------#' +############################################################################### +# Change the value of collation_server to an invalid value for global # +############################################################################### +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = latin7_binary; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = 'eucjpms_japanese_cs'; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.collation_server = 1.1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = -1; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = ""; +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = ' eucjpms_bin'; + +SET @@global.collation_server = true; + +--Error ER_UNKNOWN_COLLATION +SET @@global.collation_server = ON; + +--echo '#--------------------FN_DYNVARS_014_12-------------------------#' +############################################################################### +# Check if the value in GLOBAL Table matches value in variable # +############################################################################### +SELECT @@global.collation_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_server') AS res; +SET @@global.collation_server = 1; +SELECT @@global.collation_server; +SELECT @@global.collation_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='collation_server') AS res; + +--echo '#--------------------FN_DYNVARS_014_13-------------------------#' +############################################################################### +# Check if the value in SESSION Table matches value in variable # +############################################################################### +SELECT @@collation_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_server') AS res; +SELECT @@local.collation_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_server') AS res; +SELECT @@session.collation_server = + (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='collation_server') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.collation_server = @global_start_value; +SELECT @@global.collation_server; +SET @@session.collation_server = @session_start_value; +SELECT @@session.collation_server; + +##################################################### +# END OF collation_server TESTS # +##################################################### diff --git a/mysql-test/suite/sys_vars/t/collation_server_func.test b/mysql-test/suite/sys_vars/t/collation_server_func.test new file mode 100644 index 00000000000..045cb5cf720 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/collation_server_func.test @@ -0,0 +1,115 @@ +############## mysql-test\t\collation_server_func.test ####################### +# # +# Variable Name: collation_server # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable collation_server # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_014_01-------------------------#' +################################################################## +# Check if setting collation_server is changed in new connection # +################################################################## +#save +SET @global_collation_server = @@global.collation_server; +SET @session_collation_server = @@session.collation_server; + +SET @@global.collation_server = latin1_danish_ci; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.collation_server; +SELECT @@session.collation_server; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_014_02-------------------------#' +####################################################### +# Begin the functionality Testing of collation_server # +####################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +#============================================================================== +--echo '---check if setting collation_server update character_set_server---' +#============================================================================== + +SET @@session.collation_server = utf8_spanish_ci; +SELECT @@collation_server, @@character_set_server; + +#============================================================================== +--echo '--check if collation_server effects database/table charset/collation--' +#============================================================================== +SET @@session.collation_server = latin1_german1_ci; +CREATE DATABASE db1; +USE db1; +SHOW CREATE DATABASE db1; +CREATE TABLE t1(a CHAR(20)); +SHOW CREATE TABLE t1; +#============================================================================== +--echo '---check if updating collation_server effects new table/column---' +#============================================================================== +SET @@session.collation_server = latin1_swedish_ci; +CREATE TABLE t2(a CHAR(10)); +SHOW CREATE TABLE t2; + + +# fill table with some test data +INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems'); + +#============================================================================== +--echo '---check if collation_server effects results sort order---' +#============================================================================== +SET @@session.collation_server = latin1_swedish_ci; +SELECT * FROM t1 ORDER BY a; + +SET @@session.collation_server = latin1_german1_ci; +SELECT * FROM t1 ORDER BY a; + +# explicit Collate clause should effects results sort order + +SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci; +SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci; + +#============================================================================== +--echo '---check if indexing is effected by collation_server---' +#============================================================================== +SET @@session.collation_server = latin1_swedish_ci; +ALTER TABLE t1 ADD PRIMARY KEY (a); +REPAIR TABLE t1; +SELECT * FROM t1 ORDER BY a; + +ALTER TABLE t1 DROP PRIMARY KEY; +SET @@session.collation_server = latin1_german1_ci; +ALTER TABLE t1 ADD PRIMARY KEY (a); +REPAIR TABLE t1; +SELECT * FROM t1 ORDER BY a; + + +# clean up +DROP TABLE t1,t2; +DROP DATABASE db1; +#restore +SET @@global.collation_server = @global_collation_server; +SET @@session.collation_server = @session_collation_server; +##################################################### +# End of functionality Testing for collation_server # +##################################################### diff --git a/mysql-test/suite/sys_vars/t/completion_type_basic.test b/mysql-test/suite/sys_vars/t/completion_type_basic.test new file mode 100644 index 00000000000..7ffc1aa593b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/completion_type_basic.test @@ -0,0 +1,184 @@ +############## mysql-test\t\completion_type_basic.test ######################### +# # +# Variable Name: completion_type # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 0 # +# Valid Values: 0,1 & 2 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "completion_type" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_completion_type # +# # +################################################################################ + +--source include/load_sysvars.inc + +############################################################### +# START OF completion_type TESTS # +############################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.completion_type; +SELECT @start_global_value; +SET @start_session_value = @@session.completion_type; +SELECT @start_session_value; + +--echo '#--------------------FN_DYNVARS_017_01-------------------------#' +############################################################### +# Display the DEFAULT value of completion_type # +############################################################### + +SET @@global.completion_type = 2; +SET @@global.completion_type = DEFAULT; +SELECT @@global.completion_type; + +SET @@session.completion_type = 1; +SET @@session.completion_type = DEFAULT; +SELECT @@session.completion_type; + + +--echo '#--------------------FN_DYNVARS_017_02-------------------------#' +############################################################### +# Check the DEFAULT value of completion_type # +############################################################### + +SET @@global.completion_type = @start_global_value; +SELECT @@global.completion_type = 0; + +SET @@session.completion_type = @start_session_value; +SELECT @@session.completion_type = 0; + + +--echo '#--------------------FN_DYNVARS_017_03-------------------------#' +######################################################################### +# Change the value of completion_type to a valid value for GLOBAL Scope # +######################################################################### + +SET @@global.completion_type = 0; +SELECT @@global.completion_type; +SET @@global.completion_type = 1; +SELECT @@global.completion_type; +SET @@global.completion_type = 2; +SELECT @@global.completion_type; + + +--echo '#--------------------FN_DYNVARS_017_04-------------------------#' +########################################################################## +# Change the value of completion_type to a valid value for SESSION Scope # +########################################################################## + +SET @@session.completion_type = 0; +SELECT @@session.completion_type; +SET @@session.completion_type = 1; +SELECT @@session.completion_type; +SET @@session.completion_type = 2; +SELECT @@session.completion_type; + + +--echo '#------------------FN_DYNVARS_017_05-----------------------#' +########################################################### +# Change the value of completion_type to an invalid value # +########################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.completion_type = 10; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.completion_type = -1024; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.completion_type = 2.4; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.completion_type = OFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.completion_type = 10; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.completion_type = -2; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.completion_type = 1.2; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.completion_type = ON; + + +--echo '#------------------FN_DYNVARS_017_06-----------------------#' +############################################################################### +# Check if the value in GLOBAL & SESSION Tables matches value in variable # +############################################################################### + +SELECT @@global.completion_type = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='completion_type'; + +SELECT @@session.completion_type = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='completion_type'; + + +--echo '#------------------FN_DYNVARS_017_07-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.completion_type = TRUE; +SELECT @@global.completion_type; +SET @@global.completion_type = FALSE; +SELECT @@global.completion_type; + + +--echo '#---------------------FN_DYNVARS_001_08----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@completion_type = 1; +SELECT @@completion_type = @@local.completion_type; +SELECT @@local.completion_type = @@session.completion_type; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +########################################################################## +# Check if completion_type can be accessed with and without @@ sign # +########################################################################## + +SET completion_type = 1; +SELECT @@completion_type; +--Error ER_PARSE_ERROR +SET local.completion_type = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.completion_type; +--Error ER_PARSE_ERROR +SET session.completion_type = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.completion_type; +--Error ER_BAD_FIELD_ERROR +SELECT completion_type = @@session.completion_type; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.completion_type = @start_global_value; +SELECT @@global.completion_type; +SET @@session.completion_type = @start_session_value; +SELECT @@session.completion_type; + +############################################ +# END OF completion_type TESTS # +############################################ + diff --git a/mysql-test/suite/sys_vars/t/completion_type_func-master.opt b/mysql-test/suite/sys_vars/t/completion_type_func-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/completion_type_func-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test new file mode 100644 index 00000000000..ed0f04c37b4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/completion_type_func.test @@ -0,0 +1,112 @@ +############## mysql-test\t\completion_type_func.test ########################## +# # +# Variable Name: completion_type # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 0 # +# Valid Values: 0,1 & 2 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "completion_type" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_completion_type # +# # +################################################################################ + +--source include/have_innodb.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id), +name VARCHAR(30) +) ENGINE = INNODB; + +--echo '#--------------------FN_DYNVARS_017_01-------------------------#' +######################################################### +# Setting initial value of completion_type to zero # +######################################################### + +--echo ## Creating new connection ## +connect (test_con1,localhost,root,,); +connection test_con1; + +INSERT INTO t1(name) VALUES('Record_1'); +SET @@autocommit = 0; +SELECT * FROM t1; + +--echo ## Setting value of variable to 0 ## +SET @@session.completion_type = 0; + +--echo ## Here commit & rollback should work normally ## +START TRANSACTION; +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +SELECT * FROM t1; +DELETE FROM t1 WHERE id = 2; +SELECT * FROM t1; + + +START TRANSACTION; +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_4'); +INSERT INTO t1(name) VALUES('Record_5'); +COMMIT; + + +--echo '#--------------------FN_DYNVARS_017_02-------------------------#' +######################################################### +# Setting initial value of completion_type to 2 # +######################################################### + +SET @@session.completion_type = 2; + +--echo ## Here commit should work as COMMIT RELEASE ## +START TRANSACTION; +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_6'); +INSERT INTO t1(name) VALUES('Record_7'); +COMMIT; + +--echo ## Inserting rows should give error here because connection should ## +--echo ## disconnect after using COMMIT ## +--Error 2006,2013,1053 +INSERT INTO t1(name) VALUES('Record_4'); + +--echo ## Creating new connection test_con2 ## +connect (test_con2,localhost,root,,); +connection test_con2; +SET @@session.completion_type = 2; + +--echo ## Inserting rows and using Rollback which should Rollback & release ## +START TRANSACTION; +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_8'); +INSERT INTO t1(name) VALUES('Record_9'); +ROLLBACK; + +--Error 2006,2013,1053 +INSERT INTO t1(name) VALUES('Record_4'); + +connection default; +disconnect test_con1; +disconnect test_con2; + +DROP TABLE t1; + diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test new file mode 100644 index 00000000000..bc401ef22a3 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/concurrent_insert_basic.test @@ -0,0 +1,178 @@ +############## mysql-test\t\concurrent_insert_basic.test ####################### +# # +# Variable Name: concurrent_insert # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean & Numeric # +# Default Value: 1 # +# Valid Values: 0,1 & 2 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "concurrent_insert" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_concurrent_insert # +# # +################################################################################ + +--source include/load_sysvars.inc + +################################################################# +# START OF concurrent_insert TESTS # +################################################################# + + +######################################################################### +# Saving initial value of concurrent_insert in a temporary variable # +######################################################################### + +SET @start_value = @@global.concurrent_insert; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_018_01------------------------#' +######################################################################### +# Display the DEFAULT value of concurrent_insert # +######################################################################### + +SET @@global.concurrent_insert = 0; +SET @@global.concurrent_insert = DEFAULT; +SELECT @@global.concurrent_insert; + +--echo '#---------------------FN_DYNVARS_018_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.concurrent_insert = DEFAULT; +SELECT @@global.concurrent_insert = 1; + + +--echo '#--------------------FN_DYNVARS_018_03------------------------#' +######################################################################### +# Change the value of concurrent_insert to a valid value # +######################################################################### + +SET @@global.concurrent_insert = 0; +SELECT @@global.concurrent_insert; +SET @@global.concurrent_insert = 1; +SELECT @@global.concurrent_insert; +SET @@global.concurrent_insert = 2; +SELECT @@global.concurrent_insert; + +--echo '#--------------------FN_DYNVARS_018_04-------------------------#' +########################################################################### +# Change the value of concurrent_insert to invalid value # +########################################################################### + +SET @@global.concurrent_insert = -1; +Select @@global.concurrent_insert; +SET @@global.concurrent_insert = 100; +Select @@global.concurrent_insert; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = TRUEF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = TRUE_F; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = FALSE0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = OON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = ONN; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = OOFF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = 0FF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = ' '; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = " "; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = ''; + + +--echo '#-------------------FN_DYNVARS_018_05----------------------------#' +##################################################################### +# Test if accessing session concurrent_insert gives error # +##################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.concurrent_insert = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.concurrent_insert = 1; + + +--echo '#----------------------FN_DYNVARS_018_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.concurrent_insert = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='concurrent_insert'; + + +--echo '#---------------------FN_DYNVARS_018_07----------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = OFF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.concurrent_insert = ON; + + +--echo '#---------------------FN_DYNVARS_018_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.concurrent_insert = TRUE; +SELECT @@global.concurrent_insert; +SET @@global.concurrent_insert = FALSE; +SELECT @@global.concurrent_insert; + +--echo '#---------------------FN_DYNVARS_018_09----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.concurrent_insert = 1; +SELECT @@concurrent_insert = @@global.concurrent_insert; + + +--echo '#---------------------FN_DYNVARS_018_10----------------------#' +############################################################################### +# Check if concurrent_insert can be accessed with and without @@ sign # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET concurrent_insert = 1; +SELECT @@concurrent_insert; +--Error ER_PARSE_ERROR +SET global.concurrent_insert = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.concurrent_insert; +--Error ER_BAD_FIELD_ERROR +SELECT concurrent_insert = @@session.concurrent_insert; + +############################## +# Restore initial value # +############################## + +SET @@global.concurrent_insert = @start_value; +SELECT @@global.concurrent_insert; + +####################################################### +# END OF concurrent_insert TESTS # +####################################################### + diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test new file mode 100644 index 00000000000..cdeb76d9cac --- /dev/null +++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test @@ -0,0 +1,162 @@ +############## mysql-test\t\concurrent_insert_basic.test ####################### +# # +# Variable Name: concurrent_insert # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean & Numeric # +# Default Value: 1 # +# Valid Values: 0,1 & 2 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "concurrent_insert" # +# that checks functionality of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ + +--source include/not_embedded.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Setting initial value of concurrent_insert to 1 +# concurrent_insert = 1 means Enables concurrent insert +# for MyISAM tables that don't have holes +#################################################################### + +SET @start_value= @@global.concurrent_insert; + +--echo ## Setting initial value of variable to 1 ## +SET @@global.concurrent_insert = 1; +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); + +--echo ## locking table ## +LOCK TABLE t1 READ LOCAL; + +--echo ## Creating new connection to insert some rows in table ## +connect (test_con1,localhost,root,,); +--echo connection test_con1; +connection test_con1; + +--echo ## New records should come at the end of all rows ## +INSERT INTO t1(name) VALUES('Record_4'); +SELECT * FROM t1; + + +--echo ## unlocking tables ## +--echo connection default; +connection default; +UNLOCK TABLES; + +--echo ## deleting record to create hole in table ## +DELETE FROM t1 WHERE name ='Record_2'; + + +--echo '#--------------------FN_DYNVARS_018_02-------------------------#' +#################################################################### +# Setting initial value of concurrent_insert to 1 +# concurrent_insert = 1 and trying to insert some values +# in MyISAM tables that have holes +#################################################################### +# lock table and connect with connection1 +LOCK TABLE t1 READ LOCAL; +--echo connection test_con1; +connection test_con1; + +# setting value of concurrent_insert to 1 +SET @@global.concurrent_insert=1; + +--echo ## send INSERT which should be blocked until unlock of the table ## +send +INSERT INTO t1(name) VALUES('Record_7'); + +--echo connection default; +connection default; +# wait until INSERT will be locked (low performance) +let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; +--source include/wait_condition.inc + +--echo ## show processlist info and state ## +SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST +WHERE state= "Locked" AND info LIKE "INSERT INTO t1%"; +--echo ## table contents befor UNLOCK ## +SELECT * FROM t1; +UNLOCK TABLES; +--echo ## table contens after UNLOCK ## +SELECT * FROM t1; +INSERT INTO t1(name) VALUES('Record_6'); + +--echo connection test_con1; +connection test_con1; +# to complete the send above^ +reap; +SELECT * FROM t1; +--echo connection default; +connection default; + +--echo '#--------------------FN_DYNVARS_018_03-------------------------#' +################################################################################ +# Setting value of concurrent_insert to 2 to verify values after inserting +# it into table with holes +# concurrent_insert = 2 means Enables concurrent insert +# for MyISAM tables that have holes but inserts values at the end of all rows +################################################################################ + +--echo ## lock table and connect with connection1 ## +LOCK TABLE t1 READ LOCAL; +--echo connection test_con1; +connection test_con1; +--echo ## setting value of concurrent_insert to 2 ## +SET @@global.concurrent_insert=2; + +--echo ## Inserting record in table, record should go at the end of the table ## +INSERT INTO t1(name) VALUES('Record_5'); +SELECT * FROM t1; +SELECT @@concurrent_insert; + +--echo connection default; +connection default; + +--echo ## Unlocking table ## +UNLOCK TABLES; + +SELECT * FROM t1; + +--echo ## Inserting new row, this should go in the hole ## +INSERT INTO t1(name) VALUES('Record_6'); +SELECT * FROM t1; + +--echo ## connection test_con1 ## + +DELETE FROM t1 WHERE name ='Record_3'; +SELECT * FROM t1; + +--echo ## Dropping table ## +DROP TABLE t1; + +--echo ## Disconnecting connection ## +disconnect test_con1; + +SET @@global.concurrent_insert= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/connect_timeout_basic.test b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test new file mode 100644 index 00000000000..095c85f8295 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/connect_timeout_basic.test @@ -0,0 +1,153 @@ +################# mysql-test\t\connect_timeout_basic.test ###################### +# # +# Variable Name: connect_timeout # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 5 # +# Range: 2 - 31536000 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "connect_timeout" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_connect_timeout # +# # +################################################################################ + +--source include/load_sysvars.inc + +############################################################### +# START OF connect_timeout TESTS # +############################################################### + +####################################################################### +# Saving initial value of connect_timeout in a temporary variable # +####################################################################### + +SET @start_value = @@global.connect_timeout; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_019_01------------------------#' +####################################################################### +# Display the DEFAULT value of connect_timeout # +####################################################################### + +SET @@global.connect_timeout = 100; +SET @@global.connect_timeout = DEFAULT; +SELECT @@global.connect_timeout; + + +--echo '#---------------------FN_DYNVARS_019_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.connect_timeout = @start_value; +SELECT @@global.connect_timeout = 5; + + +--echo '#--------------------FN_DYNVARS_019_03------------------------#' +####################################################################### +# Change the value of connect_timeout to a valid value # +####################################################################### + +SET @@global.connect_timeout = 2; +SELECT @@global.connect_timeout; +SET @@global.connect_timeout = 10000; +SELECT @@global.connect_timeout; +SET @@global.connect_timeout = 21221204; +SELECT @@global.connect_timeout; + + +--echo '#--------------------FN_DYNVARS_019_04-------------------------#' +########################################################################## +# Change the value of connect_timeout to invalid value # +########################################################################## + +SET @@global.connect_timeout = 1; +SELECT @@global.connect_timeout; +SET @@global.connect_timeout = -1024; +SELECT @@global.connect_timeout; +SET @@global.connect_timeout = 42949672950; +SELECT @@global.connect_timeout; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.connect_timeout = 21221204.10; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.connect_timeout = ON; + + +--echo '#-------------------FN_DYNVARS_019_05----------------------------#' +########################################################################## +# Test if accessing session connect_timeout gives error # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET @@session.connect_timeout = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.connect_timeout; + + +--echo '#----------------------FN_DYNVARS_019_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.connect_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='connect_timeout'; + +--echo '#---------------------FN_DYNVARS_019_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.connect_timeout = TRUE; +SELECT @@global.connect_timeout; +SET @@global.connect_timeout = FALSE; +SELECT @@global.connect_timeout; + + +--echo '#---------------------FN_DYNVARS_019_08----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.connect_timeout = 5; +SELECT @@connect_timeout = @@global.connect_timeout; + +--echo '#---------------------FN_DYNVARS_019_09----------------------#' +######################################################################### +# Check if connect_timeout can be accessed with and without @@ sign # +######################################################################### + +--Error ER_GLOBAL_VARIABLE +SET connect_timeout = 1; +--Error ER_PARSE_ERROR +SET global.connect_timeout = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.connect_timeout; +--Error ER_BAD_FIELD_ERROR +SELECT connect_timeout = @@session.connect_timeout; + +############################## +# Restore initial value # +############################## + +SET @@global.connect_timeout = @start_value; +SELECT @@global.connect_timeout; + + +######################################################### +# END OF connect_timeout TESTS # +######################################################### + diff --git a/mysql-test/suite/sys_vars/t/datadir_basic.test b/mysql-test/suite/sys_vars/t/datadir_basic.test new file mode 100644 index 00000000000..7fae68fa55e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/datadir_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\datadir_basic.test ############################ +# # +# Variable Name: datadir # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable datadir # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_004_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.datadir); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_004_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.datadir=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.datadir); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_004_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.datadir = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='datadir'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.datadir); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='datadir'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_004_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@datadir = @@GLOBAL.datadir; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_004_05----------------------#' +################################################################################ +# Check if datadir can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@datadir); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.datadir); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.datadir); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.datadir); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT datadir = @@SESSION.datadir; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/default_week_format_basic.test b/mysql-test/suite/sys_vars/t/default_week_format_basic.test new file mode 100644 index 00000000000..d8b4a09541f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/default_week_format_basic.test @@ -0,0 +1,199 @@ +############## mysql-test\t\default_week_format_basic.test ##################### +# # +# Variable Name: default_week_format # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 0 # +# Range: 0 - 7 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "default_week_format" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_auto-increment-increment # +# # +################################################################################ + +--source include/load_sysvars.inc + +################################################################### +# START OF default_week_format TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.default_week_format; +SELECT @start_global_value; +SET @start_session_value = @@session.default_week_format; +SELECT @start_session_value; + +--echo '#--------------------FN_DYNVARS_022_01-------------------------#' +################################################################### +# Display the DEFAULT value of default_week_format # +################################################################### + +SET @@global.default_week_format = 100; +SET @@global.default_week_format = DEFAULT; +SELECT @@global.default_week_format; + +SET @@session.default_week_format = 200; +SET @@session.default_week_format = DEFAULT; +SELECT @@session.default_week_format; + +--echo '#--------------------FN_DYNVARS_022_02-------------------------#' +################################################################### +# Check the DEFAULT value of default_week_format # +################################################################### + +SET @@global.default_week_format = @start_global_value; +SELECT @@global.default_week_format = 0; + +SET @@session.default_week_format = @start_global_value; +SELECT @@session.default_week_format = 0; + +--echo '#--------------------FN_DYNVARS_022_03-------------------------#' +############################################################################# +# Change the value of default_week_format to a valid value for GLOBAL Scope # +############################################################################# + +SET @@global.default_week_format = 1; +SELECT @@global.default_week_format; +SET @@global.default_week_format = 0; +SELECT @@global.default_week_format; +SET @@global.default_week_format = 7; +SELECT @@global.default_week_format; + + +--echo '#--------------------FN_DYNVARS_022_04-------------------------#' +############################################################################## +# Change the value of default_week_format to a valid value for SESSION Scope # +############################################################################## + +SET @@session.default_week_format = 1; +SELECT @@session.default_week_format; +SET @@session.default_week_format = 0; +SELECT @@session.default_week_format; +SET @@session.default_week_format = 7; +SELECT @@session.default_week_format; + + +--echo '#------------------FN_DYNVARS_022_05-----------------------#' +############################################################### +# Change the value of default_week_format to an invalid value # +############################################################### + +SET @@global.default_week_format = 8; +SELECT @@global.default_week_format; +SET @@global.default_week_format = -1024; +SELECT @@global.default_week_format; +SET @@global.default_week_format = 65536; +SELECT @@global.default_week_format; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.default_week_format = 65530.30; +SELECT @@global.default_week_format; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.default_week_format = OFF; +SELECT @@global.default_week_format; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.default_week_format = ON; +SELECT @@session.default_week_format; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.default_week_format = 65530.30; +SELECT @@session.default_week_format; +SET @@session.default_week_format = 10; +SELECT @@session.default_week_format; +SET @@session.default_week_format = -2; +SELECT @@session.default_week_format; +SET @@session.default_week_format = 65550; +SELECT @@session.default_week_format; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--echo '#------------------FN_DYNVARS_022_06-----------------------#' +############################################################################### +# Check if the value in GLOBAL & SESSION Tables matches value in variable # +############################################################################### + +SELECT @@global.default_week_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='default_week_format'; + +SELECT @@session.default_week_format = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='default_week_format'; + + +--echo '#------------------FN_DYNVARS_022_07-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.default_week_format = TRUE; +SELECT @@global.default_week_format; +SET @@global.default_week_format = FALSE; +SELECT @@global.default_week_format; + + +--echo '#---------------------FN_DYNVARS_001_08----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.default_week_format = 0; +SELECT @@default_week_format = @@global.default_week_format; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@default_week_format = 1; +SELECT @@default_week_format = @@local.default_week_format; +SELECT @@local.default_week_format = @@session.default_week_format; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################################### +# Check if default_week_format can be accessed with and without @@ sign # +################################################################################### + +SET default_week_format = 1; +SELECT @@default_week_format; +--Error ER_PARSE_ERROR +SET local.default_week_format = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.default_week_format; +--Error ER_PARSE_ERROR +SET session.default_week_format = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.default_week_format; +--Error ER_BAD_FIELD_ERROR +SELECT default_week_format = @@session.default_week_format; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.default_week_format = @start_global_value; +SELECT @@global.default_week_format; +SET @@session.default_week_format = @start_session_value; +SELECT @@session.default_week_format; + + +############################################################# +# END OF default_week_format TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/default_week_format_func.test b/mysql-test/suite/sys_vars/t/default_week_format_func.test new file mode 100644 index 00000000000..c80c49b39fb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/default_week_format_func.test @@ -0,0 +1,66 @@ +############## mysql-test\t\default_week_format_func.test ##################### +# # +# Variable Name: default_week_format # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 0 # +# Range: 0 - 7 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "default_week_format" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_default_week_format # +# # +################################################################################ + +--echo '#--------------------FN_DYNVARS_022_01-------------------------#' +#################################################################### +# Verifying different values of default_week_format +#################################################################### + +--echo ## Setting variable's value to 0 ## +SET @@session.default_week_format = 0; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 1 ## +SET @@session.default_week_format = 1; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 2 ## +SET @@session.default_week_format = 2; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 3 ## +SET @@session.default_week_format = 3; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 4 ## +SET @@session.default_week_format = 4; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 5 ## +SET @@session.default_week_format = 5; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 6 ## +SET @@session.default_week_format = 6; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + +--echo ## Setting variable's value to 7 ## +SET @@session.default_week_format = 7; +SELECT @@session.default_week_format; +SELECT WEEK('2008-01-20'); + diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_basic.test b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test new file mode 100644 index 00000000000..faa1cb3cc6e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/delay_key_write_basic.test @@ -0,0 +1,173 @@ +##################### mysql-test\t\delay_key_write_basic.test ################# +# # +# Variable Name: delay_key_write # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: ON # +# Valid Values: ON, OFF & ALL # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable delay_key_write # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF delay_key_write TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of delay_key_write in a temporary variable # +######################################################################## + +SET @start_value = @@global.delay_key_write; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_023_01------------------------#' +######################################################################## +# Display the DEFAULT value of delay_key_write # +######################################################################## + +SET @@global.delay_key_write = OFF; +--Error ER_NO_DEFAULT +SET @@global.delay_key_write = DEFAULT; +--echo 'Bug # 34878: Documentation specifies a DEFAULT value of ON for variable but'; +--echo 'its not supported'; +SELECT @@global.delay_key_write; + + +--echo '#---------------------FN_DYNVARS_023_02-------------------------#' +############################################### +# Check if NULL is accepeted # +############################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = NULL; + + +--echo '#--------------------FN_DYNVARS_023_03------------------------#' +######################################################################## +# Change the value of delay_key_write to a valid value # +######################################################################## + +SET @@global.delay_key_write = ON; +SELECT @@global.delay_key_write; + +SET @@global.delay_key_write = OFF; +SELECT @@global.delay_key_write; + +SET @@global.delay_key_write = ALL; +SELECT @@global.delay_key_write; + + +--echo '#--------------------FN_DYNVARS_023_04-------------------------#' +########################################################################### +# Change the value of delay_key_write to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = 3; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = TRU; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = ERROR; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = ONN; + +SET @@global.delay_key_write = OF; +SELECT @@global.delay_key_write; +--echo 'Bug# 34828: Variable is incorrectly accepting OF as a value' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.delay_key_write = ""; + + +--echo '#-------------------FN_DYNVARS_023_05----------------------------#' +########################################################################### +# Test if accessing session delay_key_write gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@delay_key_write = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.delay_key_write; + + +--echo '#----------------------FN_DYNVARS_023_06------------------------#' +######################################################################## +# Check if the value in GLOBAL Table matches value in variable # +######################################################################## + +SELECT @@delay_key_write = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='delay_key_write'; + + +--echo '#---------------------FN_DYNVARS_023_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +SET @@global.delay_key_write = 0; +SELECT @@global.delay_key_write; + +SET @@global.delay_key_write = 1; +SELECT @@global.delay_key_write; + +SET @@global.delay_key_write = 2; +SELECT @@global.delay_key_write; + + + +--echo '#---------------------FN_DYNVARS_023_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.delay_key_write = TRUE; +SELECT @@global.delay_key_write; +SET @@global.delay_key_write = FALSE; +SELECT @@global.delay_key_write; + +--echo '#---------------------FN_DYNVARS_023_09----------------------#' +##################################################################### +# Check if delay_key_write can be accessed with and without @@ sign # +##################################################################### +--Error ER_GLOBAL_VARIABLE +SET delay_key_write = ON; +SELECT @@delay_key_write; + +SET GLOBAL delay_key_write = OFF; +SELECT @@global.delay_key_write; + +############################## +# Restore initial value # +############################## + +SET @@global.delay_key_write = @start_value; +SELECT @@global.delay_key_write; + +######################################################################## +# END OF delay_key_write TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt new file mode 100644 index 00000000000..a449c0fb964 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/delay_key_write_func-master.opt @@ -0,0 +1,2 @@ +--myisam-recover=BACKUP,FORCE + diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func.test b/mysql-test/suite/sys_vars/t/delay_key_write_func.test new file mode 100644 index 00000000000..a44b37653d2 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/delay_key_write_func.test @@ -0,0 +1,155 @@ +##################### mysql-test\t\delay_key_write_func.test ################# +# # +# Variable Name: delay_key_write # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: ON # +# Valid Values: ON, OFF & ALL # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable delay_key_write # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_023_01-------------------------#' +####################################################################### +# Check if setting delay_key_write is changed in every new connection # +####################################################################### + +SET @start_value= @@global.delay_key_write; + +SET @@global.delay_key_write = ON; +SELECT @@global.delay_key_write; + +--echo 'connect (user1,localhost,root,,,,)' +connect (user1,localhost,root,,,,); +--echo 'connection user1' +connection user1; +SELECT @@global.delay_key_write AS res_is_ON; +SET @@global.delay_key_write = ALL; +disconnect user1; + +--echo 'connect (user1,localhost,root,,,,)' +connect (user1,localhost,root,,,,); +--echo 'connection user1' +connection user1; +SELECT @@global.delay_key_write AS res_is_ALL; + +--echo '#--------------------FN_DYNVARS_023_02-------------------------#' +###################################################### +# Begin the functionality Testing of delay_key_write # +###################################################### + +# create procedure to add rows +--disable_query_log +DELIMITER //; +CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT) +BEGIN + WHILE (var1 < var2) DO + INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1); + SET var1=var1+1; + END WHILE; +END// +DELIMITER ;// +--enable_query_log + +#============================================================================== +--echo '---check when delay_key_write is OFF---' +#============================================================================== + + +SET @@global.delay_key_write = OFF; + + +--disable_query_log +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +# create a table with delay_key_write enabled +CREATE TABLE t1( +a INT PRIMARY KEY, +b VARCHAR(512), +c DOUBLE +) DELAY_KEY_WRITE = 1; +--enable_query_log + + +FLUSH STATUS; + +CALL sp_addRecords(1,10); + +SHOW STATUS LIKE 'Key_reads'; +SHOW STATUS LIKE 'Key_writes'; +SHOW STATUS LIKE 'Key_write_requests'; +SELECT COUNT(*) FROM t1; + +#============================================================================== +--echo '----check when delay_key_write is ON---' +#============================================================================== + +SET @@global.delay_key_write = ON; + +--disable_query_log +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +# create a table with delay_key_write enabled +CREATE TABLE t1( +a INT PRIMARY KEY, +b VARCHAR(512), +c DOUBLE +) DELAY_KEY_WRITE = 1; +--enable_query_log + +FLUSH STATUS; +CALL sp_addRecords(1,10); + +SHOW STATUS LIKE 'Key_reads'; +SHOW STATUS LIKE 'Key_writes'; +SHOW STATUS LIKE 'Key_write_requests'; +SELECT COUNT(*) FROM t1; + +#============================================================================== +--echo '----check when delay_key_write is ALL---' +#============================================================================== +SET @@global.delay_key_write = ALL; + +--disable_query_log +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +# create a table with delay_key_write disabled +CREATE TABLE t1( +a INT PRIMARY KEY, +b VARCHAR(512), +c DOUBLE +) DELAY_KEY_WRITE = 0; +--enable_query_log + +FLUSH STATUS; +CALL sp_addRecords(1,10); + +SHOW STATUS LIKE 'Key_reads'; +SHOW STATUS LIKE 'Key_writes'; +SHOW STATUS LIKE 'Key_write_requests'; +SELECT COUNT(*) FROM t1; + +DROP PROCEDURE sp_addRecords; +DROP TABLE t1; +disconnect user1; + +connection default; +SET @@global.delay_key_write= @start_value; + +#################################################### +# End of functionality testing for delay_key_write # +#################################################### + diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test new file mode 100644 index 00000000000..97e1f2daed1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test @@ -0,0 +1,229 @@ +############# mysql-test\t\sql_low_priority_updates_func.test ########################### +# # +# Variable Name: sql_low_priority_updates # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_low_priority_updates" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +######################################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +--source include/not_embedded.inc + +--echo Creating connection con0 +connect (con0,localhost,root,,); +--echo Creating connection con1 +connect (con1,localhost,root,,); + +connection default; + +SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit; + +# +# Create Table +# + +CREATE TABLE t1 (a varchar(100)); + +--echo '#--------------------FN_DYNVARS_25_01-------------------------#' +# +# Value less than the provided INSERTS (9) +# + +SET GLOBAL delayed_insert_limit = 9; + +--echo ** Connection con0 ** +connection con0; +SET GLOBAL delayed_insert_limit = 9; +--echo ** Connection con1 ** +connection con1; +SET GLOBAL delayed_insert_limit = 9; +--echo ** Connection default ** +connection default; +SET GLOBAL delayed_insert_limit = 9; + +INSERT INTO t1 VALUES('1'); +INSERT INTO t1 VALUES('2'); +INSERT INTO t1 VALUES('3'); +INSERT INTO t1 VALUES('4'); +INSERT INTO t1 VALUES('5'); +INSERT INTO t1 VALUES('6'); + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +delimiter |; + +send +INSERT DELAYED INTO t1 VALUES('7'); +INSERT DELAYED INTO t1 VALUES('8'); +INSERT DELAYED INTO t1 VALUES('9'); +INSERT DELAYED INTO t1 VALUES('10'); +INSERT DELAYED INTO t1 VALUES('11'); +INSERT DELAYED INTO t1 VALUES('12'); +INSERT DELAYED INTO t1 VALUES('13'); +INSERT DELAYED INTO t1 VALUES('14'); +INSERT DELAYED INTO t1 VALUES('15'); +INSERT DELAYED INTO t1 VALUES('16'); +INSERT DELAYED INTO t1 VALUES('17'); +INSERT DELAYED INTO t1 VALUES('18'); +INSERT DELAYED INTO t1 VALUES('19'); +INSERT DELAYED INTO t1 VALUES('20'); +INSERT DELAYED INTO t1 VALUES('21'); +INSERT DELAYED INTO t1 VALUES('22');| + +delimiter ;| + +--echo ** Connection con0 ** +connection con0; + +delimiter |; + +send +SELECT * FROM t1;| + +delimiter ;| + +--echo ** Connection default ** +connection default; + +--echo Waiting for 1 sec +--sleep 1 + +UNLOCK TABLES; + +--echo ** Connection con0 ** +connection con0; +reap; +--echo 'Bug#35386: insert delayed inserts 1 + limit rows instead of just limit rows' + +--echo ** Connection default ** +connection default; + +--echo Waiting for 1 sec +--sleep 1 +--echo Checking if the delayed insert continued afterwards +SELECT * FROM t1; + +DELETE FROM t1; + + +--echo '#--------------------FN_DYNVARS_25_02-------------------------#' +# +# Value 5 +# + +SET GLOBAL delayed_insert_limit = 20; + +--echo ** Connection con0 ** +connection con0; +SET GLOBAL delayed_insert_limit = 20; +--echo ** Connection con1 ** +connection con1; +SET GLOBAL delayed_insert_limit = 20; +--echo ** Connection default ** +connection default; +SET GLOBAL delayed_insert_limit = 20; + +INSERT INTO t1 VALUES('1'); +INSERT INTO t1 VALUES('2'); +INSERT INTO t1 VALUES('3'); +INSERT INTO t1 VALUES('4'); +INSERT INTO t1 VALUES('5'); +INSERT INTO t1 VALUES('6'); + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +--echo Asynchronous execute +delimiter |; + +send +INSERT DELAYED INTO t1 VALUES('7'); +INSERT DELAYED INTO t1 VALUES('8'); +INSERT DELAYED INTO t1 VALUES('9'); +INSERT DELAYED INTO t1 VALUES('10'); +INSERT DELAYED INTO t1 VALUES('11'); +INSERT DELAYED INTO t1 VALUES('12'); +INSERT DELAYED INTO t1 VALUES('13'); +INSERT DELAYED INTO t1 VALUES('14'); +INSERT DELAYED INTO t1 VALUES('15'); +INSERT DELAYED INTO t1 VALUES('16'); +INSERT DELAYED INTO t1 VALUES('17'); +INSERT DELAYED INTO t1 VALUES('18'); +INSERT DELAYED INTO t1 VALUES('19'); +INSERT DELAYED INTO t1 VALUES('20'); +INSERT DELAYED INTO t1 VALUES('21'); +INSERT DELAYED INTO t1 VALUES('22');| + +delimiter ;| + +--echo ** Connection con0 ** +connection con0; + +--echo Asynchronous execute +delimiter |; + +send +SELECT * FROM t1;| + +delimiter ;| + +--echo ** Connection default ** +connection default; + +--echo Waiting for 1 sec +--sleep 1 + +UNLOCK TABLES; + +--echo ** Connection con0 ** +connection con0; +--echo Asynchronous execute result +reap; + +--echo ** Connection default** +connection default; + +--echo Waiting for 1 sec +--sleep 1 +--echo Checking if the delayed insert gives the same result afterwards +SELECT * FROM t1; + +DELETE FROM t1; + +# +# Cleanup +# + +--echo Switching to default +connection default; + +--echo Disconnecting from con1, con0 +disconnect con0; +disconnect con1; + +DROP TABLE t1; + +SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test new file mode 100644 index 00000000000..8bad6b2dfe6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/delayed_insert_timeout_basic.test @@ -0,0 +1,171 @@ +################# mysql-test\t\delayed_insert_timeout_basic.test ############### +# # +# Variable Name: delayed_insert_timeout # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 300 # +# Range: 1 - 4294967286 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "delayed_insert_timeout" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_delayed_insert_timeout # +# # +################################################################################ + +--source include/load_sysvars.inc + +################################################################# +# START OF delayed_insert_timeout TESTS # +################################################################# + +############################################################################## +# Saving initial value of delayed_insert_timeout in a temporary variable # +############################################################################## + +SET @start_value = @@global.delayed_insert_timeout; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_025_01------------------------#' +############################################################################## +# Display the DEFAULT value of delayed_insert_timeout # +############################################################################## + +SET @@global.delayed_insert_timeout = 100; +SET @@global.delayed_insert_timeout = DEFAULT; +SELECT @@global.delayed_insert_timeout; + + +--echo '#---------------------FN_DYNVARS_025_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.delayed_insert_timeout = @start_value; +SELECT @@global.delayed_insert_timeout = 300; + + +--echo '#--------------------FN_DYNVARS_025_03------------------------#' +############################################################################## +# Change the value of delayed_insert_timeout to a valid value # +############################################################################## + +SET @@global.delayed_insert_timeout = 10000; +SELECT @@global.delayed_insert_timeout; +SET @@global.delayed_insert_timeout = 429; +SELECT @@global.delayed_insert_timeout; +SET @@global.delayed_insert_timeout = 1; +SELECT @@global.delayed_insert_timeout; + + +--echo '#--------------------FN_DYNVARS_025_04-------------------------#' +################################################################################# +# Change the value of delayed_insert_timeout to invalid value # +################################################################################# + +SET @@global.delayed_insert_timeout = 0; +SELECT @@global.delayed_insert_timeout; +SET @@global.delayed_insert_timeout = -1024; +SELECT @@global.delayed_insert_timeout; +SET @@global.delayed_insert_timeout = 42949672950; +SELECT @@global.delayed_insert_timeout; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.delayed_insert_timeout = 429496729.5; +SELECT @@global.delayed_insert_timeout; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.delayed_insert_timeout = ON; +SELECT @@global.delayed_insert_timeout; + + +--echo '#-------------------FN_DYNVARS_025_05----------------------------#' +################################################################################# +# Test if accessing session delayed_insert_timeout gives error # +################################################################################# + +--Error 1229 +SET @@session.delayed_insert_timeout = 0; +--Error 1193 +SELECT @@session.dalayed_insert_timeout; + +--echo '#----------------------FN_DYNVARS_025_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.delayed_insert_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='delayed_insert_timeout'; + +SELECT @@delayed_insert_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='delayed_insert_timeout'; + + +--echo '#---------------------FN_DYNVARS_025_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.delayed_insert_timeout = TRUE; +SELECT @@global.delayed_insert_timeout; +SET @@global.delayed_insert_timeout = FALSE; +SELECT @@global.delayed_insert_timeout; + + +--echo '#---------------------FN_DYNVARS_025_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.delayed_insert_timeout = 1; +SELECT @@delayed_insert_timeout = @@global.delayed_insert_timeout; + + +--echo '#---------------------FN_DYNVARS_025_09----------------------#' +################################################################################ +# Check if delayed_insert_timeout can be accessed with and without @@ sign # +################################################################################ + +--Error 1229 +SET delayed_insert_timeout = 1; +SELECT @@delayed_insert_timeout; +--Error 1064 +SET local.delayed_insert_timeout = 1; +--Error 1109 +SELECT local.delayed_insert_timeout; +--Error 1064 +SET global.delayed_insert_timeout = 1; +--Error 1109 +SELECT global.delayed_insert_timeout; +--Error 1054 +SELECT delayed_insert_timeout = @@session.delayed_insert_timeout; +# Restore initial value +SET @@global.delayed_insert_timeout = @start_value; +SELECT @@global.delayed_insert_timeout; + + +############################## +# Restore initial value # +############################## + +SET @@global.delayed_insert_timeout = @start_value; +SELECT @@global.delayed_insert_timeout; + + +################################################################ +# END OF delayed_insert_timeout TESTS # +################################################################ + diff --git a/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test new file mode 100644 index 00000000000..40497e829df --- /dev/null +++ b/mysql-test/suite/sys_vars/t/div_precision_increment_basic.test @@ -0,0 +1,209 @@ +############## mysql-test\t\div_precision_increment_basic.test ################# +# # +# Variable Name: div_precision_increment # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 4 # +# Range: 0 - 30 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "div_precision_increment" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_div_precision_increment # +# # +################################################################################ + +--source include/load_sysvars.inc + +####################################################################### +# START OF div_precision_increment TESTS # +####################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.div_precision_increment; +SELECT @start_global_value; +SET @start_session_value = @@session.div_precision_increment; +SELECT @start_session_value; + +--echo '#--------------------FN_DYNVARS_027_01-------------------------#' +####################################################################### +# Display the DEFAULT value of div_precision_increment # +####################################################################### + +SET @@global.div_precision_increment = 100; +SET @@global.div_precision_increment = DEFAULT; +SELECT @@global.div_precision_increment; + +SET @@session.div_precision_increment = 200; +SET @@session.div_precision_increment = DEFAULT; +SELECT @@session.div_precision_increment; + +--echo '#--------------------FN_DYNVARS_027_02-------------------------#' +####################################################################### +# Check the DEFAULT value of div_precision_increment # +####################################################################### + +SET @@global.div_precision_increment = @start_global_value; +SELECT @@global.div_precision_increment = 4; + +SET @@session.div_precision_increment = @start_session_value; +SELECT @@session.div_precision_increment = 4; + +--echo '#--------------------FN_DYNVARS_027_03-------------------------#' +################################################################################# +# Change the value of div_precision_increment to a valid value for GLOBAL Scope # +################################################################################# + +SET @@global.div_precision_increment = 1; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = 0; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = 10; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = 30; +SELECT @@global.div_precision_increment; + + +--echo '#--------------------FN_DYNVARS_027_04-------------------------#' +################################################################################## +# Change the value of div_precision_increment to a valid value for SESSION Scope # +################################################################################## + +SET @@session.div_precision_increment = 1; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = 0; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = 7; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = 30; +SELECT @@session.div_precision_increment; + + +--echo '#------------------FN_DYNVARS_027_05-----------------------#' +################################################################### +# Change the value of div_precision_increment to an invalid value # +################################################################### + +SET @@global.div_precision_increment = 31; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = 40; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = -1024; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = 65536; +SELECT @@global.div_precision_increment; +SET @@session.div_precision_increment = 40; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = 31; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = -2; +SELECT @@session.div_precision_increment; +SET @@session.div_precision_increment = 65550; +SELECT @@session.div_precision_increment; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.div_precision_increment = 65530.30; +SELECT @@global.div_precision_increment; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.div_precision_increment = OFF; +SELECT @@global.div_precision_increment; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.div_precision_increment = ON; +SELECT @@session.div_precision_increment; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.div_precision_increment = 65530.30; +SELECT @@session.div_precision_increment; + + +--echo '#------------------FN_DYNVARS_027_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.div_precision_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='div_precision_increment'; + +--echo '#------------------FN_DYNVARS_027_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.div_precision_increment = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='div_precision_increment'; + + +# FN_DYNVARS_027_07 - Check if TRUE and FALSE values can be used on variable +SET @@global.div_precision_increment = TRUE; +SELECT @@global.div_precision_increment; +SET @@global.div_precision_increment = FALSE; +SELECT @@global.div_precision_increment; + + +--echo '#---------------------FN_DYNVARS_027_08----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.div_precision_increment = 0; +SELECT @@div_precision_increment = @@global.div_precision_increment; + + +--echo '#---------------------FN_DYNVARS_027_09----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@div_precision_increment = 1; +SELECT @@div_precision_increment = @@local.div_precision_increment; +SELECT @@local.div_precision_increment = @@session.div_precision_increment; + + +--echo '#---------------------FN_DYNVARS_027_10----------------------#' +################################################################################## +# Check if div_precision_increment can be accessed with and without @@ sign # +################################################################################## + +SET div_precision_increment = 1; +SELECT @@div_precision_increment; +--Error ER_PARSE_ERROR +SET local.div_precision_increment = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.div_precision_increment; +--Error ER_PARSE_ERROR +SET session.div_precision_increment = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.div_precision_increment; +--Error ER_BAD_FIELD_ERROR +SELECT div_precision_increment = @@session.div_precision_increment; + + + +#################################### +# Restore initial value # +#################################### + +SET @@global.div_precision_increment = @start_global_value; +SELECT @@global.div_precision_increment; +SET @@session.div_precision_increment = @start_session_value; +SELECT @@session.div_precision_increment; + + +####################################################### +# END OF div_precision_increment TESTS # +####################################################### + diff --git a/mysql-test/suite/sys_vars/t/div_precision_increment_func.test b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test new file mode 100644 index 00000000000..aebca88abf9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test @@ -0,0 +1,129 @@ +############## mysql-test\t\div_precision_increment_func.test ################# +# # +# Variable Name: div_precision_increment # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 4 # +# Range: 0 - 30 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "div_precision_increment" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_div_precision_increment # +# # +################################################################################ + +let $save_div_precision_increment = `SELECT @@global.div_precision_increment` + +#SET @save_div_precision_increment = @@global.div_precision_increment; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30), +salary LONG +); + +--echo '#--------------------FN_DYNVARS_027_01-------------------------#' +#################################################################### +# Setting initial value of div_precision_increment to 1 +# to check whether it is working with columns or not. +#################################################################### + +--echo ## Setting initial session value of variable to 3 ## +SET @@session.div_precision_increment = 3; + +--echo ## Inserting some rows in table ## +INSERT into t1(name, salary) values('Record_1', 100011); +INSERT into t1(name, salary) values('Record_2', 501); +INSERT into t1(name, salary) values('Record_3', 210); + +SELECT name, salary, ((salary * 2.5)/1000) AS INCOME from t1; +--echo 'Bug#35374: div_precision is not working with table column' + +--echo ## Verifying variable's behavior with direct division ## +SELECT 1/7; + +--echo '#--------------------FN_DYNVARS_027_02-------------------------#' +#################################################################### +# Verifying div_precision_increment behavior by inserting rows +# to check whether it is working with columns or not. +#################################################################### + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30), +salary LONG, +income_tax FLOAT +); + +--echo ## Creating new connection test_con1 ## +connect (test_con1, localhost, root,,); +connection test_con1; + +--echo ## Setting global & session scope value of variable ## +SET @@global.div_precision_increment = 2; +SET @@session.div_precision_increment = 1; +SELECT @@global.div_precision_increment; +SELECT @@session.div_precision_increment; + +--echo ## Inserting some data and verifying behavior of variable ## +INSERT into t1(name, salary, income_tax) values('Record_1', 100011, 100011*2.5/1000); +INSERT into t1(name, salary, income_tax) values('Record_2', 501, 501*2.5/1000); +INSERT into t1(name, salary, income_tax) values('Record_3', 210, 210*2.5/1000); +SELECT * from t1; + +--echo ## Creating new connection ## +connect (test_con2, localhost, root,,); +connection test_con2; + +--echo ## Verifying session & global value of variable ## +SELECT @@global.div_precision_increment = 2; +SELECT @@session.div_precision_increment = 2; + +--echo ## Verifying behavior of variable by inserting some rows in table ## +INSERT into t1(name, salary, income_tax) values('Record_4', 100011, 100011*2.5/1000); +INSERT into t1(name, salary, income_tax) values('Record_5', 501, 501*2.5/1000); +INSERT into t1(name, salary, income_tax) values('Record_6', 210, 210*2.5/1000); +SELECT * from t1; + +--echo ## Dropping table t1 ## +drop table t1; + +--echo ## Disconnection both the connections ## +disconnect test_con1; +disconnect test_con2; + +connection default; +eval SET @@global.div_precision_increment = $save_div_precision_increment; + + + + diff --git a/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test new file mode 100644 index 00000000000..ee781159d6a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test @@ -0,0 +1,227 @@ +############## mysql-test\t\engine_condition_pushdown_basic.test ############## +# # +# Variable Name: engine_condition_pushdown # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable engine_condition_pushdown# +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF engine_condition_pushdown TESTS # +######################################################################## + + +############################################################################### +# Saving initial value of engine_condition_pushdown in a temporary variable # +############################################################################### + +SET @session_start_value = @@session.engine_condition_pushdown; +SELECT @session_start_value; + +SET @global_start_value = @@global.engine_condition_pushdown; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_028_01------------------------#' +######################################################################## +# Display the DEFAULT value of engine_condition_pushdown # +######################################################################## + +SET @@session.engine_condition_pushdown = 0; +SET @@session.engine_condition_pushdown = DEFAULT; +SELECT @@session.engine_condition_pushdown; + +SET @@global.engine_condition_pushdown = 0; +SET @@global.engine_condition_pushdown = DEFAULT; +SELECT @@global.engine_condition_pushdown; + +--echo '#---------------------FN_DYNVARS_028_02-------------------------#' +############################################################################### +# Check if engine_condition_pushdown can be accessed with and without @@ sign # +############################################################################### + +SET engine_condition_pushdown = 1; +SELECT @@engine_condition_pushdown; + +--Error ER_UNKNOWN_TABLE +SELECT session.engine_condition_pushdown; + +--Error ER_UNKNOWN_TABLE +SELECT local.engine_condition_pushdown; + +--Error ER_UNKNOWN_TABLE +SELECT global.engine_condition_pushdown; + +SET session engine_condition_pushdown = 0; +SELECT @@session.engine_condition_pushdown; + +SET global engine_condition_pushdown = 0; +SELECT @@global.engine_condition_pushdown; + + +--echo '#--------------------FN_DYNVARS_028_03------------------------#' +########################################################################## +# change the value of engine_condition_pushdown to a valid value # +########################################################################## + +SET @@session.engine_condition_pushdown = 0; +SELECT @@session.engine_condition_pushdown; +SET @@session.engine_condition_pushdown = 1; +SELECT @@session.engine_condition_pushdown; + + +SET @@global.engine_condition_pushdown = 0; +SELECT @@global.engine_condition_pushdown; +SET @@global.engine_condition_pushdown = 1; +SELECT @@global.engine_condition_pushdown; + + +--echo '#--------------------FN_DYNVARS_028_04-------------------------#' +########################################################################### +# Change the value of engine_condition_pushdown to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = 1.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = ÕN; + +SET @@session.engine_condition_pushdown = OF; +SELECT @@session.engine_condition_pushdown; +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.engine_condition_pushdown = ÓFF; + + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = ÕN; + +SET @@global.engine_condition_pushdown = OF; +SELECT @@global.engine_condition_pushdown; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.engine_condition_pushdown = ÓFF; + + +--echo '#-------------------FN_DYNVARS_028_05----------------------------#' +########################################################################### +# Test if changing global variable effects session and vice versa # +########################################################################### + +SET @@global.engine_condition_pushdown = 0; +SET @@session.engine_condition_pushdown = 1; +SELECT @@global.engine_condition_pushdown AS res_is_0; + +SET @@global.engine_condition_pushdown = 0; +SELECT @@session.engine_condition_pushdown AS res_is_1; + +--echo '#----------------------FN_DYNVARS_028_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.engine_condition_pushdown = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='engine_condition_pushdown'; +SELECT @@global.engine_condition_pushdown; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='engine_condition_pushdown'; + +--echo '#----------------------FN_DYNVARS_028_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.engine_condition_pushdown = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='engine_condition_pushdown'; +SELECT @@session.engine_condition_pushdown; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='engine_condition_pushdown'; + + +--echo '#---------------------FN_DYNVARS_028_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.engine_condition_pushdown = OFF; +SELECT @@session.engine_condition_pushdown; +SET @@session.engine_condition_pushdown = ON; +SELECT @@session.engine_condition_pushdown; + +SET @@global.engine_condition_pushdown = OFF; +SELECT @@global.engine_condition_pushdown; +SET @@global.engine_condition_pushdown = ON; +SELECT @@global.engine_condition_pushdown; + +--echo '#---------------------FN_DYNVARS_028_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.engine_condition_pushdown = TRUE; +SELECT @@session.engine_condition_pushdown; +SET @@session.engine_condition_pushdown = FALSE; +SELECT @@session.engine_condition_pushdown; + +SET @@global.engine_condition_pushdown = TRUE; +SELECT @@global.engine_condition_pushdown; +SET @@global.engine_condition_pushdown = FALSE; +SELECT @@global.engine_condition_pushdown; + +############################## +# Restore initial value # +############################## + +SET @@session.engine_condition_pushdown = @session_start_value; +SELECT @@session.engine_condition_pushdown; + +SET @@global.engine_condition_pushdown = @global_start_value; +SELECT @@global.engine_condition_pushdown; + +############################################################### +# END OF engine_condition_pushdown TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/error_count_basic.test b/mysql-test/suite/sys_vars/t/error_count_basic.test new file mode 100644 index 00000000000..14001874c22 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/error_count_basic.test @@ -0,0 +1,97 @@ + + +################## mysql-test\t\error_count_basic.test ######################## +# # +# Variable Name: error_count # +# Scope: Session # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable error_count # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_005_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### + +SELECT COUNT(@@SESSION.error_count); +--echo 1 Expected + +--echo '#---------------------BS_STVARS_005_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.error_count=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@SESSION.error_count); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_005_03----------------------#' +################################################################# +# Check if the value in SESSION Table matches value in variable # +################################################################# + +SELECT @@SESSION.error_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='error_count'; +--echo 1 Expected + +SELECT COUNT(@@SESSION.error_count); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='error_count'; +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_005_04----------------------#' +################################################################################ +# Check if accessing variable with and without SESSION point to same variable # +################################################################################ +SELECT @@error_count = @@SESSION.error_count; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_005_05----------------------#' +################################################################################ +# Check if error_count can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@error_count); +--echo 1 Expected +SELECT COUNT(@@local.error_count); +--echo 1 Expected +SELECT COUNT(@@SESSION.error_count); +--echo 1 Expected + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@GLOBAL.error_count); +--echo Expected error 'Variable is a SESSION variable' + +--error ER_BAD_FIELD_ERROR +SELECT COUNT(error_count = @@GLOBAL.error_count); +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/event_scheduler_basic.test b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test new file mode 100644 index 00000000000..f7045651613 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/event_scheduler_basic.test @@ -0,0 +1,175 @@ +#################### mysql-test\t\event_scheduler_basic.test ################### +# # +# Variable Name: event_scheduler # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Enumeration # +# Default Value: OFF # +# Valid Values: ON, OFF, DISABLED # +# # +# # +# Creation Date: 2008-03-14 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "event_scheduler" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-options.html#option_mysqld_event-scheduler # +# # +################################################################################ +--source include/not_embedded.inc +--source include/load_sysvars.inc + +############################################################### +# START OF event_scheduler TESTS # +############################################################### + + +####################################################################### +# Saving initial value of event_scheduler in a temporary variable # +####################################################################### + +SET @start_value = @@global.event_scheduler; +SELECT @start_value; + + +--echo '#---------------------FN_DYNVARS_004_01-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +--Error ER_NO_DEFAULT +SET @@global.event_scheduler = DEFAULT; +#SELECT @@global.event_scheduler = OFF; +--echo 'Bug# 34878: According to documentation the default value of variable is OFF'; + +--echo '#--------------------FN_DYNVARS_004_02------------------------#' +####################################################################### +# Change the value of event_scheduler to a valid value # +####################################################################### + +SET @@global.event_scheduler = ON; +SELECT @@global.event_scheduler; +SET @@global.event_scheduler = OFF; +SELECT @@global.event_scheduler; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = DISABLED; +SELECT @@global.event_scheduler; + + +--echo '#--------------------FN_DYNVARS_004_03-------------------------#' +####################################################################### +# Change the value of event_scheduler to invalid value # +####################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.event_scheduler = ''; + + +--echo '#-------------------FN_DYNVARS_004_04----------------------------#' +################################################################### +# Test if accessing session event_scheduler gives error # +################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.event_scheduler = OFF; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.event_scheduler; + + +--echo '#----------------------FN_DYNVARS_004_05------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.event_scheduler = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='event_scheduler'; + + +--echo '#---------------------FN_DYNVARS_004_06----------------------#' +################################################################### +# Check if 0 and 1 values can be used on variable # +################################################################### + +SET @@global.event_scheduler = 0; +SELECT @@global.event_scheduler; +SET @@global.event_scheduler = 1; +SELECT @@global.event_scheduler; + +--echo '#---------------------FN_DYNVARS_004_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.event_scheduler = TRUE; +SELECT @@global.event_scheduler; +SET @@global.event_scheduler = FALSE; +SELECT @@global.event_scheduler; + +--echo '#---------------------FN_DYNVARS_004_08----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@global.event_scheduler = ON; +SELECT @@event_scheduler = @@global.event_scheduler; + +--echo '#---------------------FN_DYNVARS_004_09----------------------#' +####################################################################### +# Check if event_scheduler can be accessed with and without @@ sign # +####################################################################### +--Error ER_GLOBAL_VARIABLE +SET event_scheduler = ON; +--Error ER_PARSE_ERROR +SET local.event_scheduler = OFF; +--Error ER_UNKNOWN_TABLE +SELECT local.event_scheduler; +--Error ER_PARSE_ERROR +SET global.event_scheduler = ON; +--Error ER_UNKNOWN_TABLE +SELECT global.event_scheduler; +--Error ER_BAD_FIELD_ERROR +SELECT event_scheduler = @@session.event_scheduler; + + + +############################## +# Restore initial value # +############################## + +SET @@global.event_scheduler = @start_value; +SELECT @@global.event_scheduler; + + +##################################################### +# END OF event_scheduler TESTS # +##################################################### diff --git a/mysql-test/suite/sys_vars/t/event_scheduler_func.test b/mysql-test/suite/sys_vars/t/event_scheduler_func.test new file mode 100644 index 00000000000..f727b2b6833 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/event_scheduler_func.test @@ -0,0 +1,91 @@ +############## mysql-test\t\event_scheduler_func.test ########################## +# # +# Variable Name: event_scheduler # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: OFF # +# Valid Values: ON, OFF & DISABLED # +# # +# # +# Creation Date: 2008-03-17 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "event_scheduler" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_event_scheduler # +# # +################################################################################ + +-- source include/not_embedded.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Setting initial value of event_scheduler to ON and verifying +# its behavior +#################################################################### + +--echo ## Setting initial value of variable to ON ## +SET @@global.event_scheduler = ON; +SELECT @@event_scheduler; + +--echo ## Creating new event ## +CREATE EVENT test_event_1 +ON SCHEDULE EVERY 3 SECOND +DO + INSERT into t1(name) values('Record_1'); + +--sleep 4 + +SELECT * from t1; + +DROP EVENT test_event_1; + +--sleep 1 +DELETE from t1; +select * from t1; + + +--echo '#--------------------FN_DYNVARS_018_02-------------------------#' +#################################################################### +# Setting initial value of event_scheduler to OFF and verifying +# its behavior +#################################################################### + +--echo ## Setting value of variable to OFF ## +SET @@global.event_scheduler = OFF; +SELECT @@event_scheduler; + +--echo ## Creating new event ## +CREATE EVENT test_event_1 +ON SCHEDULE EVERY 3 SECOND +DO + INSERT into t1(name) values('Record_2'); + +--sleep 4 + +--echo ## Table should be empty ## +SELECT * from t1; + +DROP EVENT test_event_1; +--echo ## Dropping table ## +DROP table t1; + diff --git a/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test new file mode 100644 index 00000000000..02448d1fd11 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/expire_logs_days_basic.test @@ -0,0 +1,179 @@ +############## mysql-test\t\expire_logs_days_basic.test ############### +# # +# Variable Name: expire_logs_days # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:0 # +# Range: 0-99 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable expire_logs_days # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +######################################################################## +# START OF expire_logs_days TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of expire_logs_days in a temporary variable # +######################################################################## + +SET @start_value = @@global.expire_logs_days; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_029_01------------------------#' +######################################################################## +# Display the DEFAULT value of expire_logs_days # +######################################################################## + +SET @@global.expire_logs_days = 99; +SET @@global.expire_logs_days = DEFAULT; +SELECT @@global.expire_logs_days; + + +--echo '#---------------------FN_DYNVARS_029_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.expire_logs_days = @start_value; +SELECT @@global.expire_logs_days = 0; + + +--echo '#--------------------FN_DYNVARS_029_03------------------------#' +######################################################################## +# Change the value of expire_logs_days to a valid value # +######################################################################## + +SET @@global.expire_logs_days = 0; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 99; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 10; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 21; +SELECT @@global.expire_logs_days; + + +--echo '#--------------------FN_DYNVARS_029_04-------------------------#' +########################################################################### +# Change the value of expire_logs_days to invalid value # +########################################################################### + +SET @@global.expire_logs_days = -1; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 100; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 1024; +SELECT @@global.expire_logs_days; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.expire_logs_days = 10000.01; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = -1024; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = 42949672950; +SELECT @@global.expire_logs_days; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.expire_logs_days = ON; +SELECT @@global.expire_logs_days; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.expire_logs_days = 'test'; +SELECT @@global.expire_logs_days; + + +--echo '#-------------------FN_DYNVARS_029_05----------------------------#' +########################################################################### +# Test if accessing session expire_logs_days gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.expire_logs_days = 0; +SELECT @@expire_logs_days; + + +--echo '#----------------------FN_DYNVARS_029_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.expire_logs_days = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='expire_logs_days'; + +SELECT @@expire_logs_days = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='expire_logs_days'; + + + +--echo '#---------------------FN_DYNVARS_029_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.expire_logs_days = TRUE; +SELECT @@global.expire_logs_days; +SET @@global.expire_logs_days = FALSE; +SELECT @@global.expire_logs_days; + + +--echo '#---------------------FN_DYNVARS_029_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.expire_logs_days = 1; +SELECT @@expire_logs_days = @@global.expire_logs_days; + + +--echo '#---------------------FN_DYNVARS_029_09----------------------#' +########################################################################## +# Check if expire_logs_days can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET expire_logs_days = 1; +SELECT @@expire_logs_days; +--Error ER_PARSE_ERROR +SET local.expire_logs_days = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.expire_logs_days; +--Error ER_PARSE_ERROR +SET global.expire_logs_days = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.expire_logs_days; +--Error ER_BAD_FIELD_ERROR +SELECT expire_logs_days = @@session.expire_logs_days; + + +############################## +# Restore initial value # +############################## + +SET @@global.expire_logs_days = @start_value; +SELECT @@global.expire_logs_days; + + +######################################################################## +# END OF expire_logs_days TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/flush_basic.test b/mysql-test/suite/sys_vars/t/flush_basic.test new file mode 100644 index 00000000000..f5f6665562e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/flush_basic.test @@ -0,0 +1,172 @@ +############## mysql-test\t\flush_basic.test ################################## +# # +# Variable Name: flush # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: OFF # +# Range: # +# # +# # +# Creation Date: 2008-02-09 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable flush # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-options.html#option_mysqld_flush # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF flush TESTS # +######################################################################## + + +############################################################# +# Saving initial value of flush in a temporary variable # +############################################################# + +SET @start_value = @@global.flush; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_030_01------------------------#' +############################################################# +# Display the DEFAULT value of flush # +############################################################# + +SET @@global.flush = ON; +--Error ER_NO_DEFAULT +SET @@global.flush = DEFAULT; +--echo 'Bug# 34878: FN_DYNVARS_002_01 - Default value is off according to Documentation of MySQL'; +SELECT @@global.flush; + + +--echo '#---------------------FN_DYNVARS_030_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.flush = @start_value; +SELECT @@global.flush; + + +--echo '#--------------------FN_DYNVARS_030_03------------------------#' +############################################################# +# Change the value of flush to a valid value # +############################################################# + +SET @@global.flush = ON; +SELECT @@global.flush; +SET @@global.flush = OFF; +SELECT @@global.flush; +SET @@global.flush = 0; +SELECT @@global.flush; +SET @@global.flush = 1; +SELECT @@global.flush; + + +--echo '#--------------------FN_DYNVARS_030_04-------------------------#' +########################################################################### +# Change the value of flush to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.flush = ''; + + +--echo '#-------------------FN_DYNVARS_030_05----------------------------#' +########################################################################### +# Test if accessing session flush gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.flush = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.flush; + + +--echo '#----------------------FN_DYNVARS_030_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.flush = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='flush'; + + +--echo '#---------------------FN_DYNVARS_030_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.flush = TRUE; +SELECT @@global.flush; +SET @@global.flush = FALSE; +SELECT @@global.flush; + + +--echo '#---------------------FN_DYNVARS_030_08----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.flush = 1; +SELECT @@flush = @@global.flush; + +--echo '#---------------------FN_DYNVARS_030_09----------------------#' +########################################################################## +# Check if flush can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET flush = 1; +--Error ER_PARSE_ERROR +SET global.flush = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.flush; +--Error ER_BAD_FIELD_ERROR +SELECT flush = @@session.flush; + + +############################## +# Restore initial value # +############################## + +SET @@global.flush = @start_value; +SELECT @@global.flush; + + +############################################################# +# END OF flush TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test new file mode 100644 index 00000000000..54d94aca971 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test @@ -0,0 +1,172 @@ +############## mysql-test\t\foreign_key_checks_basic.test ##################### +# # +# Variable Name: foreign_key_checks # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: NA # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable foreign_key_checks # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF foreign_key_checks TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of foreign_key_checks in a temporary variable # +################################################################################ + +SET @session_start_value = @@session.foreign_key_checks; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_032_01------------------------#' +######################################################################## +# Display the DEFAULT value of foreign_key_checks # +######################################################################## + +SET @@session.foreign_key_checks = 1; +SET @@session.foreign_key_checks = DEFAULT; +SELECT @@session.foreign_key_checks; + +--echo 'Bug# 34878: No DEFAULT value for variable. Also setting DEFAULT does not give error' + +--echo '#---------------------FN_DYNVARS_032_02-------------------------#' +############################################################################# +# Check if foreign_key_checks can be accessed with and without @@ sign # +############################################################################# + +SET foreign_key_checks = 1; +SELECT @@foreign_key_checks; + +--Error ER_UNKNOWN_TABLE +SELECT session.foreign_key_checks; + +--Error ER_UNKNOWN_TABLE +SELECT local.foreign_key_checks; + +SET session foreign_key_checks = 0; +SELECT @@session.foreign_key_checks; + + +--echo '#--------------------FN_DYNVARS_032_03------------------------#' +######################################################################## +# change the value of foreign_key_checks to a valid value # +######################################################################## + +SET @@session.foreign_key_checks = 0; +SELECT @@session.foreign_key_checks; +SET @@session.foreign_key_checks = 1; +SELECT @@session.foreign_key_checks; + + +--echo '#--------------------FN_DYNVARS_032_04-------------------------#' +########################################################################### +# Change the value of foreign_key_checks to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = ÕN; + +SET @@session.foreign_key_checks = OF; +SELECT @@session.foreign_key_checks; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.foreign_key_checks = NO; + + +--echo '#-------------------FN_DYNVARS_032_05----------------------------#' +########################################################################### +# Test if accessing global foreign_key_checks gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.foreign_key_checks = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.foreign_key_checks; + +--echo '#----------------------FN_DYNVARS_032_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='foreign_key_checks'; + +--echo '#----------------------FN_DYNVARS_032_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.foreign_key_checks = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='foreign_key_checks'; +SELECT @@session.foreign_key_checks; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='foreign_key_checks'; + + +--echo '#---------------------FN_DYNVARS_032_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.foreign_key_checks = OFF; +SELECT @@session.foreign_key_checks; +SET @@session.foreign_key_checks = ON; +SELECT @@session.foreign_key_checks; + +--echo '#---------------------FN_DYNVARS_032_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.foreign_key_checks = TRUE; +SELECT @@session.foreign_key_checks; +SET @@session.foreign_key_checks = FALSE; +SELECT @@session.foreign_key_checks; + +############################## +# Restore initial value # +############################## + +SET @@session.foreign_key_checks = @session_start_value; +SELECT @@session.foreign_key_checks; + +############################################################### +# END OF foreign_key_checks TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test new file mode 100644 index 00000000000..4d2c63bbce6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_func.test @@ -0,0 +1,139 @@ +############## mysql-test\t\foreign_key_checks_func.test ##################### +# # +# Variable Name: foreign_key_checks # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: NA # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable foreign_key_checks # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#--------------------FN_DYNVARS_032_01-------------------------#' +#################################################################### +# Check if setting foreign_key_checks is changed in new connection # +#################################################################### + +SET @@session.foreign_key_checks = 0; +# con1 will be default connection from now on +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@session.foreign_key_checks; +SET @@session.foreign_key_checks = 1; +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +--echo 'connection con2' +connection con2; +SELECT @@session.foreign_key_checks; +disconnect con2; + +--echo '#--------------------FN_DYNVARS_032_02-------------------------#' +################################################################# +# Begin the functionality Testing of foreign_key_checks # +################################################################# + +--echo 'connection con1' +connection con1; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +CREATE TABLE t1(a INT PRIMARY KEY)ENGINE = INNODB; +CREATE TABLE t2(a INT PRIMARY KEY,b INT)ENGINE = INNODB; + +ALTER TABLE t2 +ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a); + +#=========================================================== +--echo '---Check when foreign_key_checks is enabled---' +#=========================================================== + + +SET @@session.foreign_key_checks = 1; + +INSERT INTO t1 values (1),(2),(3); + +INSERT INTO t2 values (10,1); +--Error ER_NO_REFERENCED_ROW_2 +INSERT INTO t2 values (20,22); + +#=========================================================== +--echo '---Check when foreign_key_checks is disabled---' +#=========================================================== + +--Error ER_ROW_IS_REFERENCED_2 +TRUNCATE t1; + +SET @@session.foreign_key_checks = 0; + +TRUNCATE t1; +TRUNCATE t2; + +INSERT INTO t1 values (1),(2),(3); + +INSERT INTO t2 values (10,1); +INSERT INTO t2 values (20,4); + +--echo 'try enabling foreign_key_checks again'; +SET @@session.foreign_key_checks = 1; + +UPDATE t2 SET b=4 where a=20; +--echo 'Bug#35358: Updating an incorrect foreign key(inserted by disabling ' +--echo 'foreign_key_checks)to the same value does not raise error after ' +--echo 'enabling foreign_key_checks' + +#============================================================================== +--echo 'Check when foreign_key_checks is enabled and FK constraint is re-created' +#============================================================================== + +SET @@session.foreign_key_checks = 0; +TRUNCATE t2; +TRUNCATE t1; + +INSERT INTO t1 values (1),(2),(3); +INSERT INTO t2 values (10,1),(20,4); + +ALTER TABLE t2 DROP FOREIGN KEY fk; + +SET @@session.foreign_key_checks = 1; + +# Test disabled as error description is different. The resulting description has +# difference in code #sql-xxx_2 where xxx is different for each run. +#--Error ER_NO_REFERENCED_ROW_2 +#ALTER TABLE t2 +#ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a); + +# delete all rows with incorrect reference +DELETE FROM t2 WHERE b not in (SELECT a from t1); + +ALTER TABLE t2 +ADD CONSTRAINT fk FOREIGN KEY (b) REFERENCES t1 (a); + +INSERT INTO t2 values (20,2); + +SELECT * from t2; + +--disable_warnings +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t1; +--enable_warnings + +########################################################## +# End of functionality Testing for foreign_key_checks # +########################################################## + diff --git a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test new file mode 100644 index 00000000000..4117605c452 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test @@ -0,0 +1,162 @@ +############## mysql-test\t\ft_boolean_syntax_basic.test ###################### +# # +# Variable Name: ft_boolean_syntax # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: +-><()~*:""& # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable ft_boolean_syntax # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################### +## START OF ft_boolean_syntax TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# +# save using implicit session scope +SET @global_start_value = @@global.ft_boolean_syntax; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_033_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT ft_boolean_syntax; +# access using no scope specified +SELECT @@ft_boolean_syntax; +# assign value without @@ +SET @@global.ft_boolean_syntax='+ -><()~*:""&|'; +SELECT @@global.ft_boolean_syntax; +# using another syntax for accessing session variable +SET global ft_boolean_syntax='$ -><()`*:""&|'; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT global ft_boolean_syntax; + +--echo '#--------------------FN_DYNVARS_033_02-------------------------#' +####################################################################### +# Check the DEFAULT value of ft_boolean_syntax for global # +####################################################################### +SET @@global.ft_boolean_syntax = '# -><()!*:""&|'; +SET @@global.ft_boolean_syntax = DEFAULT; +SELECT @@global.ft_boolean_syntax; + +--echo '#--------------------FN_DYNVARS_033_03-------------------------#' +###################################################################### +# see if it is accessable using session scope # +###################################################################### +--Error ER_GLOBAL_VARIABLE +SET @@session.ft_boolean_syntax = '# -><()!*:""&|'; +--Error ER_GLOBAL_VARIABLE +SET @@ft_boolean_syntax = '# -><()!*:""&|'; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.ft_boolean_syntax; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.ft_boolean_syntax; + +--echo '#--------------------FN_DYNVARS_033_04-------------------------#' +############################################################################## +# Change the value of ft_boolean_syntax to a valid value # +############################################################################## + +SET @@global.ft_boolean_syntax='+ -><()~*:""&|'; +SELECT @@global.ft_boolean_syntax; + +SET @@global.ft_boolean_syntax=' +-><()~*:""&|'; +SELECT @@global.ft_boolean_syntax; + +SET @@global.ft_boolean_syntax=' -+()<>~*:``&|'; +SELECT @@global.ft_boolean_syntax; + +SET @@global.ft_boolean_syntax='+ -><()~*:""@!'; +SELECT @@global.ft_boolean_syntax; + +SET @@global.ft_boolean_syntax=" +-><()~*:''&|"; +SELECT @@global.ft_boolean_syntax; + +SET @@global.ft_boolean_syntax=' ~/!@#$%^&*()-'; +SELECT @@global.ft_boolean_syntax; + +--echo '#--------------------FN_DYNVARS_033_05-------------------------#' +############################################################################### +# Change the value of ft_boolean_syntax to an invalid value for global # +############################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '+-> <()~*:""&|'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '0'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '1 -><()~*:11&|'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '# -><()~*:11&1'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '1234567890ABCD'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.ft_boolean_syntax = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = '+-> <((~*:".&|'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.ft_boolean_syntax = true; +--Error ER_PARSE_ERROR +SET @@global.ft_boolean_syntax = + -><()~*:""&|; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = ENABLE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = 'IGNORE'; + +--echo '#--------------------FN_DYNVARS_033_06-------------------------#' +############################################################################# +# Check if the value in GLOBAL Table matches value in variable # +############################################################################# +SELECT @@global.ft_boolean_syntax = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ft_boolean_syntax') AS res; + + +--echo '#--------------------FN_DYNVARS_033_07-------------------------#' +############################################################################# +# Assigning value from a temporary variable # +############################################################################# +# Content of initial variable +SELECT @global_start_value; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.ft_boolean_syntax = @global_start_value; +--echo 'Bug# 34883: ft_boolean_syntax cant be assigned values from session temporary'; +--echo 'variables'; + +#################################### +# Restore Default value # +#################################### +#restoring to default as we cant assign the initial value +SET @@global.ft_boolean_syntax = DEFAULT; +SELECT @@global.ft_boolean_syntax; + +########################################################## +# END OF ft_boolean_syntax TESTS # +########################################################## diff --git a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test new file mode 100644 index 00000000000..4ea28b015cb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_func.test @@ -0,0 +1,126 @@ +############## mysql-test\t\ft_boolean_syntax_func.test ###################### +# # +# Variable Name: ft_boolean_syntax # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: + -><()~*:""& # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable ft_boolean_syntax # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--echo '#--------------------FN_DYNVARS_033_01-------------------------#' +################################################################### +# Check if setting ft_boolean_syntax is changed in new connection # +################################################################### + +SET @@global.ft_boolean_syntax = ' -+()<>~*:``&|'; +# con1 will be default connection from now on +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.ft_boolean_syntax; +SET @@global.ft_boolean_syntax = '+ -><()~*:""&|'; +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +--echo 'connection con2' +connection con2; +SELECT @@global.ft_boolean_syntax; +disconnect con2; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_033_02-------------------------#' +######################################################### +# Begin the functionality Testing of ft_boolean_syntax # +######################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE articles ( + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +); + +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'), +('How To',''), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show .... Run command line ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('100 Tips for Myisam','1. Myisam is faster than innodb 2. Tricks and Tips for Myisam...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'), +('Database Security','Configuring MySQL for ...'); + +SET @@global.ft_boolean_syntax = DEFAULT; + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+mySQL -yourSQL' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MySQL' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('mysql tutorial dbms' IN BOOLEAN MODE); + +SELECT id,title,body, (MATCH (title,body) +AGAINST ('+security configuring' IN BOOLEAN MODE)) AS relevance +FROM articles WHERE MATCH (title,body) +AGAINST ('+security configuring' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('"faster than"' IN BOOLEAN MODE); + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+run ~line' IN BOOLEAN MODE); + +--Echo 'Bug#35359: ~ is not working correctly. Its behaving like -' + +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('10*' IN BOOLEAN MODE); + +--Echo 'Bug#35360: * is not working correctly. Not all rows are returned' + +SELECT id,title,body, (MATCH (title,body) +AGAINST ('+MySQL +(>show <dbms)' IN BOOLEAN MODE)) AS relevance +FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +(>show <dbms)' IN BOOLEAN MODE) +ORDER BY relevance DESC; + +#============================================================================== +--echo '---try setting different operators. Default '+ -><()~*:""&|'--' +#============================================================================== +SET @@global.ft_boolean_syntax='~ /!@#$%^&*()-'; +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('~mySQL /yourSQL' IN BOOLEAN MODE); + +--echo 'Bug#35361: Different syntax does not produce result as default operators' + +#restore default +SET @@global.ft_boolean_syntax=DEFAULT; + +######################################################### +# End of functionality Testing for ft_boolean_syntax # +######################################################### +DROP TABLE articles; + diff --git a/mysql-test/suite/sys_vars/t/general_log_basic.test b/mysql-test/suite/sys_vars/t/general_log_basic.test new file mode 100644 index 00000000000..82f3be45bc9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_basic.test @@ -0,0 +1,169 @@ +######################## mysql-test\t\general_log_basic.test ################### +# # +# Variable Name: general_log # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-03-14 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "general_log" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-options.html#option_mysqld_event-scheduler # +# # +################################################################################ + + +########################################################### +# START OF general_log TESTS # +########################################################### + + +################################################################### +# Saving initial value of general_log in a temporary variable # +################################################################### + +SET @start_value = @@global.general_log; +SELECT @start_value; + + +--echo '#---------------------FN_DYNVARS_004_01-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.general_log = DEFAULT; +SELECT @@global.general_log = 0; + + +--echo '#--------------------FN_DYNVARS_004_02------------------------#' +####################################################################### +# Change the value of general_log to a valid value # +####################################################################### + +SET @@global.general_log = ON; +SELECT @@global.general_log; +SET @@global.general_log = OFF; +SELECT @@global.general_log; + +--echo '#--------------------FN_DYNVARS_004_03-------------------------#' +####################################################################### +# Change the value of general_log to invalid value # +####################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log = ''; + + +--echo '#-------------------FN_DYNVARS_004_04----------------------------#' +################################################################### +# Test if accessing session general_log gives error # +################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.general_log = OFF; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.general_log; + + +--echo '#----------------------FN_DYNVARS_004_05------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.general_log = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='general_log'; + + +--echo '#---------------------FN_DYNVARS_004_06----------------------#' +################################################################### +# Check if 0 and 1 values can be used on variable # +################################################################### + +SET @@global.general_log = 0; +SELECT @@global.general_log; +SET @@global.general_log = 1; +SELECT @@global.general_log; + +--echo '#---------------------FN_DYNVARS_004_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.general_log = TRUE; +SELECT @@global.general_log; +SET @@global.general_log = FALSE; +SELECT @@global.general_log; + +--echo '#---------------------FN_DYNVARS_004_08----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@global.general_log = ON; +SELECT @@general_log = @@global.general_log; + +--echo '#---------------------FN_DYNVARS_004_09----------------------#' +####################################################################### +# Check if general_log can be accessed with and without @@ sign # +####################################################################### +--Error ER_GLOBAL_VARIABLE +SET general_log = ON; +--Error ER_PARSE_ERROR +SET local.general_log = OFF; +--Error ER_UNKNOWN_TABLE +SELECT local.general_log; +--Error ER_PARSE_ERROR +SET global.general_log = ON; +--Error ER_UNKNOWN_TABLE +SELECT global.general_log; +--Error ER_BAD_FIELD_ERROR +SELECT general_log = @@session.general_log; + + + +############################## +# Restore initial value # +############################## + +SET @@global.general_log = @start_value; +SELECT @@global.general_log; + + +##################################################### +# END OF general_log TESTS # +##################################################### diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt new file mode 100644 index 00000000000..8482f8cbbc3 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic-master.opt @@ -0,0 +1 @@ +--log=test.log diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test new file mode 100644 index 00000000000..014108f88d2 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -0,0 +1,76 @@ +################### mysql-test\t\general_log_file_basic.test ################### +# # +# Variable Name: general_log_file # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Filename # +# Default Value: host_name.log # +# Valid Values: # +# # +# # +# Creation Date: 2008-03-16 # +# Author: Salman Rawala # +# Modified: HHunger 2008-09-11 Set system variable back to the start value # +# # +# Description: Test Cases of Dynamic System Variable "general_log_file" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ + +--source include/load_sysvars.inc + +########################################################### +# START OF general_log_file TESTS # +########################################################### + + +######################################################################## +# Saving initial value of general_log_file in a temporary variable # +######################################################################## + +SET @start_value = @@global.general_log_file; +SELECT @start_value; + + +--echo '#---------------------FN_DYNVARS_004_01-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.general_log_file = DEFAULT; +SELECT RIGHT(@@global.general_log_file,10) AS log_file; + + +--echo '#--------------------FN_DYNVARS_004_02------------------------#' +####################################################################### +# Change the value of general_log_file to a invalid value # +####################################################################### + +# Assumed text if no quotes or numbers. +SET @@global.general_log_file = mytest.log; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.general_log_file = 12; + + +--echo '#----------------------FN_DYNVARS_004_03------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.general_log_file = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='general_log_file'; + +SET @@global.general_log_file= @start_value; + +##################################################### +# END OF general_log_file TESTS # +##################################################### + diff --git a/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt new file mode 100644 index 00000000000..3652d715f5f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_file_func-master.opt @@ -0,0 +1,2 @@ +--log=mysql-test.log + diff --git a/mysql-test/suite/sys_vars/t/general_log_file_func.test b/mysql-test/suite/sys_vars/t/general_log_file_func.test new file mode 100644 index 00000000000..1a73a4a5eaa --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_file_func.test @@ -0,0 +1,56 @@ +############## mysql-test\t\general_log_file_func.test ######################### +# # +# Variable Name: general_log_file # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: filename # +# Valid Values: # +# # +# # +# Creation Date: 2008-03-17 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "general_log_file" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_general_log_file # +# # +################################################################################ + + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Verifying general log as we have initialized in opt file # +#################################################################### +SELECT @@general_log_file; + +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +INSERT INTO t1(name) VALUES('Record_4'); + +--echo ## Verifying general log file ## +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/mysql-test.log + +--echo ## Dropping table ## +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/general_log_func.test b/mysql-test/suite/sys_vars/t/general_log_func.test new file mode 100644 index 00000000000..24d535e88e5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/general_log_func.test @@ -0,0 +1,93 @@ +################# mysql-test\t\general_log_func.test ########################### +# # +# Variable Name: general_log # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-03-17 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "general_log" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_general_log # +# # +################################################################################ + + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Setting initial value of general_log to OFF and verifying +# its behavior +#################################################################### + +--echo ## Setting initial value of variable to OFF ## +SET @@global.general_log = OFF; +SELECT @@general_log; + + +let $MYSQLD_LOGFILE= `select @@global.general_log_file`; +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy + +--echo ## Inserting some Records & Verifying output in log ## +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); + +--echo ## There should be no difference, case should pass ## +--diff_files $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy +--remove_file $MYSQLD_LOGFILE.copy + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Setting initial value of general_log to ON and verifying +# its behavior +#################################################################### + +--echo ## Setting initial value of variable to OFF ## +SET @@global.general_log = ON; +SELECT @@general_log; + +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy +--chmod 0777 $MYSQLD_LOGFILE.copy + +--echo ## Inserting some Records & Verifying output in log ## +INSERT into t1(name) values('Record_3'); +INSERT into t1(name) values('Record_4'); + +--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.orig +--chmod 0777 $MYSQLD_LOGFILE.orig + +--echo ## There should be a difference ## +SET @@global.max_allowed_packet= 1024*1024*1024; +--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE +eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig'); +--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE +eval SET @copy_file= load_file('$MYSQLD_LOGFILE.copy'); +eval SELECT STRCMP(@orig_file, @copy_file); +--remove_file $MYSQLD_LOGFILE.copy +--remove_file $MYSQLD_LOGFILE.orig + +--echo ## Dropping tables ## +DROP TABLE t1; + diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test new file mode 100644 index 00000000000..1bc707f4b5d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_basic.test @@ -0,0 +1,206 @@ +############## mysql-test\t\group_concat_max_len_basic.test ############### +# # +# Variable Name: group_concat_max_len # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 1024 # +# Minimum value: 4 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable group_concat_max_len # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF group_concat_max_len TESTS # +######################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.group_concat_max_len; +SELECT @start_global_value; +SET @start_session_value = @@session.group_concat_max_len; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_034_01-------------------------#' +######################################################################## +# Display the DEFAULT value of group_concat_max_len # +######################################################################## + +SET @@global.group_concat_max_len = 100; +SET @@global.group_concat_max_len = DEFAULT; +SELECT @@global.group_concat_max_len; + +SET @@session.group_concat_max_len = 200; +SET @@session.group_concat_max_len = DEFAULT; +SELECT @@session.group_concat_max_len; + + +--echo '#--------------------FN_DYNVARS_034_02-------------------------#' +######################################################################## +# Check the DEFAULT value of group_concat_max_len # +######################################################################## + +SET @@global.group_concat_max_len = DEFAULT; +SELECT @@global.group_concat_max_len = 1; + +SET @@session.group_concat_max_len = DEFAULT; +SELECT @@session.group_concat_max_len = 1; + + +--echo '#--------------------FN_DYNVARS_034_03-------------------------#' +################################################################################## +# Change the value of group_concat_max_len to a valid value for GLOBAL Scope # +################################################################################## + +SET @@global.group_concat_max_len = 1; +SELECT @@global.group_concat_max_len; +SET @@global.group_concat_max_len = 60020; +SELECT @@global.group_concat_max_len; +SET @@global.group_concat_max_len = 65535; +SELECT @@global.group_concat_max_len; + + +--echo '#--------------------FN_DYNVARS_034_04-------------------------#' +################################################################################### +# Change the value of group_concat_max_len to a valid value for SESSION Scope # +################################################################################### + +SET @@session.group_concat_max_len = 1; +SELECT @@session.group_concat_max_len; +SET @@session.group_concat_max_len = 50050; +SELECT @@session.group_concat_max_len; +SET @@session.group_concat_max_len = 65535; +SELECT @@session.group_concat_max_len; + + +--echo '#------------------FN_DYNVARS_034_05-----------------------#' +#################################################################### +# Change the value of group_concat_max_len to an invalid value # +#################################################################### + +SET @@global.group_concat_max_len = 0; +SELECT @@global.group_concat_max_len; +SET @@global.group_concat_max_len = -1024; +SELECT @@global.group_concat_max_len; +SET @@global.group_concat_max_len = 65536; +SELECT @@global.group_concat_max_len; +--Error ER_PARSE_ERROR +SET @@global.group_concat_max_len = 65530.34.; +SELECT @@global.group_concat_max_len; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.group_concat_max_len = test; +SELECT @@global.group_concat_max_len; + +SET @@session.group_concat_max_len = 0; +SELECT @@session.group_concat_max_len; +SET @@session.group_concat_max_len = -2; +SELECT @@session.group_concat_max_len; +--Error ER_PARSE_ERROR +SET @@session.group_concat_max_len = 65530.34.; +SET @@session.group_concat_max_len = 65550; +SELECT @@session.group_concat_max_len; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.group_concat_max_len = test; +SELECT @@session.group_concat_max_len; + + +--echo '#------------------FN_DYNVARS_034_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.group_concat_max_len = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='group_concat_max_len'; + +--echo '#------------------FN_DYNVARS_034_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.group_concat_max_len = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='group_concat_max_len'; + + +--echo '#------------------FN_DYNVARS_034_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.group_concat_max_len = TRUE; +SELECT @@global.group_concat_max_len; +SET @@global.group_concat_max_len = FALSE; +SELECT @@global.group_concat_max_len; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.group_concat_max_len = 10; +SELECT @@group_concat_max_len = @@global.group_concat_max_len; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@group_concat_max_len = 100; +SELECT @@group_concat_max_len = @@local.group_concat_max_len; +SELECT @@local.group_concat_max_len = @@session.group_concat_max_len; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +################################################################################### +# Check if group_concat_max_len can be accessed with and without @@ sign # +################################################################################### + +SET group_concat_max_len = 1; +SELECT @@group_concat_max_len; +--Error ER_UNKNOWN_TABLE +SELECT local.group_concat_max_len; +--Error ER_UNKNOWN_TABLE +SELECT session.group_concat_max_len; +--Error ER_BAD_FIELD_ERROR +SELECT group_concat_max_len = @@session.group_concat_max_len; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.group_concat_max_len = @start_global_value; +SELECT @@global.group_concat_max_len; +SET @@session.group_concat_max_len = @start_session_value; +SELECT @@session.group_concat_max_len; + + +############################################################# +# END OF group_concat_max_len TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test new file mode 100644 index 00000000000..29a4ff5becb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/group_concat_max_len_func.test @@ -0,0 +1,140 @@ +############## mysql-test\t\group_concat_max_len_func.test #################### +# # +# Variable Name: group_concat_max_len # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 1024 # +# Minimum value: 4 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Last modification: # +# 2008-11-14 mleich Fix Bug#40644 main.group_concat_max_len_func random # +# failures # +# + minor improvements # +# # +# Description: Test Cases of Dynamic System Variable group_concat_max_len # +# that checks the functionality of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +SET @save = @@global.group_concat_max_len; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id), +rollno INT NOT NULL, +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_034_01-------------------------#' +######################################################################## +# Setting initial value of group_concat_max_len, inserting some rows +# & creating 2 new connections +######################################################################## + +--echo ## Setting initial value of variable to 4 ## +SET @@global.group_concat_max_len = 4; + +--echo ## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(1, 'Record_1'); +INSERT INTO t1(rollno, name) VALUES(2, 'Record_2'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_3'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_4'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_5'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_6'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_7'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_8'); +# The following "auxiliary" select ensures that all records are on disk +# = result sets got by parallel sessions cannot suffer from effects +# caused by the MyISAM feature "concurrent_inserts". +SELECT * FROM t1 ORDER BY id; + +--echo ## Creating two new connections ## +connect (test_con1,localhost,root,,); +connect (test_con2,localhost,root,,); + + +--echo '#--------------------FN_DYNVARS_034_02-------------------------#' +############################################################################### +# Verifying initial behavior of variable by concatinating values greater than 4 +############################################################################### + +--echo ## Connecting with test_con1 ## +connection test_con1; + +--echo ## Accessing data and using group_concat on column whose value is greater than 4 ## +SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno; + +--echo ## Changing session value of variable and verifying its behavior, ## +--echo ## warning should come here ## + +SET @@session.group_concat_max_len = 10; +SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno; + + +--echo '#--------------------FN_DYNVARS_034_03-------------------------#' +############################################################################## +# Verifying behavior of variable by increasing session value of variable # +############################################################################## + +--echo ## Connecting with new connection test_con2 ## +connection test_con2; + +--echo ## Verifying initial value of variable. It should be 4 ## +SELECT @@session.group_concat_max_len = 4; + +--echo ## Setting session value of variable to 20 and verifying variable is concating ## +--echo ## column's value to 20 or not ## +SET @@session.group_concat_max_len = 20; + +--echo ## Verifying value of name column, it should not me more than 20 characters ## +--echo ## Warning should come here ## +SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno; + + +--echo '#--------------------FN_DYNVARS_034_04-------------------------#' +############################################################################### +# Verifying behavior of variable by increasing session value of variable # +# greater than the maximum concat length of name column # +############################################################################### + +--echo ## Setting session value of variable to 26. No warning should appear here ## +--echo ## because the value after concatination is less than 30 ## +SET @@session.group_concat_max_len = 26; + +--echo ## Verifying value of name column, it should not give warning now ## +SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno; + + +############################################################ +# Disconnecting all connection & dropping table # +############################################################ + +--echo ## Dropping table t1 ## +DROP TABLE t1; + +--echo ## Disconnecting both the connection ## +disconnect test_con2; +disconnect test_con1; + +connection default; + +SET @@global.group_concat_max_len = @save; + diff --git a/mysql-test/suite/sys_vars/t/have_compress_basic.test b/mysql-test/suite/sys_vars/t/have_compress_basic.test new file mode 100644 index 00000000000..f704ae67a1c --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_compress_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_compress_basic.test ###################### +# # +# Variable Name: have_compress # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_compress # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_006_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_compress); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_006_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_compress=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_compress); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_006_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_compress = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_compress'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_compress); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_compress'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_006_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_compress = @@GLOBAL.have_compress; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_006_05----------------------#' +################################################################################ +# Check if have_compress can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_compress); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_compress); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_compress); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_compress); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_compress = @@SESSION.have_compress; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_crypt_basic.test b/mysql-test/suite/sys_vars/t/have_crypt_basic.test new file mode 100644 index 00000000000..7ca193d83bd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_crypt_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_crypt_basic.test ######################### +# # +# Variable Name: have_crypt # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_crypt # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_007_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_crypt); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_007_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_crypt=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_crypt); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_007_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_crypt = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_crypt'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_crypt); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_crypt'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_007_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_crypt = @@GLOBAL.have_crypt; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_007_05----------------------#' +################################################################################ +# Check if have_crypt can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_crypt); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_crypt); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_crypt); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_crypt); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_crypt = @@SESSION.have_crypt; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_csv_basic.test b/mysql-test/suite/sys_vars/t/have_csv_basic.test new file mode 100644 index 00000000000..12081ff270e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_csv_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_csv_basic.test ########################### +# # +# Variable Name: have_csv # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_csv # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_008_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_csv); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_008_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_csv=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_csv); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_008_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_csv = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_csv'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_csv); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_csv'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_008_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_csv = @@GLOBAL.have_csv; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_008_05----------------------#' +################################################################################ +# Check if have_csv can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_csv); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_csv); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_csv); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_csv); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_csv = @@SESSION.have_csv; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test new file mode 100644 index 00000000000..3e13664752a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_dynamic_loading_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_dynamic_loading_basic.test ############### +# # +# Variable Name: have_dynamic_loading # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_dynamic_loading # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_009_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_dynamic_loading); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_009_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_dynamic_loading=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_dynamic_loading); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_009_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_dynamic_loading = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_dynamic_loading'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_dynamic_loading); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_dynamic_loading'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_009_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_dynamic_loading = @@GLOBAL.have_dynamic_loading; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_009_05----------------------#' +################################################################################ +# Check if have_dynamic_loading can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_dynamic_loading); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_dynamic_loading); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_dynamic_loading); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_dynamic_loading); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_dynamic_loading = @@SESSION.have_dynamic_loading; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_geometry_basic.test b/mysql-test/suite/sys_vars/t/have_geometry_basic.test new file mode 100644 index 00000000000..3ec0690bd16 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_geometry_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_geometry_basic.test ###################### +# # +# Variable Name: have_geometry # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_geometry # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_010_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_geometry); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_010_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_geometry=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_geometry); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_010_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_geometry = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_geometry'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_geometry); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_geometry'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_010_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_geometry = @@GLOBAL.have_geometry; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_010_05----------------------#' +################################################################################ +# Check if have_geometry can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_geometry); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_geometry); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_geometry); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_geometry); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_geometry = @@SESSION.have_geometry; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_innodb_basic.test b/mysql-test/suite/sys_vars/t/have_innodb_basic.test new file mode 100644 index 00000000000..9ae1bb0d443 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_innodb_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_innodb_basic.test ######################## +# # +# Variable Name: have_innodb # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_innodb # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_011_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_innodb); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_011_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_innodb=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_innodb); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_011_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_innodb = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_innodb'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_innodb); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_innodb'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_011_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_innodb = @@GLOBAL.have_innodb; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_011_05----------------------#' +################################################################################ +# Check if have_innodb can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_innodb); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_innodb); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_innodb); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_innodb); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_innodb = @@SESSION.have_innodb; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_ndbcluster_basic.test b/mysql-test/suite/sys_vars/t/have_ndbcluster_basic.test new file mode 100644 index 00000000000..1ac341ff62e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_ndbcluster_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_ndbcluster_basic.test #################### +# # +# Variable Name: have_ndbcluster # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_ndbcluster # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_012_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_ndbcluster); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_012_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_ndbcluster=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_ndbcluster); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_012_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_ndbcluster = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_ndbcluster'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_ndbcluster); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_ndbcluster'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_012_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_ndbcluster = @@GLOBAL.have_ndbcluster; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_012_05----------------------#' +################################################################################ +# Check if have_ndbcluster can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_ndbcluster); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_ndbcluster); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_ndbcluster); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_ndbcluster); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_ndbcluster = @@SESSION.have_ndbcluster; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_openssl_basic.test b/mysql-test/suite/sys_vars/t/have_openssl_basic.test new file mode 100644 index 00000000000..037c8f4cbe6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_openssl_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_openssl_basic.test ####################### +# # +# Variable Name: have_openssl # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_openssl # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_013_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_openssl); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_013_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_openssl=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_openssl); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_013_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_openssl = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_openssl'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_openssl); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_openssl'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_013_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_openssl = @@GLOBAL.have_openssl; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_013_05----------------------#' +################################################################################ +# Check if have_openssl can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_openssl); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_openssl); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_openssl); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_openssl); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_openssl = @@SESSION.have_openssl; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_partitioning_basic.test b/mysql-test/suite/sys_vars/t/have_partitioning_basic.test new file mode 100644 index 00000000000..b37abdb1498 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_partitioning_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_partitioning_basic.test ################## +# # +# Variable Name: have_partitioning # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_partitioning # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_014_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_partitioning); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_014_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_partitioning=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_partitioning); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_014_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_partitioning = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_partitioning'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_partitioning); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_partitioning'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_014_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_partitioning = @@GLOBAL.have_partitioning; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_014_05----------------------#' +################################################################################ +# Check if have_partitioning can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_partitioning); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_partitioning); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_partitioning); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_partitioning); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_partitioning = @@SESSION.have_partitioning; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_query_cache_basic.test b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test new file mode 100644 index 00000000000..1c32300dec9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_query_cache_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_query_cache_basic.test ################### +# # +# Variable Name: have_query_cache # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_query_cache # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_015_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_query_cache); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_015_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_query_cache=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_query_cache); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_015_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_query_cache = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_query_cache'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_query_cache); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_query_cache'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_015_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_query_cache = @@GLOBAL.have_query_cache; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_015_05----------------------#' +################################################################################ +# Check if have_query_cache can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_query_cache); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_query_cache); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_query_cache); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_query_cache); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_query_cache = @@SESSION.have_query_cache; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test new file mode 100644 index 00000000000..493c45530a6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_rtree_keys_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_rtree_keys_basic.test #################### +# # +# Variable Name: have_rtree_keys # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_rtree_keys # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_016_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_rtree_keys); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_016_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_rtree_keys=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_rtree_keys); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_016_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_rtree_keys = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_rtree_keys'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_rtree_keys); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_rtree_keys'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_016_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_rtree_keys = @@GLOBAL.have_rtree_keys; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_016_05----------------------#' +################################################################################ +# Check if have_rtree_keys can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_rtree_keys); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_rtree_keys); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_rtree_keys); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_rtree_keys); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_rtree_keys = @@SESSION.have_rtree_keys; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_ssl_basic.test b/mysql-test/suite/sys_vars/t/have_ssl_basic.test new file mode 100644 index 00000000000..c92219d2252 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_ssl_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_ssl_basic.test ########################### +# # +# Variable Name: have_ssl # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_ssl # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_017_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_ssl); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_017_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_ssl=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_ssl); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_017_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_ssl = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_ssl'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_ssl); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_ssl'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_017_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_ssl = @@GLOBAL.have_ssl; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_017_05----------------------#' +################################################################################ +# Check if have_ssl can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_ssl); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_ssl); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_ssl); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_ssl); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_ssl = @@SESSION.have_ssl; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/have_symlink_basic.test b/mysql-test/suite/sys_vars/t/have_symlink_basic.test new file mode 100644 index 00000000000..924da7c7a9f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/have_symlink_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\have_symlink_basic.test ####################### +# # +# Variable Name: have_symlink # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable have_symlink # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_018_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.have_symlink); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_018_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.have_symlink=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.have_symlink); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_018_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.have_symlink = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_symlink'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.have_symlink); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='have_symlink'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_018_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@have_symlink = @@GLOBAL.have_symlink; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_018_05----------------------#' +################################################################################ +# Check if have_symlink can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@have_symlink); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.have_symlink); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.have_symlink); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.have_symlink); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT have_symlink = @@SESSION.have_symlink; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/hostname_basic.test b/mysql-test/suite/sys_vars/t/hostname_basic.test new file mode 100644 index 00000000000..9f1dff756e2 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/hostname_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\hostname_basic.test ########################### +# # +# Variable Name: hostname # +# Scope: Global # +# Access Type: Static # +# Data Type: string # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable hostname # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_019_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.hostname); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_019_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.hostname=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.hostname); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_019_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.hostname = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='hostname'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.hostname); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='hostname'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_019_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@hostname = @@GLOBAL.hostname; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_019_05----------------------#' +################################################################################ +# Check if hostname can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@hostname); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.hostname); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.hostname); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.hostname); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT hostname = @@SESSION.hostname; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/identity_basic.test b/mysql-test/suite/sys_vars/t/identity_basic.test new file mode 100644 index 00000000000..fa5fc807414 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/identity_basic.test @@ -0,0 +1,189 @@ +############## mysql-test\t\identity_basic.test ############### +# # +# Variable Name: identity # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: - # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable identity # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################################ +# START OF identity TESTS # +################################################################ + + +################################################################ +# Saving initial value of identity in a temporary variable # +################################################################ + +SET @start_value = @@session.identity; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_035_01------------------------#' +######################################################################## +# Display the DEFAULT value of identity # +######################################################################## + +SET @@session.identity = 99; +# SET @@session.identity = DEFAULT; +--echo 'Variable is giving error on assigning Default value'; +SELECT @@session.identity; + + +--echo '#---------------------FN_DYNVARS_035_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@session.identity = @start_value; +SELECT @@session.identity = 0; + + +--echo '#--------------------FN_DYNVARS_035_03------------------------#' +######################################################################## +# Change the value of identity to a valid value # +######################################################################## + +SET @@session.identity = 0; +SELECT @@session.identity; +SET @@session.identity = 1099; +SELECT @@session.identity; +SET @@session.identity = 1800; +SELECT @@session.identity; +SET @@session.identity = 65535; +SELECT @@session.identity; + + +--echo '#--------------------FN_DYNVARS_035_04-------------------------#' +########################################################################### +# Change the value of identity to invalid value # +########################################################################### + +SET @@session.identity = -1; +SELECT @@session.identity; +SET @@session.identity = 100000000000; +SELECT @@session.identity; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.identity = 10000.01; +SELECT @@session.identity; +SET @@session.identity = -1024; +SELECT @@session.identity; +SET @@session.identity = 42949672950; +SELECT @@session.identity; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.identity = ON; +SELECT @@session.identity; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.identity = 'test'; +SELECT @@session.identity; + + +--echo '#-------------------FN_DYNVARS_035_05----------------------------#' +########################################################################### +# Test if accessing global identity gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.identity = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.identity; + + +--echo '#----------------------FN_DYNVARS_035_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.identity = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='identity'; + +SELECT @@session.identity = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='identity'; + + +--echo '#-------------------FN_DYNVARS_035_07----------------------------#' +###################################################################### +# Test if accessing GLOBAL identity gives error # +###################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.identity = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.identity; + +--echo '#---------------------FN_DYNVARS_035_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.identity = TRUE; +SELECT @@session.identity; +SET @@session.identity = FALSE; +SELECT @@session.identity; + + +--echo '#---------------------FN_DYNVARS_035_09----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@session.identity = 1; +SELECT @@identity = @@session.identity; +SELECT @@session.identity = @@local.identity; + + +--echo '#---------------------FN_DYNVARS_035_10----------------------#' +########################################################################## +# Check if identity can be accessed with and without @@ sign # +########################################################################## + + +SET identity = 1; +SELECT @@identity; +--Error ER_PARSE_ERROR +SET local.identity = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.identity; +--Error ER_PARSE_ERROR +SET session.identity = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.identity; +--Error ER_BAD_FIELD_ERROR +SELECT identity = @@session.identity; + + +############################## +# Restore initial value # +############################## + +SET @@session.identity = @start_value; +SELECT @@session.identity; + + +######################################################################## +# END OF identity TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/identity_func-master.opt b/mysql-test/suite/sys_vars/t/identity_func-master.opt new file mode 100644 index 00000000000..66f581b56d0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/identity_func-master.opt @@ -0,0 +1,2 @@ +--innodb + diff --git a/mysql-test/suite/sys_vars/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test new file mode 100644 index 00000000000..ff93607a2cd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/identity_func.test @@ -0,0 +1,144 @@ +#################### mysql-test\t\identity_func.test ########################## +# # +# Variable Name: identity # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: - # +# Range: - # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable identity # +# that checks the functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +) ENGINE = INNODB; + +--echo ## Creating another new table t2 ## +CREATE TABLE t2 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +) ENGINE = INNODB; + +--echo '#--------------------FN_DYNVARS_035_01-------------------------#' +############################################### +# Verifying initial value of identity. # +############################################### + +--echo ## It should be zero ## +SELECT @@identity = 0; + +--echo ## Creating and connecting with new connection test_con1 ## +connect (test_con1, localhost, root,,); +connection test_con1; +SET @@autocommit = 0; + +--echo ## Inserting rows in table t1 ## +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +INSERT into t1(name) values('Record_3'); + +--echo ## Verifying total values in t1 ## +SELECT @@identity from t1; + + +--echo ## Now inserting some data in table t2 ## +INSERT into t2(name) values('Record_1'); + +--echo ## Verifying total values in t2 ## +SELECT @@identity from t2; + + +--echo '#--------------------FN_DYNVARS_035_02-------------------------#' +########################################################## +# Verifying value of identity with new connection # +########################################################## + +--echo ## Creating and connecting with new connection test_con2 ## +connect (test_con2, localhost, root,,); +connection test_con2; +SELECT * from t1; + +--echo ## Verifying total values in t1 ## +SELECT @@identity from t1; + +--echo ## Verifying total values in t2 ## +SELECT @@identity from t2; + +--echo ## Inserting some more records in table t1 ## +INSERT into t1(name) values('Record_1_1'); +INSERT into t1(name) values('Record_1_2'); + +--echo ## Verifying total values in t1 ## +SELECT @@identity from t1; + +--echo ## Inserting row in table t2 ## +INSERT into t2(name) values('Record_1_3'); + +--echo ## Verifying total values in t2 ## +SELECT @@identity from t2; + + +--echo '#--------------------FN_DYNVARS_035_03-------------------------#' +################################################################### +# Verifying identity value by using commit in connectio # 01 # +################################################################### + +--echo ## Switching to connection test_con1 ## +connection test_con1; + +--echo ## Commiting rows added in test_con1 ## +COMMIT; + +--echo ## Verifying records in both tables ## +SELECT * from t1; +SELECT * from t2; + +--echo ## Verifying total values in t1 after commiting data ## +SELECT @@identity from t1; + +--echo ## Verifying total values in t2 after commiting data ## +SELECT @@identity from t2; + +INSERT into t1(name) values('Record_4'); + +--echo ## Now verifying value of variable after inserting 1 row in this connection ## +SELECT @@identity from t1; + +--echo ## Dropping tables t1 & t2 ## +drop table t1, t2; + +--echo ## Disconnecting both the connections ## +disconnect test_con1; +disconnect test_con2; + + + + + diff --git a/mysql-test/suite/sys_vars/t/init_connect_basic.test b/mysql-test/suite/sys_vars/t/init_connect_basic.test new file mode 100644 index 00000000000..8557dfbf4fc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/init_connect_basic.test @@ -0,0 +1,151 @@ +############## mysql-test\t\init_connect_basic.test ########################### +# # +# Variable Name: init_connect # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable init_connect # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +############################################## +## START OF init_connect TESTS ## +############################################## + +############################################################# +# Save initial value # +############################################################# +# save using implicit session scope +SET @global_start_value = @@global.init_connect; +SELECT @global_start_value AS INIT_VALUE; + +--echo '#--------------------FN_DYNVARS_036_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT init_connect; +# access using no scope specified +SELECT @@init_connect; +# assign value without @@ +SET @@global.init_connect='SET autocomit=0'; +SELECT @@global.init_connect; +# using another syntax for accessing session variable +SET global init_connect='SET autocomit=0'; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT global init_connect; +--Error ER_PARSE_ERROR +SELECT @@global init_connect; + + +--echo '#--------------------FN_DYNVARS_036_02-------------------------#' +################################################################## +# Check the DEFAULT value of init_connect for global # +################################################################## +SET @@global.init_connect = 'SET join_buffer_size=8200'; +SET @@global.init_connect = DEFAULT; +SELECT @@global.init_connect; + +--echo '#--------------------FN_DYNVARS_036_03-------------------------#' +###################################################################### +# see if it is accessable using session scope # +###################################################################### +--Error ER_GLOBAL_VARIABLE +SET @@session.init_connect = ''; +--Error ER_GLOBAL_VARIABLE +SET @@init_connect = ''; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.init_connect; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.init_connect; + +--echo '#--------------------FN_DYNVARS_036_04-------------------------#' +######################################################################### +# Change the value of init_connect to a valid value # +######################################################################### + +SET @@global.init_connect=""; +SELECT @@global.init_connect; + +SET @@global.init_connect='SELECT 1,"abc"'; +SELECT @@global.init_connect; + +SET @@global.init_connect='SET @yoursql="mysql"'; +SELECT @@global.init_connect; + +SET @@global.init_connect="SET autocomit=0;REVOKE ALL ON INFORMATION_SCHEMA.*"; +SELECT @@global.init_connect; + +SET @@global.init_connect='SHOW VARIABLES'; +SELECT @@global.init_connect; + +SET @@global.init_connect = NULL; +SELECT @@global.init_connect; + +#any string is accepted as valid value as its is not verified until runtime +SET @@global.init_connect='abc 123 +-*/'; +SELECT @@global.init_connect; + +SET @@global.init_connect=this_will_give_syntax_error; +SELECT @@global.init_connect; + +SET @@global.init_connect = init_slave; +SELECT @@global.init_connect; + +--echo '#--------------------FN_DYNVARS_036_05-------------------------#' +########################################################################### +# Change the value of init_connect to an invalid value for global # +########################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = true; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = false; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = 1.1; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = 1; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_connect = -1; + +SET @@global.init_connect = ON; +SELECT @@global.init_connect; + +--echo '#--------------------FN_DYNVARS_036_06-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## + +SELECT @@global.init_connect = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='init_connect') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.init_connect = @global_start_value; +SELECT @@global.init_connect; + +##################################################### +# END OF init_connect TESTS # +##################################################### diff --git a/mysql-test/suite/sys_vars/t/init_slave_basic.test b/mysql-test/suite/sys_vars/t/init_slave_basic.test new file mode 100644 index 00000000000..b137a525090 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/init_slave_basic.test @@ -0,0 +1,153 @@ +###################### mysql-test\t\init_slave_basic.test ##################### +# # +# Variable Name: init_slave # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable init_slave # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +############################################ +## START OF init_slave TESTS ## +############################################ + +############################################################# +# Save initial value # +############################################################# +# save using implicit session scope +SET @global_start_value = @@global.init_slave; +SELECT @global_start_value AS INIT_VALUE; + +--echo '#--------------------FN_DYNVARS_037_01------------------#' +############################################################################### +# Test Variable access and assignment with and without @@ # +############################################################################### +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT init_slave; +# access using no scope specified +SELECT @@init_slave; +# assign value without @@ +SET @@global.init_slave='SET autocomit=0'; +SELECT @@global.init_slave; +# using another syntax for accessing session variable +SET global init_slave='SET autocomit=0'; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT global init_slave; +--Error ER_PARSE_ERROR +SELECT @@global init_slave; + + +--echo '#--------------------FN_DYNVARS_037_02-------------------------#' +################################################################ +# Check the DEFAULT value of init_slave for global # +################################################################ +SET @@global.init_slave = 'SET join_buffer_size=8200'; +SET @@global.init_slave = DEFAULT; +SELECT @@global.init_slave; + +--echo '#--------------------FN_DYNVARS_037_03-------------------------#' +###################################################################### +# see if it is accessable using session scope # +###################################################################### +--Error ER_GLOBAL_VARIABLE +SET @@session.init_slave = ''; +--Error ER_GLOBAL_VARIABLE +SET @@init_slave = ""; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.init_slave; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.init_slave; + +--echo '#--------------------FN_DYNVARS_037_04-------------------------#' +####################################################################### +# Change the value of init_slave to a valid value # +####################################################################### + +SET @@global.init_slave=""; +SELECT @@global.init_slave; + +SET @@global.init_slave='SELECT 1,"abc"'; +SELECT @@global.init_slave; + +SET @@global.init_slave='SET @a="b"'; +SELECT @@global.init_slave; + +SET @@global.init_slave="SET autocomit=1;REVOKE ALL ON INFORMATION_SCHEMA.*"; +SELECT @@global.init_slave; + +SET @@global.init_slave='SHOW VARIABLES'; +SELECT @@global.init_slave; + +SET @@global.init_slave = NULL; +SELECT @@global.init_slave; + +#any string is accepted as valid value as its is not verified/compiled +# untill runtime +SET @@global.init_slave='abc 123 +-*/'; +SELECT @@global.init_slave; + +SET @@global.init_slave=this_will_give_syntax_error; +SELECT @@global.init_slave; + +SET @@global.init_slave = init_slave; +SELECT @@global.init_slave; + +--echo '#--------------------FN_DYNVARS_037_05-------------------------#' +######################################################################### +# Change the value of init_slave to an invalid value for global # +######################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = true; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = false; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = 1.1; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = 0; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = 1; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.init_slave = -1; + +SET @@global.init_slave = ON; +SELECT @@global.init_slave; + + +--echo '#--------------------FN_DYNVARS_037_06-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## + +SELECT @@global.init_slave = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='init_slave') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.init_slave = @global_start_value; +SELECT @@global.init_slave; + +################################################### +# END OF init_slave TESTS # +################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_additional_mem_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_additional_mem_pool_size_basic.test new file mode 100644 index 00000000000..ffb1046ed32 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_additional_mem_pool_size_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_additional_mem_pool_size_basic.test #### +# # +# Variable Name: innodb_additional_mem_pool_size # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_additional_mem_pool_size# +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_020_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_additional_mem_pool_size); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_020_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_additional_mem_pool_size=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_additional_mem_pool_size); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_020_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_additional_mem_pool_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_additional_mem_pool_size'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_additional_mem_pool_size); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_additional_mem_pool_size'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_020_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_additional_mem_pool_size = @@GLOBAL.innodb_additional_mem_pool_size; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_020_05----------------------#' +################################################################################ +# Check if innodb_additional_mem_pool_size can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_additional_mem_pool_size); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_additional_mem_pool_size); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_additional_mem_pool_size); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_additional_mem_pool_size); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_additional_mem_pool_size = @@SESSION.innodb_additional_mem_pool_size; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test new file mode 100644 index 00000000000..eb208e7197f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test @@ -0,0 +1,145 @@ +################# mysql-test\t\innodb_autoextend_increment _basic.test ########### +# # +# Variable Name: innodb_autoextend_increment # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 8 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: # +# Test Cases of Dynamic System Variable innodb_autoextend_increment that # +# checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################## + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_autoextend_increment TESTS # +######################################################################## + + +############################################################################### +# Saving initial value of innodb_autoextend_increment in a temporary variable # +############################################################################### + + +SET @global_start_value = @@global.innodb_autoextend_increment ; + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_autoextend_increment # +######################################################################## + +SET @@global.innodb_autoextend_increment = 0; +SET @@global.innodb_autoextend_increment = DEFAULT; +SELECT @@global.innodb_autoextend_increment ; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +#################################################################################### +# Check if innodb_autoextend_increment can be accessed with and without @@ sign # +#################################################################################### + +--Error ER_GLOBAL_VARIABLE +SET innodb_autoextend_increment = 1; +SELECT @@innodb_autoextend_increment ; + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_autoextend_increment ; + +SET global innodb_autoextend_increment = 0; +SELECT @@global.innodb_autoextend_increment ; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_autoextend_increment to a valid value # +########################################################################## + +SET @@global.innodb_autoextend_increment = 1; +SELECT @@global.innodb_autoextend_increment ; +SET @@global.innodb_autoextend_increment = 1000; +SELECT @@global.innodb_autoextend_increment ; + + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_autoextend_increment to invalid value # +########################################################################### + +SET @@global.innodb_autoextend_increment = -1; +SELECT @@global.innodb_autoextend_increment; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_autoextend_increment = "T"; +SELECT @@global.innodb_autoextend_increment; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_autoextend_increment = "Y"; +SELECT @@global.innodb_autoextend_increment; + +SET @@global.innodb_autoextend_increment = 1001; +SELECT @@global.innodb_autoextend_increment; + + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_autoextend_increment '; +SELECT @@global.innodb_autoextend_increment ; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_autoextend_increment '; + + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_autoextend_increment = OFF; +SELECT @@global.innodb_autoextend_increment ; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_autoextend_increment = ON; +SELECT @@global.innodb_autoextend_increment ; + + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.innodb_autoextend_increment = TRUE; +SELECT @@global.innodb_autoextend_increment ; +SET @@global.innodb_autoextend_increment = FALSE; +SELECT @@global.innodb_autoextend_increment ; + + +############################## +# Restore initial value # +############################## + +SET @@global.innodb_autoextend_increment = @global_start_value; + +############################################################### +# END OF innodb_autoextend_increment TESTS # +############################################################### + diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test new file mode 100644 index 00000000000..5b6fa943bbe --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test @@ -0,0 +1,90 @@ +################# mysql-test\t\innodb_autoinc_lock_mode_basic.test ############ +# # +# Variable Name: innodb_autoinc_lock_mode # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 0,1,2 # +# # +# # +# Creation Date: 2008-02-20 # +# Author: Sharique Abdullah # +# # +#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment# +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_autoinc_lock_mode TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of innodb_autoinc_lock_mode in a temporary variable# +################################################################################ + + +SET @global_start_value = @@global.innodb_autoinc_lock_mode; +SELECT @global_start_value; + + + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_autoinc_lock_mode # +######################################################################## + + +--ERROR ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.innodb_autoinc_lock_mode = 0; +--ERROR ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@global.innodb_autoinc_lock_mode = DEFAULT; +SELECT @@global.innodb_autoinc_lock_mode; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +#################################################################################### +# Check if innodb_autoinc_lock_mode can be accessed with and without @@ sign # +#################################################################################### + + +SELECT @@innodb_autoinc_lock_mode; + + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_autoinc_lock_mode; + + + +SELECT @@global.innodb_autoinc_lock_mode; + + + +--echo '#----------------------FN_DYNVARS_046_03------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_autoinc_lock_mode = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_autoinc_lock_mode'; +SELECT @@global.innodb_autoinc_lock_mode; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_autoinc_lock_mode'; + + +############################################################### +# END OF innodb_autoinc_lock_mode TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt new file mode 100644 index 00000000000..ab9fcb75678 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func-master.opt @@ -0,0 +1,2 @@ +--innodb-autoinc-lock-mode=1 + diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test new file mode 100644 index 00000000000..89c1c80a6dc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test @@ -0,0 +1,59 @@ +################# mysql-test\t\innodb_autoinc_lock_mode_func.test ############ +# # +# Variable Name: innodb_autoinc_lock_mode # +# Scope: GLOBAL # +# Access Type: Readonly # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 0,1,2 # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan Maredia # +# # +# Description: # +# Test Cases of Dynamic System Variable innodb_autoextend_increment that # +# checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_039_01-------------------------#' +################################################################ +# Begin the functionality Testing of innodb_autoinc_lock_mode # +################################################################ +--source include/have_innodb.inc + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET global innodb_autoinc_lock_mode = 1; + +#======================================================== +--echo '--innodb_autoinc_lock_mode is 1 (consecutive)--' +#======================================================== + + +# innodb_autoinc_lock_mode is 1 in opt file +SELECT @@global.innodb_autoinc_lock_mode; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR +) ENGINE=INNODB, AUTO_INCREMENT=100; + +INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d'); +INSERT INTO t1 (a,b) VALUES (NULL,'e'); +--echo 'the new auto incremented value should be 104' +SELECT * FROM t1; + +DROP TABLE t1; + +############################################################### +# End of functionality Testing for innodb_autoinc_lock_mode # +############################################################### + diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test new file mode 100644 index 00000000000..190b2d19bc4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_buffer_pool_size_basic.test ############ +# # +# Variable Name: innodb_buffer_pool_size # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_buffer_pool_size # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_022_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_022_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_buffer_pool_size=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_022_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_size'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_buffer_pool_size'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_022_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_022_05----------------------#' +################################################################################ +# Check if innodb_buffer_pool_size can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_buffer_pool_size); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_buffer_pool_size); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_buffer_pool_size); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test new file mode 100644 index 00000000000..89daad9ce0a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_checksums_basic.test ################### +# # +# Variable Name: innodb_checksums # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_checksums # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_023_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_checksums); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_023_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_checksums=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_checksums); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_023_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_checksums = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_checksums'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_checksums); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_checksums'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_023_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_checksums = @@GLOBAL.innodb_checksums; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_023_05----------------------#' +################################################################################ +# Check if innodb_checksums can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_checksums); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_checksums); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_checksums); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_checksums); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_checksums = @@SESSION.innodb_checksums; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test new file mode 100644 index 00000000000..1ef69e34999 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_commit_concurrency_basic.test @@ -0,0 +1,147 @@ +################# mysql-test\t\innodb_commit_concurrency_basic.test ########### +# # +# Variable Name: innodb_commit_concurrency # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 0 # +# Range: 0-1000 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +#Description:Test Cases of Dynamic System Variable innodb_commit_concurrency # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_commit_concurrency TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of innodb_commit_concurrency in a temporary variable# +############################################################################## + +SET @global_start_value = @@global.innodb_commit_concurrency; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_commit_concurrency # +######################################################################## + +SET @@global.innodb_commit_concurrency = 0; +SET @@global.innodb_commit_concurrency = DEFAULT; +SELECT @@global.innodb_commit_concurrency; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +################################################################################ +# Check if innodb_commit_concurrency can be accessed with and without @@ sign# +################################################################################ + +--Error ER_GLOBAL_VARIABLE +SET innodb_commit_concurrency = 1; +SELECT @@innodb_commit_concurrency; + + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_commit_concurrency; + +SET global innodb_commit_concurrency = 0; + +SELECT @@global.innodb_commit_concurrency; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_commit_concurrency to a valid value # +########################################################################## + + +SET @@global.innodb_commit_concurrency = 0; +SELECT @@global.innodb_commit_concurrency; + +SET @@global.innodb_commit_concurrency = 1; +SELECT @@global.innodb_commit_concurrency; +SET @@global.innodb_commit_concurrency = 1000; +SELECT @@global.innodb_commit_concurrency; + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_commit_concurrency to invalid value # +########################################################################### + +SET @@global.innodb_commit_concurrency = -1; +SELECT @@global.innodb_commit_concurrency; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_commit_concurrency = "T"; +SELECT @@global.innodb_commit_concurrency; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_commit_concurrency = "Y"; +SELECT @@global.innodb_commit_concurrency; + +SET @@global.innodb_commit_concurrency = 1001; +SELECT @@global.innodb_commit_concurrency; + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_commit_concurrency = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_commit_concurrency'; +SELECT @@global.innodb_commit_concurrency; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_commit_concurrency'; + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_commit_concurrency = OFF; +SELECT @@global.innodb_commit_concurrency; + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_commit_concurrency = ON; +SELECT @@global.innodb_commit_concurrency; + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + + +SET @@global.innodb_commit_concurrency = TRUE; +SELECT @@global.innodb_commit_concurrency; +SET @@global.innodb_commit_concurrency = FALSE; +SELECT @@global.innodb_commit_concurrency; + +############################## +# Restore initial value # +############################## + + +SET @@global.innodb_commit_concurrency = @global_start_value; +SELECT @@global.innodb_commit_concurrency; + +############################################################### +# END OF innodb_commit_concurrency TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test new file mode 100644 index 00000000000..1d88c47b1bb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_data_file_path_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_data_file_path_basic.test ############## +# # +# Variable Name: innodb_data_file_path # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_data_file_path # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_024_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_data_file_path); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_024_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_data_file_path=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_data_file_path); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_024_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_data_file_path = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_data_file_path'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_data_file_path); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_data_file_path'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_024_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_data_file_path = @@GLOBAL.innodb_data_file_path; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_024_05----------------------#' +################################################################################ +# Check if innodb_data_file_path can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_data_file_path); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_data_file_path); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_data_file_path); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_data_file_path); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_data_file_path = @@SESSION.innodb_data_file_path; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test new file mode 100644 index 00000000000..f3b02edf83b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_data_home_dir_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_data_home_dir_basic.test ############### +# # +# Variable Name: innodb_data_home_dir # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_data_home_dir # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_025_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_data_home_dir); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_025_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_data_home_dir=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_data_home_dir); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_025_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_data_home_dir = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_data_home_dir'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_data_home_dir); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_data_home_dir'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_025_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_data_home_dir = @@GLOBAL.innodb_data_home_dir; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_025_05----------------------#' +################################################################################ +# Check if innodb_data_home_dir can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_data_home_dir); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_data_home_dir); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_data_home_dir); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_data_home_dir); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_data_home_dir = @@SESSION.innodb_data_home_dir; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test new file mode 100644 index 00000000000..4a0460bb4bc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_doublewrite_basic.test ################# +# # +# Variable Name: innodb_doublewrite # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_doublewrite # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_026_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_doublewrite); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_026_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_doublewrite=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_doublewrite); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_026_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_doublewrite = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_doublewrite'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_doublewrite); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_doublewrite'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_026_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_doublewrite = @@GLOBAL.innodb_doublewrite; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_026_05----------------------#' +################################################################################ +# Check if innodb_doublewrite can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_doublewrite); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_doublewrite); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_doublewrite); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_doublewrite); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_doublewrite = @@SESSION.innodb_doublewrite; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test new file mode 100644 index 00000000000..7de63332844 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test @@ -0,0 +1,190 @@ +############## mysql-test\t\innodb_fast_shutdown_basic.test ################### +# # +# Variable Name: innodb_fast_shutdown # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2008-02-20 # +# Author: Sharique Abdullah # +# # +# Description: # +# Test Cases of Dynamic System Variable innodb_fast_shutdown that checks # +# the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_fast_shutdown TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of innodb_fast_shutdown in a temporary variable # +############################################################################## + +SET @global_start_value = @@global.innodb_fast_shutdown; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#--------------------FN_DYNVARS_042_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_fast_shutdown # +######################################################################## + +SET @@global.innodb_fast_shutdown = 0; +SET @@global.innodb_fast_shutdown = DEFAULT; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#---------------------FN_DYNVARS_042_02-------------------------#' +############################################################################# +# Check if innodb_fast_shutdown can be accessed with and without @@ sign # +############################################################################# + +--ERROR ER_GLOBAL_VARIABLE +SET innodb_fast_shutdown = 1; +SELECT @@innodb_fast_shutdown; + +--Error ER_UNKNOWN_TABLE +SELECT global.innodb_fast_shutdown; + +SET global innodb_fast_shutdown = 1; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#--------------------FN_DYNVARS_042_03------------------------#' +########################################################################## +# Change the value of innodb_fast_shutdown to a valid value # +########################################################################## + +SET @@global.innodb_fast_shutdown = 0; +SELECT @@global.innodb_fast_shutdown; + +SET @@global.innodb_fast_shutdown = 1; +SELECT @@global.innodb_fast_shutdown; +## A value of 2 is used to just flush logs and then shutdown cold. +## Not supported on Netware + +SET @@global.innodb_fast_shutdown = 2; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#--------------------FN_DYNVARS_042_04-------------------------#' +########################################################################### +# Change the value of innodb_fast_shutdown to invalid value # +########################################################################### + +SET @@global.innodb_fast_shutdown = -1; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = TRU; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = TRUE_F; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = FALS; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = OON; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = ONN; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = OOFF; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = 0FF; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = '1'; +SELECT @@global.innodb_fast_shutdown; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = "0"; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#-------------------FN_DYNVARS_042_05----------------------------#' +########################################################################### +# Test if accessing session innodb_fast_shutdown gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.innodb_fast_shutdown = 0; + +--Error ER_GLOBAL_VARIABLE +SET @@innodb_fast_shutdown = 0; +--Error ER_GLOBAL_VARIABLE +SET @@local.innodb_fast_shutdown = 0; + + +--echo '#----------------------FN_DYNVARS_042_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) AS res_is_0 +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='innodb_fast_shutdown'; + + +--echo '#----------------------FN_DYNVARS_042_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_fast_shutdown = +VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_fast_shutdown'; + + +--echo '#---------------------FN_DYNVARS_042_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = OFF; +SELECT @@global.innodb_fast_shutdown; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_fast_shutdown = ON; +SELECT @@global.innodb_fast_shutdown; + + +--echo '#---------------------FN_DYNVARS_042_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.innodb_fast_shutdown = TRUE; +SELECT @@global.innodb_fast_shutdown; +SET @@global.innodb_fast_shutdown = FALSE; +SELECT @@global.innodb_fast_shutdown; + + +############################## +# Restore initial value # +############################## + +SET @@global.innodb_fast_shutdown = @global_start_value; +SELECT @@global.innodb_fast_shutdown; + +######################################################################## +# END OF innodb_fast_shutdown TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test new file mode 100644 index 00000000000..8e09c75ded6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_file_io_threads_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_file_io_threads_basic.test ############# +# # +# Variable Name: innodb_file_io_threads # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_file_io_threads # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_027_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_file_io_threads); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_027_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_file_io_threads=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_file_io_threads); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_027_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_file_io_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_file_io_threads'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_file_io_threads); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_file_io_threads'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_027_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_file_io_threads = @@GLOBAL.innodb_file_io_threads; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_027_05----------------------#' +################################################################################ +# Check if innodb_file_io_threads can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_file_io_threads); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_file_io_threads); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_file_io_threads); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_file_io_threads); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_file_io_threads = @@SESSION.innodb_file_io_threads; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test new file mode 100644 index 00000000000..bc0e34c484e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_file_per_table_basic.test ############## +# # +# Variable Name: innodb_file_per_table # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_file_per_table # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_028_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_file_per_table); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_028_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_file_per_table=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_file_per_table); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_028_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_file_per_table = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_file_per_table'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_file_per_table); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_file_per_table'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_028_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_file_per_table = @@GLOBAL.innodb_file_per_table; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_028_05----------------------#' +################################################################################ +# Check if innodb_file_per_table can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_file_per_table); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_file_per_table); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_file_per_table); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_file_per_table); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_file_per_table = @@SESSION.innodb_file_per_table; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test new file mode 100644 index 00000000000..90da929d199 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_flush_log_at_trx_commit_basic.test @@ -0,0 +1,151 @@ +################# mysql-test\t\innodb_flush_log_at_trx_commit_basic.test ###### +# # +# Variable Name: innodb_flush_log_at_trx_commit # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 0-2 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +#Description: Test Cases of Dynamic System Variable # +# innodb_flush_log_at_trx_commit that checks the behavior of # +# this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_flush_log_at_trx_commit TESTS # +######################################################################## + + +############################################################################# +# Saving initial value of innodb_flush_log_at_trx_commit # +############################################################################# + + +SET @global_start_value = @@global.innodb_flush_log_at_trx_commit; +SELECT @global_start_value; + + + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +########################################################################## +# Display the DEFAULT value of innodb_flush_log_at_trx_commit # +########################################################################## + +SET @@global.innodb_flush_log_at_trx_commit = 0; +SET @@global.innodb_flush_log_at_trx_commit = DEFAULT; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +############################################################################### +# Check if variable can be accessed with and without @@ sign # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET innodb_flush_log_at_trx_commit = 1; +SELECT @@innodb_flush_log_at_trx_commit; + + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_flush_log_at_trx_commit; + + +SET global innodb_flush_log_at_trx_commit = 0; +SELECT @@global.innodb_flush_log_at_trx_commit; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +############################################################################# +# change the value of innodb_flush_log_at_trx_commit to a valid value # +############################################################################# + + +SET @@global.innodb_flush_log_at_trx_commit = 0; +SELECT @@global.innodb_flush_log_at_trx_commit; + +SET @@global.innodb_flush_log_at_trx_commit = 1; +SELECT @@global.innodb_flush_log_at_trx_commit; +SET @@global.innodb_flush_log_at_trx_commit = 2; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +############################################################################### +# Change the value of innodb_flush_log_at_trx_commit to invalid value # +############################################################################### + +SET @@global.innodb_flush_log_at_trx_commit = -1; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_flush_log_at_trx_commit = "T"; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_flush_log_at_trx_commit = "Y"; +SELECT @@global.innodb_flush_log_at_trx_commit; + +SET @@global.innodb_flush_log_at_trx_commit = 1001; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_flush_log_at_trx_commit = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_flush_log_at_trx_commit'; +SELECT @@global.innodb_flush_log_at_trx_commit; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_flush_log_at_trx_commit'; + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_flush_log_at_trx_commit = OFF; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_flush_log_at_trx_commit = ON; +SELECT @@global.innodb_flush_log_at_trx_commit; + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + + +SET @@global.innodb_flush_log_at_trx_commit = TRUE; +SELECT @@global.innodb_flush_log_at_trx_commit; +SET @@global.innodb_flush_log_at_trx_commit = FALSE; +SELECT @@global.innodb_flush_log_at_trx_commit; + +############################## +# Restore initial value # +############################## + + +SET @@global.innodb_flush_log_at_trx_commit = @global_start_value; +SELECT @@global.innodb_flush_log_at_trx_commit; + +############################################################### +# END OF innodb_flush_log_at_trx_commit TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test new file mode 100644 index 00000000000..531df4a2464 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_flush_method_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_flush_method_basic.test ################ +# # +# Variable Name: innodb_flush_method # +# Scope: Global # +# Access Type: Static # +# Data Type: enumeration # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_flush_method # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_029_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_flush_method); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_029_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_flush_method=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_flush_method); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_029_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_flush_method = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_flush_method'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_flush_method); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_flush_method'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_029_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_flush_method = @@GLOBAL.innodb_flush_method; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_029_05----------------------#' +################################################################################ +# Check if innodb_flush_method can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_flush_method); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_flush_method); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_flush_method); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_flush_method); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_flush_method = @@SESSION.innodb_flush_method; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test new file mode 100644 index 00000000000..f5aa769f09f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_force_recovery_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_force_recovery_basic.test ############## +# # +# Variable Name: innodb_force_recovery # +# Scope: Global # +# Access Type: Static # +# Data Type: enumeration # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_force_recovery # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_030_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_force_recovery); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_030_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_force_recovery=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_force_recovery); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_030_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_force_recovery = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_force_recovery'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_force_recovery); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_force_recovery'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_030_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_force_recovery = @@GLOBAL.innodb_force_recovery; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_030_05----------------------#' +################################################################################ +# Check if innodb_force_recovery can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_force_recovery); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_force_recovery); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_force_recovery); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_force_recovery); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_force_recovery = @@SESSION.innodb_force_recovery; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test new file mode 100644 index 00000000000..ed31fc9eb6b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_lock_wait_timeout_basic.test ########### +# # +# Variable Name: innodb_lock_wait_timeout # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_lock_wait_timeout # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_032_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_032_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_lock_wait_timeout=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_032_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_lock_wait_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_lock_wait_timeout'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_lock_wait_timeout'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_032_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_lock_wait_timeout = @@GLOBAL.innodb_lock_wait_timeout; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_032_05----------------------#' +################################################################################ +# Check if innodb_lock_wait_timeout can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_lock_wait_timeout); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_lock_wait_timeout); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_lock_wait_timeout); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_lock_wait_timeout = @@SESSION.innodb_lock_wait_timeout; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test new file mode 100644 index 00000000000..63835113770 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_locks_unsafe_for_binlog_basic.test ##### +# # +# Variable Name: innodb_locks_unsafe_for_binlog # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_locks_unsafe_for_binlog# +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_031_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_031_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_locks_unsafe_for_binlog=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_031_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_031_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_locks_unsafe_for_binlog = @@GLOBAL.innodb_locks_unsafe_for_binlog; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_031_05----------------------#' +################################################################################ +# Check if innodb_locks_unsafe_for_binlog can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_locks_unsafe_for_binlog); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_locks_unsafe_for_binlog); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_locks_unsafe_for_binlog); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_locks_unsafe_for_binlog = @@SESSION.innodb_locks_unsafe_for_binlog; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test new file mode 100644 index 00000000000..74c1aeab87a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_log_buffer_size_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_log_buffer_size_basic.test ############# +# # +# Variable Name: innodb_log_buffer_size # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_log_buffer_size # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_033_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_log_buffer_size); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_033_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_log_buffer_size=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_log_buffer_size); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_033_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_log_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_buffer_size'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_log_buffer_size); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_buffer_size'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_033_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_log_buffer_size = @@GLOBAL.innodb_log_buffer_size; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_033_05----------------------#' +################################################################################ +# Check if innodb_log_buffer_size can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_log_buffer_size); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_log_buffer_size); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_log_buffer_size); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_log_buffer_size); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_log_buffer_size = @@SESSION.innodb_log_buffer_size; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test new file mode 100644 index 00000000000..08925b73957 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_log_file_size_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_log_file_size_basic.test ############### +# # +# Variable Name: innodb_log_file_size # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_log_file_size # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_035_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_log_file_size); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_035_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_log_file_size=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_log_file_size); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_035_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_log_file_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_file_size'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_log_file_size); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_file_size'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_log_file_size = @@GLOBAL.innodb_log_file_size; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_035_05----------------------#' +################################################################################ +# Check if innodb_log_file_size can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_log_file_size); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_log_file_size); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_log_file_size); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_log_file_size); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_log_file_size = @@SESSION.innodb_log_file_size; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_log_files_in_group_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_files_in_group_basic.test new file mode 100644 index 00000000000..67978efe76a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_log_files_in_group_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_log_files_in_group_basic.test ########## +# # +# Variable Name: innodb_log_files_in_group # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_log_files_in_group # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_034_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_log_files_in_group); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_034_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_log_files_in_group=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_log_files_in_group); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_034_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_log_files_in_group = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_files_in_group'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_log_files_in_group); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_files_in_group'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_034_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_log_files_in_group = @@GLOBAL.innodb_log_files_in_group; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_034_05----------------------#' +################################################################################ +# Check if innodb_log_files_in_group can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_log_files_in_group); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_log_files_in_group); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_log_files_in_group); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_log_files_in_group); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_log_files_in_group = @@SESSION.innodb_log_files_in_group; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test new file mode 100644 index 00000000000..7e3969c6bd7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_log_group_home_dir_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_log_group_home_dir_basic.test ########## +# # +# Variable Name: innodb_log_group_home_dir # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_log_group_home_dir # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_036_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_036_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_log_group_home_dir=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_036_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_log_group_home_dir = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_group_home_dir'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_log_group_home_dir'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_036_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_log_group_home_dir = @@GLOBAL.innodb_log_group_home_dir; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_036_05----------------------#' +################################################################################ +# Check if innodb_log_group_home_dir can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_log_group_home_dir); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_log_group_home_dir); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_log_group_home_dir); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_log_group_home_dir); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_log_group_home_dir = @@SESSION.innodb_log_group_home_dir; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test new file mode 100644 index 00000000000..830617866ca --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test @@ -0,0 +1,142 @@ +################# mysql-test\t\innodb_max_dirty_pages_pct_basic.test ########## +# # +# Variable Name: innodb_max_dirty_pages_pct # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 90 # +# Range: 0-1000 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +#Description: Test Cases of Dynamic System Variable # +# innodb_max_dirty_pages_pct that checks the behavior of # +# this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +--source include/have_innodb.inc +--source include/load_sysvars.inc + +###################################################################### +# START OF innodb_max_dirty_pages_pct TESTS # +###################################################################### + + +################################################################################ +# Saving initial value of innodb_max_dirty_pages_pct in a temporary variable # +################################################################################ + +SET @global_start_value = @@global.innodb_max_dirty_pages_pct; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_max_dirty_pages_pct # +######################################################################## + +SET @@global.innodb_max_dirty_pages_pct = 0; +SET @@global.innodb_max_dirty_pages_pct = DEFAULT; +SELECT @@global.innodb_max_dirty_pages_pct; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +################################################################################ +# check if innodb_max_dirty_pages_pct can be accessed with and without @@ sign # +################################################################################ + +--Error ER_GLOBAL_VARIABLE +SET innodb_max_dirty_pages_pct = 1; +SELECT @@innodb_max_dirty_pages_pct; + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_max_dirty_pages_pct; + +SET global innodb_max_dirty_pages_pct = 0; +SELECT @@global.innodb_max_dirty_pages_pct; + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_max_dirty_pages_pct to a valid value # +########################################################################## + +SET @@global.innodb_max_dirty_pages_pct = 0; +SELECT @@global.innodb_max_dirty_pages_pct; + +SET @@global.innodb_max_dirty_pages_pct = 1; +SELECT @@global.innodb_max_dirty_pages_pct; +SET @@global.innodb_max_dirty_pages_pct = 100; +SELECT @@global.innodb_max_dirty_pages_pct; + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_max_dirty_pages_pct to invalid value # +########################################################################### + +SET @@global.innodb_max_dirty_pages_pct = -1; +SELECT @@global.innodb_max_dirty_pages_pct; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_max_dirty_pages_pct = "T"; +SELECT @@global.innodb_max_dirty_pages_pct; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_max_dirty_pages_pct = "Y"; +SELECT @@global.innodb_max_dirty_pages_pct; + +SET @@global.innodb_max_dirty_pages_pct = 1001; +SELECT @@global.innodb_max_dirty_pages_pct; + + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_max_dirty_pages_pct = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct'; +SELECT @@global.innodb_max_dirty_pages_pct; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct'; + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_max_dirty_pages_pct = OFF; +SELECT @@global.innodb_max_dirty_pages_pct; + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_max_dirty_pages_pct = ON; +SELECT @@global.innodb_max_dirty_pages_pct; + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.innodb_max_dirty_pages_pct = TRUE; +SELECT @@global.innodb_max_dirty_pages_pct; +SET @@global.innodb_max_dirty_pages_pct = FALSE; +SELECT @@global.innodb_max_dirty_pages_pct; + +############################## +# Restore initial value # +############################## + +SET @@global.innodb_max_dirty_pages_pct = @global_start_value; +SELECT @@global.innodb_max_dirty_pages_pct; + +############################################################### +# END OF innodb_max_dirty_pages_pct TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test new file mode 100644 index 00000000000..52ebc2f4c49 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test @@ -0,0 +1,168 @@ +################# mysql-test\t\innodb_max_dirty_pages_pct_func.test ########## +# # +# Variable Name: innodb_max_dirty_pages_pct # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 90 # +# Range: 0-100 # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: # +# Test cases of Dynamic System Variable innodb_max_dirty_pages_pct that # +# checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +SET @start_value= @@global.innodb_max_dirty_pages_pct; + +--echo '#--------------------FN_DYNVARS_044_02-------------------------#' +############################################################################ +# Check if setting innodb_max_dirty_pages_pct is changed in new connection # +############################################################################ + +SET @@global.innodb_max_dirty_pages_pct = 80; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +SELECT @@global.innodb_max_dirty_pages_pct; +SET @@global.innodb_max_dirty_pages_pct = 70; +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +SELECT @@global.innodb_max_dirty_pages_pct; +disconnect con2; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_044_02-------------------------#' +################################################################### +# Begin the functionality Testing of innodb_max_dirty_pages_pct # +################################################################### + +--echo 'connection default' +connection default; + +--disable_query_log + +--disable_warnings +DROP PROCEDURE IF EXISTS add_records; +DROP PROCEDURE IF EXISTS add_until; +DROP PROCEDURE IF EXISTS check_pct; +DROP FUNCTION IF EXISTS dirty_pct; +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(200) +)ENGINE=INNODB; + +DELIMITER //; +CREATE PROCEDURE add_records(IN NUM INT) +BEGIN + START TRANSACTION; + WHILE (NUM>0) DO + INSERT INTO t1(b) VALUES('MYSQL'); + SET NUM = NUM - 1; + END WHILE; + COMMIT; +END// + +CREATE FUNCTION dirty_pct() RETURNS DECIMAL(20,17) +BEGIN + DECLARE res DECIMAL(20,17); + DECLARE a1,b1 VARCHAR(256); + DECLARE a2,b2 VARCHAR(256); + DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status + WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty' + UNION SELECT * FROM information_schema.session_status + WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty'; + DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status + WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total' + UNION SELECT * FROM information_schema.session_status + WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total'; + + OPEN dirty; + OPEN total; + + FETCH dirty INTO a1, b1; + FETCH total INTO a2, b2; + + SET res = ( CONVERT(b1,DECIMAL)*100)/CONVERT(b2,DECIMAL); + + CLOSE dirty; + CLOSE total; + RETURN res; +END// + +CREATE PROCEDURE add_until(IN NUM DECIMAL) +BEGIN + DECLARE pct,last DECIMAL(20,17); + + SET pct = dirty_pct(); + SET last = 0; + WHILE (pct>NUM and pct<100) DO + CALL add_records(500); + SET pct = dirty_pct(); + IF (pct<last) THEN + SET pct = NUM+1; + ELSE + SET last = pct; + END IF; + END WHILE; +END// + +CREATE PROCEDURE check_pct(IN NUM DECIMAL) +BEGIN + IF (dirty_pct() < NUM) THEN + SELECT 'BELOW_MAX' AS PCT_VALUE; + ELSE + SELECT 'ABOVE_MAX' AS PCT_VALUE; + END IF; +END// + +DELIMITER ;// + +--enable_query_log + +#========================================================== +--echo '---Check when innodb_max_dirty_pages_pct is 10---' +#========================================================== + +SET @@global.innodb_max_dirty_pages_pct = 10; + +FLUSH STATUS; + +# Add rows until dirty pages pct is less than this value +CALL add_until(10); + +# Give the server some time to flush dirty pages +FLUSH TABLES; +CALL add_records(500); + +# Execute dirty_pct (wait) until dirty pages < 10% +# Use polling to execute dirty_pct ina loop +let $wait_condition= SELECT dirty_pct() < 10; +--source include/wait_condition.inc + +--echo 'We expect dirty pages pct to be BELOW_MAX' +CALL check_pct(10); + +DROP PROCEDURE add_records; +DROP PROCEDURE add_until; +DROP PROCEDURE check_pct; +DROP FUNCTION dirty_pct; +DROP TABLE t1; + +SET @@global.innodb_max_dirty_pages_pct= @start_value; + +################################################################## +# End of functionality Testing for innodb_max_dirty_pages_pct # +################################################################## + diff --git a/mysql-test/suite/sys_vars/t/innodb_mirrored_log_groups_basic.test b/mysql-test/suite/sys_vars/t/innodb_mirrored_log_groups_basic.test new file mode 100644 index 00000000000..6edb07ac39f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_mirrored_log_groups_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_mirrored_log_groups_basic.test ######### +# # +# Variable Name: innodb_mirrored_log_groups # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_mirrored_log_groups# +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_037_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_mirrored_log_groups); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_037_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_mirrored_log_groups=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_mirrored_log_groups); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_037_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_mirrored_log_groups = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_mirrored_log_groups'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_mirrored_log_groups); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_mirrored_log_groups'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_037_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_mirrored_log_groups = @@GLOBAL.innodb_mirrored_log_groups; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_037_05----------------------#' +################################################################################ +# Check if innodb_mirrored_log_groups can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_mirrored_log_groups); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_mirrored_log_groups); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_mirrored_log_groups); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_mirrored_log_groups); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_mirrored_log_groups = @@SESSION.innodb_mirrored_log_groups; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test new file mode 100644 index 00000000000..c55b7e55937 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_open_files_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_open_files_basic.test ################## +# # +# Variable Name: innodb_open_files # +# Scope: Global # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_open_files # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_038_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_open_files); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_038_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_open_files=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_open_files); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_038_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_open_files = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_open_files'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_open_files); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_open_files'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_038_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_open_files = @@GLOBAL.innodb_open_files; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_038_05----------------------#' +################################################################################ +# Check if innodb_open_files can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_open_files); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_open_files); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_open_files); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_open_files); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_open_files = @@SESSION.innodb_open_files; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test new file mode 100644 index 00000000000..c33e0fa1b75 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\innodb_rollback_on_timeout_basic.test ######### +# # +# Variable Name: innodb_rollback_on_timeout # +# Scope: Global # +# Access Type: Static # +# Data Type: boolean # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable innodb_rollback_on_timeout# +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--echo '#---------------------BS_STVARS_039_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_039_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.innodb_rollback_on_timeout=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_039_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_rollback_on_timeout'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='innodb_rollback_on_timeout'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_039_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@innodb_rollback_on_timeout = @@GLOBAL.innodb_rollback_on_timeout; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_039_05----------------------#' +################################################################################ +# Check if innodb_rollback_on_timeout can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@innodb_rollback_on_timeout); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.innodb_rollback_on_timeout); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.innodb_rollback_on_timeout); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT innodb_rollback_on_timeout = @@SESSION.innodb_rollback_on_timeout; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test new file mode 100644 index 00000000000..6da3e68ebdf --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test @@ -0,0 +1,235 @@ +################# mysql-test\t\innodb_support_xa_basic.test ################### +# # +# Variable Name: innodb_support_xa # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-20 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable innodb_support_xa # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_support_xa TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of innodb_support_xa in a temporary variable # +################################################################################ + + +SET @session_start_value = @@session.innodb_support_xa; +SELECT @session_start_value; + + +SET @global_start_value = @@global.innodb_support_xa; +SELECT @global_start_value; + + + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_support_xa # +######################################################################## + +SET @@session.innodb_support_xa = 0; +SET @@session.innodb_support_xa = DEFAULT; +SELECT @@session.innodb_support_xa; + +SET @@global.innodb_support_xa = 0; +SET @@global.innodb_support_xa = DEFAULT; +SELECT @@global.innodb_support_xa; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +########################################################################## +# Check if innodb_support_xa can be accessed with and without @@ sign # +########################################################################## + +SET innodb_support_xa = 1; +SELECT @@innodb_support_xa; + +--Error ER_UNKNOWN_TABLE +SELECT session.innodb_support_xa; + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_support_xa; + +--Error ER_UNKNOWN_TABLE +SELECT global.innodb_support_xa; +#using another syntax for accessing system variables +SET session innodb_support_xa = 0; +SELECT @@session.innodb_support_xa; + +SET global innodb_support_xa = 0; +SELECT @@global.innodb_support_xa; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_support_xa to a valid value # +########################################################################## +# for session +SET @@session.innodb_support_xa = 0; +SELECT @@session.innodb_support_xa; +SET @@session.innodb_support_xa = 1; +SELECT @@session.innodb_support_xa; + +# for global +SET @@global.innodb_support_xa = 0; +SELECT @@global.innodb_support_xa; +SET @@global.innodb_support_xa = 1; +SELECT @@global.innodb_support_xa; + + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_support_xa to invalid value # +########################################################################### + +# for session +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = -0.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = 1.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = ÕN; + +SET @@session.innodb_support_xa = OF; +SELECT @@session.innodb_support_xa; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_support_xa = ÓFF; + +# for global + + +SET @@global.innodb_support_xa = -1; +SELECT @@global.innodb_support_xa; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = ÕN; + +SET @@global.innodb_support_xa = OF; +SELECT @@global.innodb_support_xa; + +--echo 'Bug# 34828 : OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_support_xa = ÓFF; + + +--echo '#-------------------FN_DYNVARS_046_05----------------------------#' +########################################################################### +# Test if changing global variable effects session and vice versa # +########################################################################### + +SET @@global.innodb_support_xa = 0; +SET @@session.innodb_support_xa = 1; +SELECT @@global.innodb_support_xa AS res_is_0; + +SET @@global.innodb_support_xa = 0; +SELECT @@session.innodb_support_xa AS res_is_1; + +--echo '#----------------------FN_DYNVARS_046_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_support_xa = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_support_xa'; +SELECT @@global.innodb_support_xa; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_support_xa'; + + +--echo '#----------------------FN_DYNVARS_046_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.innodb_support_xa = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='innodb_support_xa'; +SELECT @@session.innodb_support_xa; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='innodb_support_xa'; + + +--echo '#---------------------FN_DYNVARS_046_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.innodb_support_xa = OFF; +SELECT @@session.innodb_support_xa; +SET @@session.innodb_support_xa = ON; +SELECT @@session.innodb_support_xa; + +SET @@global.innodb_support_xa = OFF; +SELECT @@global.innodb_support_xa; +SET @@global.innodb_support_xa = ON; +SELECT @@global.innodb_support_xa; + +--echo '#---------------------FN_DYNVARS_046_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.innodb_support_xa = TRUE; +SELECT @@session.innodb_support_xa; +SET @@session.innodb_support_xa = FALSE; +SELECT @@session.innodb_support_xa; + +SET @@global.innodb_support_xa = TRUE; +SELECT @@global.innodb_support_xa; +SET @@global.innodb_support_xa = FALSE; +SELECT @@global.innodb_support_xa; + +############################## +# Restore initial value # +############################## + +SET @@session.innodb_support_xa = @session_start_value; +SELECT @@session.innodb_support_xa; + +SET @@global.innodb_support_xa = @global_start_value; +SELECT @@global.innodb_support_xa; + +############################################################### +# END OF innodb_support_xa TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test new file mode 100644 index 00000000000..f1b6fe84fe1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_func.test @@ -0,0 +1,138 @@ +################# mysql-test\t\innodb_support_xa_func.test ################### +# # +# Variable Name: innodb_support_xa # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable innodb_support_xa # +# that checks the behavior of this variable in the following ways# +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--echo '#--------------------FN_DYNVARS_046_01-------------------------#' +#################################################################### +# Check if setting innodb_support_xa is changed in new connection # +#################################################################### + +SET @@global.innodb_support_xa = OFF; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.innodb_support_xa; +SELECT @@session.innodb_support_xa; +disconnect con1; + + +--echo '#--------------------FN_DYNVARS_046_01-------------------------#' +########################################################### +# Begin the functionality Testing of innodb_support_xa # +########################################################### + +--echo 'connection default' +connection default; +SET @@global.innodb_support_xa = 1; + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +create table t1 (a int) engine=innodb; + +#==================================================== +--echo '---check when innodb_support_xa is 1---' +#==================================================== + + +SET @@innodb_support_xa = 1; + +xa start 'test1'; +INSERT t1 values (10); +xa end 'test1'; +xa prepare 'test1'; +xa rollback 'test1'; +SELECT * from t1; + +#==================================================== +--echo '---check when innodb_support_xa is 0---' +#==================================================== + +SET @@innodb_support_xa = 0; +# +xa start 'test1'; +INSERT t1 values (10); +xa end 'test1'; +xa prepare 'test1'; +xa rollback 'test1'; +SELECT * from t1; + +#==================================================== +--echo '------general xa testing--------' +#==================================================== + +SET @@global.innodb_support_xa = 1; +SET @@innodb_support_xa = 1; + +xa start 'testa','testb'; +INSERT t1 values (30); +--Error ER_XAER_RMFAIL +COMMIT; +xa end 'testa','testb'; +--Error ER_XAER_RMFAIL +BEGIN; +--Error ER_XAER_RMFAIL +CREATE table t2 (a int); +--echo 'connect (con1,localhost,root,,,,)' +CONNECT (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; + +--Error ER_XAER_DUPID +xa start 'testa','testb'; +--Error ER_XAER_DUPID +xa start 'testa','testb', 123; + +# gtrid [ , bqual [ , formatID ] ] +xa start 0x7465737462, 0x2030405060, 0xb; +INSERT t1 values (40); +xa end 'testb',' 0@P`',11; +xa prepare 'testb',0x2030405060,11; + +--Error ER_XAER_RMFAIL +START TRANSACTION; +xa recover; + +# uncomment the line below when binlog will be able to prepare +#disconnect con1; + +--echo 'connection default' +CONNECTION default; +xa prepare 'testa','testb'; +xa recover; +--Error ER_XAER_NOTA +xa commit 'testb',0x2030405060,11; +xa commit 'testa','testb'; + +--echo 'connection con1' +CONNECTION con1; +xa rollback 'testb',0x2030405060,11; + +SELECT * from t1; + +DROP table t1; + +######################################################## +# End of functionality Testing for innodb_support_xa # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test new file mode 100644 index 00000000000..35961c43a7f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test @@ -0,0 +1,232 @@ +################# mysql-test\t\innodb_table_locks_basic.test ################## +# # +# Variable Name: innodb_table_locks # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-20 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable innodb_table_locks # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_table_locks TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of innodb_table_locks in a temporary variable # +################################################################################ + + +SET @session_start_value = @@session.innodb_table_locks; +SELECT @session_start_value; + + +SET @global_start_value = @@global.innodb_table_locks; +SELECT @global_start_value; + + + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_table_locks # +######################################################################## + +SET @@session.innodb_table_locks = 0; +SET @@session.innodb_table_locks = DEFAULT; +SELECT @@session.innodb_table_locks; + +SET @@global.innodb_table_locks = 0; +SET @@global.innodb_table_locks = DEFAULT; +SELECT @@global.innodb_table_locks; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +############################################################################### +# Check if innodb_table_locks can be accessed with and without @@ sign # +############################################################################### + +SET innodb_table_locks = 1; +SELECT @@innodb_table_locks; + +--Error ER_UNKNOWN_TABLE +SELECT session.innodb_table_locks; + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_table_locks; + +--Error ER_UNKNOWN_TABLE +SELECT global.innodb_table_locks; +#using another syntax for accessing system variables +SET session innodb_table_locks = 0; +SELECT @@session.innodb_table_locks; + +SET global innodb_table_locks = 0; +SELECT @@global.innodb_table_locks; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_table_locks to a valid value # +########################################################################## +# for session +SET @@session.innodb_table_locks = 0; +SELECT @@session.innodb_table_locks; +SET @@session.innodb_table_locks = 1; +SELECT @@session.innodb_table_locks; + +# for global +SET @@global.innodb_table_locks = 0; +SELECT @@global.innodb_table_locks; +SET @@global.innodb_table_locks = 1; +SELECT @@global.innodb_table_locks; + + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_table_locks to invalid value # +########################################################################### + +# for session + +SET @@session.innodb_table_locks = -6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = 1.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = ÕN; + +SET @@session.innodb_table_locks = OF; +SELECT @@session.innodb_table_locks; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.innodb_table_locks = ÓFF; + +# for global + + +SET @@global.innodb_table_locks = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_table_locks = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_table_locks = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_table_locks = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_table_locks = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.innodb_table_locks = QN; + +SET @@global.innodb_table_locks = OF; +SELECT @@global.innodb_table_locks; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_TYPE_FOR_VAR +#SET @@global.innodb_table_locks = ÓFF; + + +--echo '#-------------------FN_DYNVARS_046_05----------------------------#' +########################################################################### +# Test if changing global variable effects session and vice versa # +########################################################################### + +SET @@global.innodb_table_locks = 0; +SET @@session.innodb_table_locks = 1; +SELECT @@global.innodb_table_locks AS res_is_0; + +SET @@global.innodb_table_locks = 0; +SELECT @@session.innodb_table_locks AS res_is_1; + +--echo '#----------------------FN_DYNVARS_046_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_table_locks = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_table_locks'; +SELECT @@global.innodb_table_locks; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_table_locks'; + +--echo '#----------------------FN_DYNVARS_046_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.innodb_table_locks = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='innodb_table_locks'; +SELECT @@session.innodb_table_locks; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='innodb_table_locks'; + + +--echo '#---------------------FN_DYNVARS_046_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.innodb_table_locks = OFF; +SELECT @@session.innodb_table_locks; +SET @@session.innodb_table_locks = ON; +SELECT @@session.innodb_table_locks; + +SET @@global.innodb_table_locks = OFF; +SELECT @@global.innodb_table_locks; +SET @@global.innodb_table_locks = ON; +SELECT @@global.innodb_table_locks; + +--echo '#---------------------FN_DYNVARS_046_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.innodb_table_locks = TRUE; +SELECT @@session.innodb_table_locks; +SET @@session.innodb_table_locks = FALSE; +SELECT @@session.innodb_table_locks; + +SET @@global.innodb_table_locks = TRUE; +SELECT @@global.innodb_table_locks; +SET @@global.innodb_table_locks = FALSE; +SELECT @@global.innodb_table_locks; + +############################## +# Restore initial value # +############################## + +SET @@session.innodb_table_locks = @session_start_value; +SELECT @@session.innodb_table_locks; + +SET @@global.innodb_table_locks = @global_start_value; +SELECT @@global.innodb_table_locks; + +############################################################### +# END OF innodb_table_locks TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test new file mode 100644 index 00000000000..6638a20c926 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test @@ -0,0 +1,94 @@ +################# mysql-test\t\innodb_table_locks_func.test ################## +# # +# Variable Name: innodb_table_locks # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable innodb_table_locks # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/have_innodb.inc + +--echo '#--------------------FN_DYNVARS_048_01-------------------------#' +#################################################################### +# Check if setting innodb_table_locks is changed in new connection # +#################################################################### + +SET @start_value= @@global.innodb_table_locks; +SELECT @start_value; + +SET @@global.innodb_table_locks = OFF; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.innodb_table_locks; +SELECT @@session.innodb_table_locks; +disconnect con1; + + +--echo '#--------------------FN_DYNVARS_048_02-------------------------#' +########################################################### +# Begin the functionality Testing of innodb_table_locks # +########################################################### + +#============================================================================== +--echo '----check when innodb_table_locks = ON and autocommit = OFF---' +#============================================================================== +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (a INT) ENGINE=INNODB; + +SET @@autocommit = OFF; +SET @@innodb_table_locks = ON; + +BEGIN; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1 FOR UPDATE; + +--echo 'CONNECTION con2' +CONNECTION con2; +SET @@innodb_table_locks = ON; +SET @@autocommit = OFF; +send LOCK TABLES t1 WRITE; + +--echo 'CONNECTION default' +CONNECTION default; +COMMIT; + +--echo 'CONNECTION con2' +CONNECTION con2; +UNLOCK tables; + +DROP TABLE t1; +disconnect con2; + +connection default; +SET @@global.innodb_table_locks= @start_value; +SELECT @@global.innodb_table_locks; + +########################################################## +# End of functionality Testing for innodb_table_locks # +########################################################## + + diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_basic.test new file mode 100644 index 00000000000..40ce09ce4db --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_thread_concurrency_basic.test @@ -0,0 +1,151 @@ +################# mysql-test\t\innodb_thread_concurrency_basic.test ########### +# # +# Variable Name: innodb_thread_concurrency # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 8 # +# Range: 0-1000 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +#Description:Test Cases of Dynamic System Variable innodb_thread_concurrency # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +######################################################################## +# START OF innodb_thread_concurrency TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of innodb_thread_concurrency in a temporary variable # +################################################################################ + + +SET @global_start_value = @@global.innodb_thread_concurrency; +SELECT @global_start_value; + + + +--echo '#--------------------FN_DYNVARS_046_01------------------------#' +######################################################################## +# Display the DEFAULT value of innodb_thread_concurrency # +######################################################################## + + + +SET @@global.innodb_thread_concurrency = 0; +SET @@global.innodb_thread_concurrency = DEFAULT; +SELECT @@global.innodb_thread_concurrency; + +--echo '#---------------------FN_DYNVARS_046_02-------------------------#' +############################################################################### +# Check if innodb_thread_concurrency can be accessed with and without @@ sign # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET innodb_thread_concurrency = 1; +SELECT @@innodb_thread_concurrency; + + +--Error ER_UNKNOWN_TABLE +SELECT local.innodb_thread_concurrency; + + +SET global innodb_thread_concurrency = 0; +SELECT @@global.innodb_thread_concurrency; + + +--echo '#--------------------FN_DYNVARS_046_03------------------------#' +########################################################################## +# change the value of innodb_thread_concurrency to a valid value # +########################################################################## + + +SET @@global.innodb_thread_concurrency = 0; +SELECT @@global.innodb_thread_concurrency; + +SET @@global.innodb_thread_concurrency = 1; +SELECT @@global.innodb_thread_concurrency; +SET @@global.innodb_thread_concurrency = 1000; +SELECT @@global.innodb_thread_concurrency; + +--echo '#--------------------FN_DYNVARS_046_04-------------------------#' +########################################################################### +# Change the value of innodb_thread_concurrency to invalid value # +########################################################################### + +SET @@global.innodb_thread_concurrency = -1; +SELECT @@global.innodb_thread_concurrency; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_thread_concurrency = "T"; +SELECT @@global.innodb_thread_concurrency; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_thread_concurrency = "Y"; +SELECT @@global.innodb_thread_concurrency; + + +SET @@global.innodb_thread_concurrency = 1001; +SELECT @@global.innodb_thread_concurrency; + +--echo '#----------------------FN_DYNVARS_046_05------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.innodb_thread_concurrency = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_thread_concurrency'; +SELECT @@global.innodb_thread_concurrency; +SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='innodb_thread_concurrency'; + +--echo '#---------------------FN_DYNVARS_046_06-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_thread_concurrency = OFF; +SELECT @@global.innodb_thread_concurrency; + +--ERROR ER_WRONG_TYPE_FOR_VAR +SET @@global.innodb_thread_concurrency = ON; +SELECT @@global.innodb_thread_concurrency; + +--echo '#---------------------FN_DYNVARS_046_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.innodb_thread_concurrency = TRUE; +SELECT @@global.innodb_thread_concurrency; +SET @@global.innodb_thread_concurrency = FALSE; +SELECT @@global.innodb_thread_concurrency; + +############################## +# Restore initial value # +############################## + +SET @@global.innodb_thread_concurrency = @global_start_value; +SELECT @@global.innodb_thread_concurrency; + +############################################################### +# END OF innodb_thread_concurrency TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/insert_id_basic.test b/mysql-test/suite/sys_vars/t/insert_id_basic.test new file mode 100644 index 00000000000..cfae87095bc --- /dev/null +++ b/mysql-test/suite/sys_vars/t/insert_id_basic.test @@ -0,0 +1,192 @@ +############## mysql-test\t\insert_id_basic.test ############### +# # +# Variable Name: insert_id # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:- # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable insert_id # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################ +# START OF insert_id TESTS # +################################################################ + + +################################################################ +# Saving initial value of insert_id in a temporary variable # +################################################################ + +SET @start_value = @@session.insert_id; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_051_01------------------------#' +################################################################# +# Display the DEFAULT value of insert_id # +################################################################# + +SET @@session.insert_id = 99; +# SET @@session.insert_id = DEFAULT; +--echo 'Variable is giving error on assigning Default value'; +SELECT @@session.insert_id; + + +--echo '#---------------------FN_DYNVARS_051_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@session.insert_id = @start_value; +SELECT @@session.insert_id = 0; + + +--echo '#--------------------FN_DYNVARS_051_03------------------------#' +################################################################# +# Change the value of insert_id to a valid value # +################################################################# + +SET @@session.insert_id = 0; +SELECT @@session.insert_id; +SET @@session.insert_id = 1099; +SELECT @@session.insert_id; +SET @@session.insert_id = 1800; +SELECT @@session.insert_id; +SET @@session.insert_id = 65535; +SELECT @@session.insert_id; + + +--echo '#--------------------FN_DYNVARS_051_04-------------------------#' +#################################################################### +# Change the value of insert_id to invalid value # +#################################################################### + +SET @@session.insert_id = -1; +SELECT @@session.insert_id; +SET @@session.insert_id = 100000000000; +SELECT @@session.insert_id; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.insert_id = 10000.01; +SELECT @@session.insert_id; +SET @@session.insert_id = -1024; +SELECT @@session.insert_id; +SET @@session.insert_id = 42949672950; +SELECT @@session.insert_id; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.insert_id = ON; +SELECT @@session.insert_id; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.insert_id = 'test'; +SELECT @@session.insert_id; + + +--echo '#-------------------FN_DYNVARS_051_05----------------------------#' +################################################################### +# Test if accessing global insert_id gives error # +################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.insert_id = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.insert_id; + + +--echo '#----------------------FN_DYNVARS_051_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.insert_id = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='insert_id'; + +SELECT @@session.insert_id = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='insert_id'; + + +--echo '#-------------------FN_DYNVARS_051_07----------------------------#' +###################################################################### +# Test if accessing GLOBAL identity gives error # +###################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.insert_id = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.insert_id; + + +--echo '#---------------------FN_DYNVARS_051_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.insert_id = TRUE; +SELECT @@session.insert_id; +SET @@session.insert_id = FALSE; +SELECT @@session.insert_id; + + +--echo '#---------------------FN_DYNVARS_051_09----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@session.insert_id = 1; +SELECT @@insert_id = @@session.insert_id; +SELECT @@session.insert_id = @@local.insert_id; + + +--echo '#---------------------FN_DYNVARS_051_10----------------------#' +################################################################### +# Check if insert_id can be accessed with and without @@ sign # +################################################################### + + +SET insert_id = 1; +SELECT @@insert_id; +--Error ER_PARSE_ERROR +SET local.insert_id = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.insert_id; +--Error ER_PARSE_ERROR +SET session.insert_id = 1; +--Error ER_UNKNOWN_TABLE +SELECT session.insert_id; +--Error ER_BAD_FIELD_ERROR +SELECT insert_id = @@session.insert_id; + + +############################## +# Restore initial value # +############################## + +SET @@session.insert_id = @start_value; +SELECT @@session.insert_id; + + +################################################################# +# END OF insert_id TESTS # +################################################################# + diff --git a/mysql-test/suite/sys_vars/t/insert_id_func.test b/mysql-test/suite/sys_vars/t/insert_id_func.test new file mode 100644 index 00000000000..d7103f806bd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/insert_id_func.test @@ -0,0 +1,113 @@ +################### mysql-test\t\insert_id_func.test ########################## +# # +# Variable Name: insert_id # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:- # +# Range: - # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable insert_id # +# that checks the functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo '#--------------------FN_DYNVARS_051_01-------------------------#' +####################################################################### +# Setting initial value of insert_id and verifying its behavior # +####################################################################### + +--echo ## Setting value of variable to 100 ## +SET @@session.insert_id = 100; +SELECT @@session.insert_id; + +--echo ## Inserting some rows in table ## +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); + +--echo ## Verifying rows in table ## +SELECT * from t1; +SELECT @@session.insert_id; + +INSERT into t1(name) values('Record_3'); + + + +--echo '#--------------------FN_DYNVARS_051_02-------------------------#' +########################################################## +# Verifying value of insert_id with new connection # +########################################################## + +--echo ## Creating & Connecting new connection test_con1 ## +connect (test_con1, localhost, root,,); +connection test_con1; + +--echo ## Setting value of insert_id to 50 ## +SET @@session.insert_id = 50; +SELECT @@session.insert_id; + +--echo ## Inserting rows in table t1 ## +INSERT into t1(name) values('Record_4'); +INSERT into t1(name) values('Record_5'); +INSERT into t1(name) values('Record_6'); + +SELECT * from t1; + +--echo 'Bug#35376 Value of insert_id automatically resets to 0 after inserting +--echo ' 1st row' + +--echo '#--------------------FN_DYNVARS_051_03-------------------------#' +############################################################################# +# Now verifying some new value of insert_id with second new connection # +############################################################################# + +--echo ## Creating and switching to new connection test_con2 ## +connect (test_con2, localhost, root,,); +connection test_con2; + +--echo ## Setting session value of variable to 25 ## +SET @@session.insert_id = 25; + +--echo ## Inserting some rows in table ## +INSERT into t1(name) values('Record_7'); +INSERT into t1(name) values('Record_8'); + +--echo ## Verifying data in table t1 ## +SELECT * from t1; + + +--echo ## Dropping table t1 ## +drop table t1; + +--echo ## Disconnecting connections ## +disconnect test_con1; +disconnect test_con2; + + + + + diff --git a/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test new file mode 100644 index 00000000000..0c1a6716348 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/interactive_timeout_basic.test @@ -0,0 +1,207 @@ +############## mysql-test\t\interactive_timeout_basic.test ############### +# # +# Variable Name: interactive_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:28800 # +# Minvalue: 1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable interactive_timeout # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################### +# START OF interactive_timeout TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.interactive_timeout; +SELECT @start_global_value; +SET @start_session_value = @@session.interactive_timeout; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_052_01-------------------------#' +################################################################### +# Display the DEFAULT value of interactive_timeout # +################################################################### + +SET @@global.interactive_timeout = 100; +SET @@global.interactive_timeout = DEFAULT; +SELECT @@global.interactive_timeout; + +SET @@session.interactive_timeout = 200; +SET @@session.interactive_timeout = DEFAULT; +SELECT @@session.interactive_timeout; + + +--echo '#--------------------FN_DYNVARS_052_02-------------------------#' +################################################################### +# Check the DEFAULT value of interactive_timeout # +################################################################### + +SET @@global.interactive_timeout = DEFAULT; +SELECT @@global.interactive_timeout = 28800; + +SET @@session.interactive_timeout = DEFAULT; +SELECT @@session.interactive_timeout = 28800; + + +--echo '#--------------------FN_DYNVARS_052_03-------------------------#' +############################################################################# +# Change the value of interactive_timeout to a valid value for GLOBAL Scope # +############################################################################# + +SET @@global.interactive_timeout = 1; +SELECT @@global.interactive_timeout; +SET @@global.interactive_timeout = 60020; +SELECT @@global.interactive_timeout; +SET @@global.interactive_timeout = 65535; +SELECT @@global.interactive_timeout; + + +--echo '#--------------------FN_DYNVARS_052_04-------------------------#' +############################################################################## +# Change the value of interactive_timeout to a valid value for SESSION Scope # +############################################################################## + +SET @@session.interactive_timeout = 1; +SELECT @@session.interactive_timeout; +SET @@session.interactive_timeout = 50050; +SELECT @@session.interactive_timeout; +SET @@session.interactive_timeout = 65535; +SELECT @@session.interactive_timeout; + + +--echo '#------------------FN_DYNVARS_052_05-----------------------#' +############################################################### +# Change the value of interactive_timeout to an invalid value # +############################################################### + +SET @@global.interactive_timeout = 0; +SELECT @@global.interactive_timeout; +SET @@global.interactive_timeout = -1024; +SELECT @@global.interactive_timeout; +SET @@global.interactive_timeout = 1000000000; +SELECT @@global.interactive_timeout; +--Error ER_PARSE_ERROR +SET @@global.interactive_timeout = 65530.34.; +SELECT @@global.interactive_timeout; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.interactive_timeout = test; +SELECT @@global.interactive_timeout; + +SET @@session.interactive_timeout = 0; +SELECT @@session.interactive_timeout; +SET @@session.interactive_timeout = -2; +SELECT @@session.interactive_timeout; +--Error ER_PARSE_ERROR +SET @@session.interactive_timeout = 65530.34.; +SET @@session.interactive_timeout = 100000000; +SELECT @@session.interactive_timeout; +echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.interactive_timeout = test; +SELECT @@session.interactive_timeout; + + +--echo '#------------------FN_DYNVARS_052_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.interactive_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='interactive_timeout'; + +--echo '#------------------FN_DYNVARS_052_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.interactive_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='interactive_timeout'; + + +--echo '#------------------FN_DYNVARS_052_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.interactive_timeout = TRUE; +SELECT @@global.interactive_timeout; +SET @@global.interactive_timeout = FALSE; +SELECT @@global.interactive_timeout; + + +--echo '#---------------------FN_DYNVARS_052_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.interactive_timeout = 10; +SELECT @@interactive_timeout = @@global.interactive_timeout; + + +--echo '#---------------------FN_DYNVARS_052_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@interactive_timeout = 100; +SELECT @@interactive_timeout = @@local.interactive_timeout; +SELECT @@local.interactive_timeout = @@session.interactive_timeout; + + +--echo '#---------------------FN_DYNVARS_052_11----------------------#' +############################################################################## +# Check if interactive_timeout can be accessed with and without @@ sign # +############################################################################## + +SET interactive_timeout = 1; +SELECT @@interactive_timeout; +--Error ER_UNKNOWN_TABLE +SELECT local.interactive_timeout; +--Error ER_UNKNOWN_TABLE +SELECT session.interactive_timeout; +--Error ER_BAD_FIELD_ERROR +SELECT interactive_timeout = @@session.interactive_timeout; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.interactive_timeout = @start_global_value; +SELECT @@global.interactive_timeout; +SET @@session.interactive_timeout = @start_session_value; +SELECT @@session.interactive_timeout; + + +######################################################## +# END OF interactive_timeout TESTS # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/interactive_timeout_func.test b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test new file mode 100644 index 00000000000..e3a210bf508 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test @@ -0,0 +1,70 @@ +############## mysql-test\t\interactive_timeout_func.test ##################### +# # +# Variable Name: interactive_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:28800 # +# Minvalue: 1 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable interactive_timeout # +# that checks the functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + + +--disable_warnings +drop table if exists t1; +--enable_warnings + +############################## +# Creating two new tables # +############################## + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + + +--echo '#--------------------FN_DYNVARS_052_01-------------------------#' +####################################################################### +# Setting initial value of interactive_timeout to 1 and verifying its +# behavior +####################################################################### + +--echo ## Setting initial value of variable to 1 ## +SET @@global.interactive_timeout = 1; + +--echo ## Creating new interactive connection test_con1 ## +connect (test_con1, localhost, root,); +connection test_con1; + +--echo ## Inserting record in table ## +INSERT into t1(name) values('Record_1'); + +--echo ## Setting session value of interactive_timeout ## +SET @@session.interactive_timeout = 1; + +--echo ## Verifying values of variable ## +SELECT @@session.interactive_timeout; +SELECT @@global.interactive_timeout; + +--echo ## Using sleep to check timeout ## +sleep 5; +SELECT * from t1; + +--echo 'Bug#35377: Error should appear here because interactive_timeout value'; +--echo 'is 1 and connection remains idle for 5 secs'; + +INSERT into t1(name) values('Record_2'); diff --git a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test new file mode 100644 index 00000000000..a855f56c863 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test @@ -0,0 +1,222 @@ +############## mysql-test\t\keep_files_on_create_basic.test ################### +# # +# Variable Name: keep_files_on_create # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: OFF # +# Range: # +# # +# # +# Creation Date: 2008-02-11 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable keep_files_on_create # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_keep_files_on_create # +# # +############################################################################### + +--source include/load_sysvars.inc + +#################################################################### +# START OF keep_files_on_create TESTS # +#################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.keep_files_on_create; +SELECT @start_global_value; +SET @start_session_value = @@session.keep_files_on_create; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_054_01-------------------------#' +######################################################################## +# Display the DEFAULT value of keep_files_on_create # +######################################################################## + +SET @@global.keep_files_on_create = ON; +SET @@global.keep_files_on_create = DEFAULT; +SELECT @@global.keep_files_on_create; + +SET @@session.keep_files_on_create = ON; +SET @@session.keep_files_on_create = DEFAULT; +SELECT @@session.keep_files_on_create; + + +--echo '#--------------------FN_DYNVARS_054_02-------------------------#' +######################################################################## +# Check the DEFAULT value of keep_files_on_create # +######################################################################## + +SET @@global.keep_files_on_create = DEFAULT; +SELECT @@global.keep_files_on_create = 'OFF'; + +SET @@session.keep_files_on_create = DEFAULT; +SELECT @@session.keep_files_on_create = 'OFF'; + + +--echo '#--------------------FN_DYNVARS_054_03-------------------------#' +############################################################################## +# Change the value of keep_files_on_create to a valid value for GLOBAL Scope # +############################################################################## + +SET @@global.keep_files_on_create = ON; +SELECT @@global.keep_files_on_create; +SET @@global.keep_files_on_create = OFF; +SELECT @@global.keep_files_on_create; +SET @@global.keep_files_on_create = 0; +SELECT @@global.keep_files_on_create; +SET @@global.keep_files_on_create = 1; +SELECT @@global.keep_files_on_create; +SET @@global.keep_files_on_create = TRUE; +SELECT @@global.keep_files_on_create; +SET @@global.keep_files_on_create = FALSE; +SELECT @@global.keep_files_on_create; + + + +--echo '#--------------------FN_DYNVARS_054_04-------------------------#' +############################################################################### +# Change the value of keep_files_on_create to a valid value for SESSION Scope # +############################################################################### + +SET @@session.keep_files_on_create = ON; +SELECT @@session.keep_files_on_create; +SET @@session.keep_files_on_create = OFF; +SELECT @@session.keep_files_on_create; +SET @@session.keep_files_on_create = 0; +SELECT @@session.keep_files_on_create; +SET @@session.keep_files_on_create = 1; +SELECT @@session.keep_files_on_create; +SET @@session.keep_files_on_create = TRUE; +SELECT @@session.keep_files_on_create; +SET @@session.keep_files_on_create = FALSE; +SELECT @@session.keep_files_on_create; + + +--echo '#------------------FN_DYNVARS_054_05-----------------------#' +################################################################ +# Change the value of keep_files_on_create to an invalid value # +################################################################ + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = "OFFF"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.keep_files_on_create = test; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = ONF; + +SET @@session.keep_files_on_create = OF; +SELECT @@session.keep_files_on_create; +--echo 'Bug# 34828: FN_DYNVARS_054_05 - OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = 'OFN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = -2; +--Error ER_PARSE_ERROR +SET @@session.keep_files_on_create = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = 65550; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.keep_files_on_create = test; +SELECT @@session.keep_files_on_create; + + +--echo '#------------------FN_DYNVARS_054_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.keep_files_on_create = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='keep_files_on_create'; + +--echo '#------------------FN_DYNVARS_054_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.keep_files_on_create = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='keep_files_on_create'; + + +--echo '#---------------------FN_DYNVARS_001_08----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + +SET @@keep_files_on_create = OFF; +SET @@global.keep_files_on_create = ON; +SELECT @@keep_files_on_create = @@global.keep_files_on_create; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@keep_files_on_create = ON; +SELECT @@keep_files_on_create = @@local.keep_files_on_create; +SELECT @@local.keep_files_on_create = @@session.keep_files_on_create; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################### +# Check if keep_files_on_create can be accessed with and without @@ sign # +############################################################################### + +SET keep_files_on_create = 1; +SELECT @@keep_files_on_create; +--Error ER_UNKNOWN_TABLE +SELECT local.keep_files_on_create; +--Error ER_UNKNOWN_TABLE +SELECT session.keep_files_on_create; +--Error ER_BAD_FIELD_ERROR +SELECT keep_files_on_create = @@session.keep_files_on_create; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.keep_files_on_create = @start_global_value; +SELECT @@global.keep_files_on_create; +SET @@session.keep_files_on_create = @start_session_value; +SELECT @@session.keep_files_on_create; + + +######################################################### +# END OF keep_files_on_create TESTS # +######################################################### + diff --git a/mysql-test/suite/sys_vars/t/key_buffer_size_func.test b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test new file mode 100644 index 00000000000..8ee305a3ac1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test @@ -0,0 +1,125 @@ +################### mysql-test\t\key_buffer_size_func.test #################### +# # +# Variable Name: key_buffer_size # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 131072 # +# Range:8-4294967295 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable key_buffer_size # +# that checks the functionality of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id), +rollno INT NOT NULL, +name VARCHAR(30) +); + +SET @start_value= @@global.key_buffer_size; + +FLUSH STATUS; + +--echo '#--------------------FN_DYNVARS_055_01-------------------------#' +######################################################################## +# Setting initial value of key_buffer_size, inserting some rows +# & creating 2 new connections +######################################################################## + +--echo ## Setting initial value of variable to 131072 ## +SET @@global.key_buffer_size = 131072; + + +--echo ## Creating two new connections ## +CONNECT (test_con1,localhost,root,,); +CONNECT (test_con2,localhost,root,,); + + +--echo '#--------------------FN_DYNVARS_055_02-------------------------#' +############################################################################### +# Verifying initial behavior of variable by concatinating values greater than 4 +############################################################################### + +--echo ## Connecting with connection test_con1 ## +CONNECTION test_con1; +SELECT @@global.key_buffer_size; + + +--echo ## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(1, 'Record_1'); +INSERT INTO t1(rollno, name) VALUES(2, 'Record_2'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_3'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_4'); +INSERT INTO t1(rollno, name) VALUES(1, 'Record_5'); +INSERT INTO t1(rollno, name) VALUES(3, 'Record_6'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_7'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_8'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_9'); +INSERT INTO t1(rollno, name) VALUES(4, 'Record_10'); + +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; + +--echo ## Switching to connection test_con2 ## +connection test_con2; + +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; + +CONNECTION default; +--disable_warnings +SET @@global.key_buffer_size = 36; +--enable_warnings + +--echo ## Connecting with connection test_con1 ## +CONNECTION test_con1; + +--echo ## Inserting some rows in table ## +INSERT INTO t1(rollno, name) VALUES(5, 'Record_11'); +INSERT INTO t1(rollno, name) VALUES(6, 'Record_12'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_13'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_14'); +INSERT INTO t1(rollno, name) VALUES(5, 'Record_15'); +INSERT INTO t1(rollno, name) VALUES(7, 'Record_16'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_17'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_18'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_19'); +INSERT INTO t1(rollno, name) VALUES(8, 'Record_20'); + +--echo ## Key_reads must be zero (no disk access) ## +show status like 'Key_reads'; + +############################################################ +# Disconnecting all connection & dropping table # +############################################################ + +--echo ## Dropping table ## +DROP TABLE IF EXISTS t1; + +--echo ## Disconnecting both the connections ## +DISCONNECT test_con2; +DISCONNECT test_con1; + +connection default; +SET @@global.key_buffer_size= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt new file mode 100644 index 00000000000..66f581b56d0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func-master.opt @@ -0,0 +1,2 @@ +--innodb + diff --git a/mysql-test/suite/sys_vars/t/last_insert_id_func.test b/mysql-test/suite/sys_vars/t/last_insert_id_func.test new file mode 100644 index 00000000000..2309c539bd9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/last_insert_id_func.test @@ -0,0 +1,147 @@ +################# mysql-test\t\last_insert_id_func.test ####################### +# # +# Variable Name: last_insert_id # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: - # +# Range: - # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable key_buffer_size # +# that checks the functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/have_innodb.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +) ENGINE = INNODB; + +--echo '#--------------------FN_DYNVARS_059_01-------------------------#' +####################################################################### +# Setting initial value of last_insert_id and verifying its behavior # +####################################################################### + +--echo ## Verifying initial value of ## +SELECT @@session.last_insert_id; + +--echo ## Inserting records in table t1 ## +INSERT into t1(name) values('Record_1'); +INSERT into t1(name) values('Record_2'); +SELECT * from t1; + +--echo ## Verifying value of variable after inserting some rows ## +SELECT @@session.last_insert_id = 2; + + +--echo '#--------------------FN_DYNVARS_059_02-------------------------#' +################################################################################# +# Verifying value of last_insert_id with new connection without committing rows # +################################################################################# + +--echo ## Creating & connecting to new connection test_con1 ## +connect (test_con1, localhost, root,,); +connection test_con1; + +SET @@autocommit = 0; + +--echo ## Verifying initial value of variable in new connection ## +SELECT @@session.last_insert_id; + +--echo ## Inserting rows in table t1 ## +START TRANSACTION; +INSERT into t1(name) values('Record_3'); +INSERT into t1(name) values('Record_4'); +INSERT into t1(name) values('Record_5'); + +--echo ## Verifying value of variable without committing rows ## +SELECT @@session.last_insert_id; + +--echo '#--------------------FN_DYNVARS_059_03-------------------------#' +######################################################################### +# Now verifying value of last_insert_id with second new connection # +######################################################################### + +--echo ## Creating & connecting to new connection test_con2 ## +connect (test_con2, localhost, root,,); +connection test_con2; + +--echo ## Inserting values through new connection ## +INSERT into t1(name) values('Record_6'); +INSERT into t1(name) values('Record_7'); + +SELECT * from t1; + +--echo ## Verifying value of variable in second connection ## +SELECT @@last_insert_id; + + + +--echo '#--------------------FN_DYNVARS_059_04-------------------------#' +############################################################################ +# Now verifying value of last_insert_id after committing rows in +# connection # 1 +############################################################################ + +--echo ## Switching to test_con1 ## +connection test_con1; + +--echo ## Verifying all records in table & value of variable ## +SELECT * from t1; +SELECT @@session.last_insert_id; + +--echo ## Commiting records in table ## +COMMIT; +SELECT @@session.last_insert_id; + + +--echo ## Switching to test_con2 & verifying value of variable in it ## +connection test_con2; +SELECT @@session.last_insert_id; + + + +--echo '#--------------------FN_DYNVARS_059_05-------------------------#' +##################################################################### +# Verify value after explicitly setting value of variable # +##################################################################### + +--echo ## Setting value of variable ## +SET @@session.last_insert_id = 100; +SELECT @@session.last_insert_id; + +--echo ## Inserting new record and verifying variable's effect on it ## +INSERT into t1(name) values('Record_8'); +SELECT @@session.last_insert_id; + +--echo ## Dropping table t1 ## +drop table t1; + +--echo ## Disconnecting both the connections ## +disconnect test_con1; +disconnect test_con2; + + + + + diff --git a/mysql-test/suite/sys_vars/t/lc_time_names_basic.test b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test new file mode 100644 index 00000000000..d0aa0c56937 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/lc_time_names_basic.test @@ -0,0 +1,714 @@ +###################### mysql-test\t\lc_time_names_basic.test ################## +# # +# Variable Name: lc_time_names # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: en_ZA # +# Range: NA # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable lc_time_names # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +################################################### +## START OF lc_time_names TESTS ## +################################################### + +############################################################# +# Save initial value # +############################################################# + +SET @global_start_value = @@global.lc_time_names; +SELECT @global_start_value; +# Save initial session value +SET @session_start_value = @@lc_time_names; +SELECT @session_start_value; +# now save using local access +SET @session_start_value = @@local.lc_time_names; +SELECT @session_start_value; +# save using default access (session) +SET @session_start_value = @@session.lc_time_names; +SELECT @session_start_value; + + +--echo '#--------------------FN_DYNVARS_060_01------------------#' +############################################################################### +# Test Variable access and assignment with and withoud @@ # +############################################################################### + +# select without @@ +--error ER_BAD_FIELD_ERROR +SELECT lc_time_names; +# assign value without @@ +SET lc_time_names=ar_AE; +SELECT @@session.lc_time_names; +# assign global variable without @@ +--Error ER_PARSE_ERROR +SET global.lc_time_names=ar_AE; +# using another syntax for accessing session variable +SET session lc_time_names=ar_AE; +# accessing variable with scope the wrong way +--Error ER_BAD_FIELD_ERROR +SELECT session lc_time_names; +# using another syntax for accessing dynamic variable +SET global lc_time_names=ar_AE; +--Error ER_BAD_FIELD_ERROR +SELECT global lc_time_names; + + +--echo '#--------------------FN_DYNVARS_060_02-------------------------#' +############################################################################### +# Check the DEFAULT value of lc_time_names for session and global # +############################################################################### + +SET @@lc_time_names = en_ZA; +SET @@lc_time_names = DEFAULT; +SELECT @@lc_time_names AS DEFAULT_VALUE; + +SET @@global.lc_time_names = en_ZA; +SET @@global.lc_time_names = DEFAULT; +SELECT @@global.lc_time_names; + +--echo '#--------------------FN_DYNVARS_060_03-------------------------#' +########################################################################## +# see if setting global value changes session value and vice versa # +########################################################################## + +SET @@session.lc_time_names = en_IN; +SELECT @@session.lc_time_names; +SET @@global.lc_time_names = en_NZ; +SELECT @@global.lc_time_names; +SELECT @@session.lc_time_names AS res_is_en_IN; + +SET @@session.lc_time_names = en_AU; +SELECT @@session.lc_time_names; +SELECT @@global.lc_time_names AS res_is_en_NZ; +# composite check +SELECT @@global.lc_time_names=@@session.lc_time_names AS res_is_false; + + +--echo '#--------------------FN_DYNVARS_060_04-------------------------#' +########################################################################### +# Check if accessing variable with and without session point to session +# variable +########################################################################### + +SELECT @@lc_time_names = @@session.lc_time_names AS res; +SELECT @@lc_time_names = @@local.lc_time_names AS res; + +--echo '#--------------------FN_DYNVARS_060_05-------------------------#' +########################################################################### +# Check if combining character set works # +########################################################################### +--Error ER_BAD_FIELD_ERROR +SET @@lc_time_names = en_US | en_GB ; + +--echo '#--------------------FN_DYNVARS_060_06-------------------------#' +########################################################################### +# Change the value of lc_time_names to a valid value for session # +########################################################################### +SET @@session.lc_time_names=ar_AE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_BH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_DZ; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_EG; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_IQ; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_JO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_KW; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_LB; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_LY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_MA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_OM; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_QA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_SA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_SD; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_SY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_TN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ar_YE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=be_BY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=bg_BG; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ca_ES; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=cs_CZ; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=da_DK; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=de_AT; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=de_BE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=de_CH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=de_DE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=de_LU; +SELECT @@session.lc_time_names; + +--Error ER_UNKNOWN_ERROR +SET @@session.lc_time_names=EE; +--echo 'Bug: The locale for Estonian - Estonia is not supported. It is present'; +--echo 'in manual'; +--echo 'See http://dev.mysql.com/doc/refman/5.1/en/locale-support.html' + +SET @@session.lc_time_names=en_AU; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_CA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_GB; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_NZ; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_PH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_US; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_ZA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=en_ZW; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_AR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_BO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_CL; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_CO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_CR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_DO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_EC; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_ES; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_GT; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_HN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_MX; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_NI; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_PA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_PE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_PR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_PY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_SV; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_US; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_UY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=es_VE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=eu_ES; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fi_FI; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fo_FO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fr_BE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fr_CA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fr_CH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fr_FR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=fr_LU; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=gl_ES; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=gu_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=he_IL; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=hi_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=hr_HR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=hu_HU; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=id_ID; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=is_IS; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=it_CH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=it_IT; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ja_JP; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ko_KR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=lt_LT; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=lv_LV; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=mk_MK; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=mn_MN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ms_MY; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=nb_NO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=nl_BE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=nl_NL; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=no_NO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=pl_PL; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=pt_BR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=pt_PT; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ro_RO; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ru_RU; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ru_UA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sk_SK; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sl_SI; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sq_AL; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sr_YU; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sv_FI; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=sv_SE; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ta_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=te_IN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=th_TH; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=tr_TR; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=uk_UA; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=ur_PK; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=vi_VN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=zh_CN; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=zh_HK; +SELECT @@session.lc_time_names; +SET @@session.lc_time_names=zh_TW; +SELECT @@session.lc_time_names; + + +--echo '#--------------------FN_DYNVARS_060_07-------------------------#' +########################################################################## +# Change the value of lc_time_names to a valid value for global # +########################################################################## +SET @@global.lc_time_names=ar_AE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_BH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_DZ; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_EG; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_IQ; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_JO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_KW; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_LB; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_LY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_MA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_OM; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_QA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_SA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_SD; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_SY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_TN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ar_YE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=be_BY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=bg_BG; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ca_ES; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=cs_CZ; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=da_DK; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=de_AT; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=de_BE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=de_CH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=de_DE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=de_LU; +SELECT @@global.lc_time_names; + +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names=EE; +--echo 'Bug: The locale for Estonian - Estonia is not supported. It is'; +--echo 'present in manual'; +--echo 'See http://dev.mysql.com/doc/refman/5.1/en/locale-support.html'; + + +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_AU; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_CA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_GB; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_NZ; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_PH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_US; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_ZA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=en_ZW; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_AR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_BO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_CL; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_CO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_CR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_DO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_EC; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_ES; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_GT; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_HN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_MX; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_NI; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_PA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_PE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_PR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_PY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_SV; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_US; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_UY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=es_VE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=eu_ES; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fi_FI; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fo_FO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fr_BE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fr_CA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fr_CH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fr_FR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=fr_LU; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=gl_ES; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=gu_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=he_IL; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=hi_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=hr_HR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=hu_HU; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=id_ID; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=is_IS; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=it_CH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=it_IT; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ja_JP; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ko_KR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=lt_LT; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=lv_LV; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=mk_MK; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=mn_MN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ms_MY; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=nb_NO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=nl_BE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=nl_NL; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=no_NO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=pl_PL; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=pt_BR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=pt_PT; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ro_RO; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ru_RU; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ru_UA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sk_SK; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sl_SI; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sq_AL; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sr_YU; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sv_FI; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=sv_SE; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ta_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=te_IN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=th_TH; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=tr_TR; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=uk_UA; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=ur_PK; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=vi_VN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=zh_CN; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=zh_HK; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names=zh_TW; +SELECT @@global.lc_time_names; + + +--echo '#--------------------FN_DYNVARS_060_08-------------------------#' +########################################################################## +# Change the value of lc_time_names to a valid value with uppercase, +# lowercase and mixedcase +########################################################################## + +SET @@lc_time_names = ur_pk; +SELECT @@lc_time_names; +SET @@lc_time_names = UR_PK; +SELECT @@lc_time_names; +SET @@lc_time_names = uR_pK; +SELECT @@lc_time_names; + + +--echo '#--------------------FN_DYNVARS_060_09-------------------------#' +############################################################## +# Check if 0,1,2,3, ... values can be used on variable # +############################################################## + +SET @@lc_time_names = 0; +SELECT @@lc_time_names; +SET @@lc_time_names = 1; +SELECT @@lc_time_names; +SET @@lc_time_names = 2; +SELECT @@lc_time_names; +SET @@lc_time_names = 3; +SELECT @@lc_time_names; +SET @@lc_time_names = 10; +SELECT @@lc_time_names; +SET @@lc_time_names = 50; +SELECT @@lc_time_names; +SET @@lc_time_names = 100; +SELECT @@lc_time_names; +SET @@lc_time_names = 101; +SELECT @@lc_time_names; +SET @@lc_time_names = 107; +SELECT @@lc_time_names; +SET @@lc_time_names = 108; +SELECT @@lc_time_names; + +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = 109; + + +--echo '#--------------------FN_DYNVARS_060_10-------------------------#' +############################################################################# +# Change the value of lc_time_names to an invalid value for session # +############################################################################# + +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = en_EN; +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = US_en; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@lc_time_names = 1.1; +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = -1; +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = 'en US'; +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = 'enUS'; + +SET @@lc_time_names = true; +SELECT @@lc_time_names AS res_with_true; +SET @@lc_time_names = false; +SELECT @@lc_time_names AS res_with_false; + +--Error ER_UNKNOWN_ERROR +SET @@lc_time_names = ON; + + +--echo '#--------------------FN_DYNVARS_060_11-------------------------#' +############################################################################ +# Change the value of lc_time_names to an invalid value for global # +############################################################################ + +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names = en_EN; +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names = US_en; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.lc_time_names = 1.1; +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.lc_time_names = NULL; +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names = 'enUS'; + +SET @@global.lc_time_names = true; +SELECT @@global.lc_time_names; +SET @@global.lc_time_names = false; +SELECT @@global.lc_time_names; + +--Error ER_UNKNOWN_ERROR +SET @@global.lc_time_names = ON; + +--echo '#--------------------FN_DYNVARS_060_12-------------------------#' +############################################################################## +# Check if the value in GLOBAL Table matches value in variable # +############################################################################## +SELECT @@global.lc_time_names = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='lc_time_names') AS res; +SET @@global.lc_time_names = 1; +SELECT @@global.lc_time_names; +SELECT @@global.lc_time_names = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='lc_time_names') AS res; + +--echo '#--------------------FN_DYNVARS_060_13-------------------------#' +############################################################################## +# Check if the value in SESSION Table matches value in variable # +############################################################################## +SELECT @@lc_time_names = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='lc_time_names') AS res; +SELECT @@local.lc_time_names = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='lc_time_names') AS res; +SELECT @@session.lc_time_names = (SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='lc_time_names') AS res; + +#################################### +# Restore initial value # +#################################### +SET @@global.lc_time_names = @global_start_value; +SELECT @@global.lc_time_names; +SET @@session.lc_time_names = @session_start_value; +SELECT @@session.lc_time_names; + +############################################################# +# END OF lc_time_names TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/lc_time_names_func.test b/mysql-test/suite/sys_vars/t/lc_time_names_func.test new file mode 100644 index 00000000000..2c86a597773 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/lc_time_names_func.test @@ -0,0 +1,87 @@ +###################### mysql-test\t\lc_time_names_func.test ################## +# # +# Variable Name: lc_time_names # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: en_US # +# Range: NA # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable lc_time_names # +# that checks the behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_060_01-------------------------#' +###################################################################### +# Check if setting global lc_time_names is changed in new connection # +###################################################################### + +SET @@global.lc_time_names = "en_CA"; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.lc_time_names; +SELECT @@session.lc_time_names; +SET @@global.lc_time_names = "en_IN"; +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +--echo 'connection con2' +connection con2; +SELECT @@global.lc_time_names; +SELECT @@session.lc_time_names; +disconnect con2; +disconnect con1; + + +--echo '#--------------------FN_DYNVARS_060_02-------------------------#' +################################################################# +# Begin the functionality Testing of lc_time_names # +################################################################# + +--echo 'connection default' +connection default; + +SET NAMES 'utf8'; + +SET @@session.lc_time_names = 'en_US'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + + +SET @@session.lc_time_names = 'ar_AE'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'es_ES'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'fi_FI'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'gu_IN'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'it_IT'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'pt_BR'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + +SET @@session.lc_time_names = 'ur_PK'; +SELECT DATE_FORMAT('2010-01-01','%W %a %M %b'), DAYNAME('2010-05-05'),MONTHNAME('2010-12-12'); + + +# restore default +SET @@global.lc_time_names = "en_US"; + +########################################################## +# End of functionality Testing for lc_time_names # +########################################################## + diff --git a/mysql-test/suite/sys_vars/t/license_basic.test b/mysql-test/suite/sys_vars/t/license_basic.test new file mode 100644 index 00000000000..e0c761dc5a5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/license_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\license_basic.test ############################ +# # +# Variable Name: license # +# Scope: Global # +# Access Type: Static # +# Data Type: string # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable license # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_040_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.license); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_040_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.license=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.license); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_040_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.license = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='license'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.license); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='license'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_040_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@license = @@GLOBAL.license; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_040_05----------------------#' +################################################################################ +# Check if license can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@license); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.license); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.license); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.license); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT license = @@SESSION.license; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/local_infile_basic.test b/mysql-test/suite/sys_vars/t/local_infile_basic.test new file mode 100644 index 00000000000..63f6b0fdb91 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/local_infile_basic.test @@ -0,0 +1,173 @@ +############## mysql-test\t\local_infile_basic.test ############################ +# # +# Variable Name: local_infile # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: 1 # +# Valid Values: # +# # +# # +# Creation Date: 2008-02-19 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable "local_infile" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_local_infile # +# # +################################################################################ + +--source include/load_sysvars.inc + +############################################################ +# START OF local_infile TESTS # +############################################################ + + +#################################################################### +# Saving initial value of local_infile in a temporary variable # +#################################################################### + +SET @start_value = @@global.local_infile; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_018_01------------------------#' +#################################################################### +# Display the DEFAULT value of local_infile # +#################################################################### + +SET @@global.local_infile = 0; +SET @@global.local_infile = DEFAULT; +SELECT @@global.local_infile; + +--echo '#---------------------FN_DYNVARS_018_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.local_infile = DEFAULT; +SELECT @@global.local_infile = 1; + + +--echo '#--------------------FN_DYNVARS_018_03------------------------#' +#################################################################### +# Change the value of local_infile to a valid value # +#################################################################### + +SET @@global.local_infile = 0; +SELECT @@global.local_infile; +SET @@global.local_infile = 1; +SELECT @@global.local_infile; + +--echo '#--------------------FN_DYNVARS_018_04-------------------------#' +###################################################################### +# Change the value of local_infile to invalid value # +###################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = 100; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.local_infile = " "; + + +--echo '#-------------------FN_DYNVARS_018_05----------------------------#' +################################################################ +# Test if accessing session local_infile gives error # +################################################################ + +--Error ER_GLOBAL_VARIABLE +SET @@session.local_infile = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.local_infile = 1; + + +--echo '#----------------------FN_DYNVARS_018_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.local_infile = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='local_infile'; + + +--echo '#---------------------FN_DYNVARS_018_07----------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@global.local_infile = OFF; +SELECT @@global.local_infile; +SET @@global.local_infile = ON; +SELECT @@global.local_infile; + +--echo '#---------------------FN_DYNVARS_018_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.local_infile = TRUE; +SELECT @@global.local_infile; +SET @@global.local_infile = FALSE; +SELECT @@global.local_infile; + +--echo '#---------------------FN_DYNVARS_018_09----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.local_infile = 1; +SELECT @@local_infile = @@global.local_infile; + + +--echo '#---------------------FN_DYNVARS_018_10----------------------#' +########################################################################## +# Check if local_infile can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET local_infile = 1; +SELECT @@local_infile; +--Error ER_PARSE_ERROR +SET global.local_infile = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.local_infile; +--Error ER_BAD_FIELD_ERROR +SELECT local_infile = @@session.local_infile; + +############################## +# Restore initial value # +############################## + +SET @@global.local_infile = @start_value; +SELECT @@global.local_infile; + +################################################## +# END OF local_infile TESTS # +################################################## diff --git a/mysql-test/suite/sys_vars/t/local_infile_func.test b/mysql-test/suite/sys_vars/t/local_infile_func.test new file mode 100644 index 00000000000..00013f779a7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/local_infile_func.test @@ -0,0 +1,94 @@ +############## mysql-test\t\local_infile_func.test ############################ +# # +# Variable Name: local_infile # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: 1 # +# Valid Values: # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable "local_infile" # +# that checks behavior of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_local_infile # +# # +################################################################################ + +--source include/not_embedded.inc + +--echo '#--------------------FN_DYNVARS_037_01-------------------------#' +#################################################################### +# Check if setting local_infile is changed in every new connection # +#################################################################### + +SET @@global.local_infile = 0; + +# con1 will be default connection from now on +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.local_infile; +SET @@global.local_infile = 1; + +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +--echo 'connection con2' +connection con2; +SELECT @@global.local_infile; +disconnect con2; + + +--echo '#--------------------FN_DYNVARS_037_02-------------------------#' +###################################################### +# Begin the functionality Testing of local_infile # +###################################################### + +--echo 'connection con1' +connection con1; + +#============================================================= +--echo '-----Checking LOAD DATA when local_infile is 1-------' +#============================================================= +SET @@global.local_infile = 1; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +create table t1(a int); + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval LOAD DATA LOCAL INFILE +'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; + +SELECT count(*) from t1; + +#============================================================= +--echo '-----Checking LOAD DATA when local_infile is 0-------' +#============================================================= +SET @@global.local_infile = 0; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +create table t1(a int); + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--Error ER_NOT_ALLOWED_COMMAND +eval LOAD DATA LOCAL INFILE +'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1; + +SELECT count(*) from t1; + +# clean up and restore +DROP TABLE t1; +SET @@global.local_infile = 1; +###################################################### +# Endo of functionality Testing for local_infile # +###################################################### + diff --git a/mysql-test/suite/sys_vars/t/log_basic.test b/mysql-test/suite/sys_vars/t/log_basic.test new file mode 100644 index 00000000000..98e99fa4e4f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_basic.test @@ -0,0 +1,66 @@ +###################### mysql-test\t\log_basic.test ############################ +# # +# Variable Name: log_basic # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: # +# Test Cases of Dynamic System Variable log that checks the behavior of # +# this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +##################################### +## START OF log TESTS ## +##################################### + +--echo '#--------------------FN_DYNVARS_062_01------------------#' +############################################################# +# Accessing variable # +############################################################# + +SET @start_log= @@global.log; + +SELECT @@global.log AS INIT_VALUE; + +SELECT @@log AS INIT_VALUE; + +SET @@global.general_log = ON; + +SET global general_log = 0; + +--echo 'Bug# 34832: log is a system but it is not accessible using SET @@global.log;' +--echo 'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.' + + +--echo '#--------------------FN_DYNVARS_062_02-------------------------#' +################################################################################ +# Check if the value in GLOBAL Table matches value in variable # +################################################################################ +# We can only access log value from information schema global_variables table +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='log'; + +SET @@global.log= @start_log; + +############################################ +# END OF log TESTS # +############################################ + diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test new file mode 100644 index 00000000000..3b8b43e1354 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test @@ -0,0 +1,170 @@ +############## mysql-test\t\log_bin_trust_function_creators_basic.test ######## +# # +# Variable Name: log_bin_trust_function_creators # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: False # +# Range: # +# # +# # +# Creation Date: 2008-02-11 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable # +# log_bin_trust_function_creators that checks the behavior of # +# this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # +# -variables.html#option_mysqld_log-bin-trust-function-ceators # +# # +############################################################################### + +--source include/load_sysvars.inc + +#################################################################### +# START OF log_bin_trust_function_creators TESTS # +#################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.log_bin_trust_function_creators; +SELECT @start_global_value; +--echo 'Bug# 34876: TRUE value is coming as Default' +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @start_session_value = @@session.log_bin_trust_function_creators; +--echo 'Bug# 34881: According to documentation the scope of this variable is GLOBAL as well as SESSION too'; + +--echo '#--------------------FN_DYNVARS_063_01-------------------------#' +######################################################################## +# Display the DEFAULT value of log_bin_trust_function_creators # +######################################################################## + +SET @@global.log_bin_trust_function_creators = TRUE; +SET @@global.log_bin_trust_function_creators = DEFAULT; +SELECT @@global.log_bin_trust_function_creators; + + +--echo '#--------------------FN_DYNVARS_063_02-------------------------#' +############################################################################### +# Check the DEFAULT value of log_bin_trust_function_creators # +############################################################################### + +SET @@global.log_bin_trust_function_creators = DEFAULT; +SELECT @@global.log_bin_trust_function_creators = 'FALSE'; + + +--echo '#--------------------FN_DYNVARS_063_03-------------------------#' +################################################################## +# Change the value of variable to a valid value for GLOBAL Scope # +################################################################## + +SET @@global.log_bin_trust_function_creators = ON; +SELECT @@global.log_bin_trust_function_creators; +SET @@global.log_bin_trust_function_creators = OFF; +SELECT @@global.log_bin_trust_function_creators; +SET @@global.log_bin_trust_function_creators = 0; +SELECT @@global.log_bin_trust_function_creators; +SET @@global.log_bin_trust_function_creators = 1; +SELECT @@global.log_bin_trust_function_creators; +SET @@global.log_bin_trust_function_creators = TRUE; +SELECT @@global.log_bin_trust_function_creators; +SET @@global.log_bin_trust_function_creators = FALSE; +SELECT @@global.log_bin_trust_function_creators; + + +--echo '#-------------------FN_DYNVARS_063_04----------------------------#' +############################################################################### +# Test if accessing session log_bin_trust_function_creators gives error # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.log_bin_trust_function_creators = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.log_bin_trust_function_creators; + +--echo '#------------------FN_DYNVARS_063_05-----------------------#' +########################################################################### +# Change the value of log_bin_trust_function_creators to an invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = "OFFF"; +SET @@global.log_bin_trust_function_creators = OF; + +--echo 'Bug# 34828: OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_function_creators = test; + +--echo '#------------------FN_DYNVARS_063_06-----------------------#' +############################################################################### +# Check if the value in GLOBAL & SESSION Tables matches value in variable # +############################################################################### + + +SELECT @@global.log_bin_trust_function_creators = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='log_bin_trust_function_creators'; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.log_bin_trust_function_creators = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='log_bin_trust_function_creators'; + +--echo '#---------------------FN_DYNVARS_063_07----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + + +SET @@global.log_bin_trust_function_creators = TRUE; +SELECT @@log_bin_trust_function_creators = @@global.log_bin_trust_function_creators; + + +--echo '#---------------------FN_DYNVARS_063_08----------------------#' +################################################################### +# Check if variable can be accessed with and without @@ sign # +################################################################### + +SET @@global.log_bin_trust_function_creators = TRUE; +SELECT @@log_bin_trust_function_creators; +--Error ER_UNKNOWN_TABLE +SELECT local.log_bin_trust_function_creators; +--Error ER_UNKNOWN_TABLE +SELECT session.log_bin_trust_function_creators; +--Error ER_BAD_FIELD_ERROR +SELECT log_bin_trust_function_creators = @@session.log_bin_trust_function_creators; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.log_bin_trust_function_creators = @start_global_value; +SELECT @@global.log_bin_trust_function_creators; + + +######################################################### +# END OF log_bin_trust_function_creators TESTS # +######################################################### + diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test new file mode 100644 index 00000000000..0168114b11b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test @@ -0,0 +1,151 @@ +############## mysql-test\t\log_bin_trust_function_creators_func.test ######### +# # +# Variable Name: log_bin_trust_function_creators # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: False # +# Range: # +# # +# # +# Creation Date: 2008-03-11 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable # +# log_bin_trust_function_creators that checks the functionality # +# of this variable in the following ways # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # +# -variables.html#option_mysqld_log-bin-trust-function-ceators # +# # +############################################################################### + +source include/have_log_bin.inc; + +--disable_warnings +drop table if exists t1; +--enable_warnings + + +--echo '#--------------------FN_DYNVARS_063_01-------------------------#' +######################################################################## +# Setting initial value of variable to 0 and verifying whether user +# is allowed to create function or not. +######################################################################## +SET @start_value= @@global.log_bin_trust_function_creators; + +--echo ## Creating new user tt ## +CREATE USER tt@localhost; + +--echo ## Setting value of variable to 0 ## +SET @@global.log_bin_trust_function_creators = 0; + +--echo ## Creating new table t2 ## +CREATE TABLE t2 (a INT); + +--echo ## Creating & connecting with new connection test_con1 ## +connect (test_con1,localhost,tt,,); +connection test_con1; + +SELECT @@log_bin_trust_function_creators; + +--echo ## Creating new function f1 fails because no DETERMINISTIC ### +delimiter |; +--error ER_BINLOG_UNSAFE_ROUTINE +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +--echo ## Creating new function f1 fails because non-super user ## +delimiter |; +--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +connection default; + +--echo ## Creating new function f1 succeeds ## +delimiter |; +CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +--echo ## Creating new table t1 ## +CREATE TABLE t1 (a INT); + +--echo ## Inserting some records in t1 ## +INSERT INTO t1 VALUES (1),(2),(3); +SELECT f1(a) FROM t1; + +--echo ## Dropping function f1 & table t1 ## +DROP FUNCTION f1; +DROP TABLE t1; + +--echo '#--------------------FN_DYNVARS_063_02-------------------------#' +######################################################################## +# Setting initial value of variable to 1 and verifying whether user +# is allowed to create function or not. +######################################################################## + +--echo ## Switching to default connection ## +connection default; + +--echo ## Setting value of variable to 1 ## +SET @@global.log_bin_trust_function_creators = 1; + +--echo ## Creating and connecting to new connection test_con2 ## +connect (test_con2,localhost,tt,,); +connection test_con2; + +--echo ## Verifying value of variable ## +SELECT @@log_bin_trust_function_creators; +SELECT @@sql_log_bin; + +--echo ## Creating new function f1 ## +delimiter |; +CREATE FUNCTION f1(a INT) RETURNS INT +BEGIN + IF (a < 3) THEN + INSERT INTO t2 VALUES (a); + END IF; + RETURN 1; +END| +delimiter ;| + +--echo ## Creating new table t1 ## +CREATE TABLE t1 (a INT); + +--echo ## Inserting values in table t1 ## +INSERT INTO t1 VALUES (1),(2),(3); +SELECT f1(a) FROM t1; + +--echo ## Dropping function f1 ## +DROP FUNCTION f1; + +--echo ## Dropping table t1 & t2 ## +DROP TABLE t1,t2; + +--echo ## Disconnecting test_con2## +disconnect test_con2; + +connection default; + +DROP USER tt@localhost; +SET @@global.log_bin_trust_function_creators= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_routine_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_routine_creators_basic.test new file mode 100644 index 00000000000..1d44c77b1a7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_routine_creators_basic.test @@ -0,0 +1,164 @@ +############## mysql-test\t\log_bin_trust_routine_creators_basic.test ######### +# # +# Variable Name: log_bin_trust_routine_creators # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: False # +# Range: # +# # +# # +# Creation Date: 2008-02-12 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable # +# log_bin_trust_routine_creators that checks the # +# behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: (Not given on website) # +# # +############################################################################### + +--source include/load_sysvars.inc +#################################################################### +# START OF log_bin_trust_routine_creators TESTS # +#################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.log_bin_trust_routine_creators; +SELECT @start_global_value; + + +--echo '#--------------------FN_DYNVARS_064_01-------------------------#' +######################################################################## +# Display the DEFAULT value of log_bin_trust_routine_creators # +######################################################################## + +SET @@global.log_bin_trust_routine_creators = TRUE; +SET @@global.log_bin_trust_routine_creators = DEFAULT; +SELECT @@global.log_bin_trust_routine_creators; + + +--echo '#--------------------FN_DYNVARS_064_02-------------------------#' +############################################################################## +# Check the DEFAULT value of log_bin_trust_routine_creators # +############################################################################## + +SET @@global.log_bin_trust_routine_creators = DEFAULT; +SELECT @@global.log_bin_trust_routine_creators = 'FALSE'; + + +--echo '#--------------------FN_DYNVARS_064_03-------------------------#' +################################################################## +# Change the value of variable to a valid value for GLOBAL Scope # +################################################################## + +SET @@global.log_bin_trust_routine_creators = ON; +SELECT @@global.log_bin_trust_routine_creators; +SET @@global.log_bin_trust_routine_creators = OFF; +SELECT @@global.log_bin_trust_routine_creators; +SET @@global.log_bin_trust_routine_creators = 0; +SELECT @@global.log_bin_trust_routine_creators; +SET @@global.log_bin_trust_routine_creators = 1; +SELECT @@global.log_bin_trust_routine_creators; +SET @@global.log_bin_trust_routine_creators = TRUE; +SELECT @@global.log_bin_trust_routine_creators; +SET @@global.log_bin_trust_routine_creators = FALSE; +SELECT @@global.log_bin_trust_routine_creators; + + +--echo '#-------------------FN_DYNVARS_064_04----------------------------#' +########################################################################### +# Test if accessing session log_bin_trust_routine_creators gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.log_bin_trust_routine_creators = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.log_bin_trust_routine_creators; + + +--echo '#------------------FN_DYNVARS_064_05-----------------------#' +########################################################################## +# Change the value of log_bin_trust_routine_creators to an invalid value # +########################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = "OFFF"; +SET @@global.log_bin_trust_routine_creators = OF; +SELECT @@global.log_bin_trust_routine_creators; +--echo 'Bug# 34828: OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_bin_trust_routine_creators = test; + + +--echo '#------------------FN_DYNVARS_064_06-----------------------#' +############################################################################### +# Check if the value in GLOBAL & SESSION Tables matches value in variable # +############################################################################### + + +SELECT @@global.log_bin_trust_routine_creators = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_routine_creators'; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.log_bin_trust_routine_creators = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_routine_creators'; + + +--echo '#---------------------FN_DYNVARS_064_07----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + + +SET @@global.log_bin_trust_routine_creators = TRUE; +SELECT @@log_bin_trust_routine_creators = @@global.log_bin_trust_routine_creators; + + +--echo '#---------------------FN_DYNVARS_064_08----------------------#' +################################################################### +# Check if variable can be accessed with and without @@ sign # +################################################################### + +SET @@global.log_bin_trust_routine_creators = TRUE; +SELECT @@log_bin_trust_routine_creators; +--Error ER_UNKNOWN_TABLE +SELECT local.log_bin_trust_routine_creators; +--Error ER_UNKNOWN_TABLE +SELECT session.log_bin_trust_routine_creators; +--Error ER_BAD_FIELD_ERROR +SELECT log_bin_trust_routine_creators = @@session.log_bin_trust_routine_creators; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.log_bin_trust_routine_creators = @start_global_value; +SELECT @@global.log_bin_trust_routine_creators; + + +################################################################### +# END OF log_bin_trust_routine_creators TESTS # +################################################################### + diff --git a/mysql-test/suite/sys_vars/t/log_output_basic.test b/mysql-test/suite/sys_vars/t/log_output_basic.test new file mode 100644 index 00000000000..45998e85480 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_output_basic.test @@ -0,0 +1,234 @@ +################# mysql-test\t\log_output_basic.test ########################## +# # +# Variable Name: log_output # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: TABLE # +# Range: TABLE, FILE, NONE # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable log_output # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF log_output TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of log_output in a temporary variable # +######################################################################## + +SET @start_value = @@global.log_output; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_065_01------------------------#' +######################################################################## +# Display the DEFAULT value of log_output # +######################################################################## + +SET @@global.log_output = FILE; +SET @@global.log_output = DEFAULT; +SELECT @@global.log_output; +--echo 'Bug# 34876: Documentation specifies a DEFAULT value of TABLE whereas'; +--echo 'DEFAULT value is FILE. Also note that initial value is different'; +--echo 'from DEFAULT'; + + +--echo '#---------------------FN_DYNVARS_065_02-------------------------#' +################################################## +# Check if NULL or empty value is accepeted # +################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = ""; +SELECT @@global.log_output; +--echo 'Bug# 34838: Empty value is allowed where as it is not specified in'; +--echo 'documentation'; + +--echo '#--------------------FN_DYNVARS_065_03------------------------#' +######################################################################## +# Change the value of log_output to a valid value # +######################################################################## + +SET @@global.log_output = 'TABLE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'FILE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'NONE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'FILE,TABLE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'TABLE,FILE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'NONE,TABLE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'NONE,FILE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'FILE,TABLE,NONE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'TABLE,NONE'; +SELECT @@global.log_output; + +SET @@global.log_output = 'TABLE,TABLE'; +SELECT @@global.log_output; + +SET @@global.log_output = ',TABLE'; +SELECT @@global.log_output; + +SET @@global.log_output = ','; +SELECT @@global.log_output; + +SET @@global.log_output = 'TABLE,,FILE,,,'; +SELECT @@global.log_output; + + +--echo '#--------------------FN_DYNVARS_065_04-------------------------#' +########################################################################### +# Change the value of log_output to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = TAB; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = NIL; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = 'FIL'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = 'T'; + +# use of space in value +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = 'TABLE, FILE'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = ' TABLE,FILE'; + +SET @@global.log_output = ', '; +SELECT @@global.log_output; +SET @@global.log_output = ' '; +SELECT @@global.log_output; +SET @@global.log_output = ' '; +SELECT @@global.log_output; + +--echo 'Bug: The behavior of space in value is not consistent.'; +--echo 'Some times it is trimmed and some times not.'; +--echo 'The space before and after value is not accepted where as space'; +--echo 'between comma is accepted.'; + + +--echo '#-------------------FN_DYNVARS_065_05----------------------------#' +###################################################################### +# Test if accessing session log_output gives error # +###################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@log_output = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.log_output; + + +--echo '#----------------------FN_DYNVARS_065_06------------------------#' +######################################################################## +# Check if the value in GLOBAL Table matches value in variable # +######################################################################## + +SELECT @@log_output = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='log_output'; + + +--echo '#---------------------FN_DYNVARS_065_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +# test if variable accepts 0,1,2 +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = 0; +SELECT @@global.log_output; + +SET @@global.log_output = 1; +SELECT @@global.log_output; + +SET @@global.log_output = 2; +SELECT @@global.log_output; + +SET @@global.log_output = 3; +SELECT @@global.log_output; + +SET @@global.log_output = 4; +SELECT @@global.log_output; + +SET @@global.log_output = 5; +SELECT @@global.log_output; + +SET @@global.log_output = 6; +SELECT @@global.log_output; + +SET @@global.log_output = 7; +SELECT @@global.log_output; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = 8; + + +--echo '#---------------------FN_DYNVARS_065_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.log_output = TRUE; +SELECT @@global.log_output; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_output = FALSE; +SELECT @@global.log_output; + +--echo '#---------------------FN_DYNVARS_065_09----------------------#' +################################################################ +# Check if log_output can be accessed with and without @@ sign # +################################################################ +--Error ER_GLOBAL_VARIABLE +SET log_output = ON; + +SET global log_output = 'TABLE'; +SELECT @@global.log_output; + +############################## +# Restore initial value # +############################## + +SET @@global.log_output = @start_value; +SELECT @@global.log_output; + +################################################################### +# END OF log_output TESTS # +################################################################### diff --git a/mysql-test/suite/sys_vars/t/log_output_func.test b/mysql-test/suite/sys_vars/t/log_output_func.test new file mode 100644 index 00000000000..007c4f38659 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_output_func.test @@ -0,0 +1,125 @@ +################# mysql-test\t\log_output_func.test ########################## +# # +# Variable Name: log_output # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: TABLE # +# Range: TABLE, FILE, NONE # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# Modified: HHunger 2008-08-29 +# # +# Description: Test Cases of Dynamic System Variable log_output # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +# The access to mysql.general_log delivers different result depending on +# ps-protocol. So, it is switched off. +--disable_ps_protocol + +SET @start_value= @@global.log_output; +SET @start_general_log= @@global.general_log; +SET @start_general_log_file= @@global.general_log_file; + +--echo '#--------------------FN_DYNVARS_065_01-------------------------#' +################################################################## +# Check if setting log_output is changed in every new connection # +################################################################## + +SET @@global.log_output = 'NONE'; +# con1 will be default connection from now on +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +SET @@global.log_output = 'TABLE,FILE'; + +# Test that the effect is global +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +SELECT @@global.log_output; + +--echo '#--------------------FN_DYNVARS_065_02-------------------------#' +#################################################### +# Begin the functionality Testing of log_output # +#################################################### + +--echo 'connection con1' +connection con1; + +#=============================================================== +--echo '---Checking general_log when log_output is NONE---' +#=============================================================== + +SET @@global.log_output = 'NONE'; +TRUNCATE TABLE mysql.general_log; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUE(1); +SELECT 'abc'; +SELECT count(*) FROM mysql.general_log; + +#=============================================================== +--echo '---Checking general_log when log_output is TABLE---' +#=============================================================== + +SET @@global.log_output = 'TABLE'; +TRUNCATE TABLE mysql.general_log; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1(a int); +INSERT INTO t1 VALUE(1); +SELECT 'abc'; +# At least the last 4 statement should be logged. +SELECT count(*)>4 FROM mysql.general_log; + +#=============================================================== +# Checking general_log when log_output is FILE +#=============================================================== + +SET @@global.general_log = 'OFF'; +FLUSH LOGS; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval SET @@global.general_log_file = '$MYSQLTEST_VARDIR/run/mytest.log'; +SET @@global.general_log = 'ON'; +SET @@global.log_output = 'FILE'; +TRUNCATE TABLE mysql.general_log; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUE(1); +SELECT 'abc'; +SELECT count(*) FROM mysql.general_log; + +DROP TABLE t1; + +file_exists $MYSQLTEST_VARDIR/run/mytest.log ; + +#============================================================== +# Clean up +#============================================================== + +--echo connection default; +connection default; +SET @@global.general_log= 'OFF'; +SET @@global.general_log_file= @start_general_log_file; +SET @@global.log_output= @start_value; +SET @@global.general_log= @start_general_log; +SET @@global.general_log= 'ON'; + +--enable_ps_protocol +#################################################### +# End of functionality Testing for log_output # +#################################################### + diff --git a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test new file mode 100644 index 00000000000..f1152c07176 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test @@ -0,0 +1,132 @@ +################## mysql-test\t\log_queries_not_using_indexes_basic.test ###### +# # +# Variable Name: log_queries_not_using_indexes # +# Scope: Global # +# Access Type: Static # +# Data Type: # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# Description:Test Cases of Dynamic System Variable # +# log_queries_not_using_indexes # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +SET @start_value= @@global.log_queries_not_using_indexes; + +#################################################################### +# Valid values for boolean # +#################################################################### +SET @@global.log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= TRUE; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= true; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= 0; +SELECT @@global.log_queries_not_using_indexes; + +SET @@global.log_queries_not_using_indexes= 1; +SELECT @@global.log_queries_not_using_indexes; + +SET @goodvar= TRUE; +SET @@global.log_queries_not_using_indexes= @goodvar; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= DEFAULT; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= ON; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= OFF; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= -0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 0.00; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= -0.0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 001.00; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +1.0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +0; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= +0.000000; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= 0000.00000; +SELECT @@global.log_queries_not_using_indexes; + +SET GLOBAL log_queries_not_using_indexes= .0; +SELECT @@global.log_queries_not_using_indexes; + +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 'DEFAULT'; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 'true'; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= BLABLA; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 25; + +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= 12.34; + +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL log_queries_not_using_indexes= -1; + +SET @badvar= 'true'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.log_queries_not_using_indexes= @badvar; + +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL log_queries_not_using_indexes= 'DEFAULT'; + +--error ER_GLOBAL_VARIABLE +SET log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET SESSION log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET @@session.log_queries_not_using_indexes= TRUE; + +--error ER_GLOBAL_VARIABLE +SET LOCAL log_queries_not_using_indexes= TRUE; + +--error ER_PARSE_ERROR +SET @@global log_queries_not_using_indexes= TRUE; + +--error ER_PARSE_ERROR +SET @@SESSION log_queries_not_using_indexes= TRUE; + + +SET @@global.log_queries_not_using_indexes= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/long_query_time_basic.test b/mysql-test/suite/sys_vars/t/long_query_time_basic.test new file mode 100644 index 00000000000..c21e0a751c1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/long_query_time_basic.test @@ -0,0 +1,210 @@ +####################### mysql-test\t\long_query_time_basic.test ############### +# # +# Variable Name: long_query_time # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:10 # +# Min Value: 1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable long_query_time # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +############################################################ +# START OF long_query_time TESTS # +############################################################ + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.long_query_time; +SELECT @start_global_value; +SET @start_session_value = @@session.long_query_time; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_068_01-------------------------#' +############################################################### +# Display the DEFAULT value of long_query_time # +############################################################### + +SET @@global.long_query_time = 100; +SET @@global.long_query_time = DEFAULT; +SELECT @@global.long_query_time; + +SET @@session.long_query_time = 200; +SET @@session.long_query_time = DEFAULT; +SELECT @@session.long_query_time; + + +--echo '#--------------------FN_DYNVARS_068_02-------------------------#' +############################################################### +# Check the DEFAULT value of long_query_time # +############################################################### + +SET @@global.long_query_time = DEFAULT; +SELECT @@global.long_query_time = 10; + +SET @@session.long_query_time = DEFAULT; +SELECT @@session.long_query_time = 10; + + +--echo '#--------------------FN_DYNVARS_068_03-------------------------#' +######################################################################### +# Change the value of long_query_time to a valid value for GLOBAL Scope # +######################################################################### + +SET @@global.long_query_time = 0; +SELECT @@global.long_query_time; +SET @@global.long_query_time = 1; +SELECT @@global.long_query_time; +SET @@global.long_query_time = 60020; +SELECT @@global.long_query_time; +SET @@global.long_query_time = 31536000; +SELECT @@global.long_query_time; +SET @@global.long_query_time = 65536; +SELECT @@global.long_query_time; + + +--echo '#--------------------FN_DYNVARS_068_04-------------------------#' +########################################################################## +# Change the value of long_query_time to a valid value for SESSION Scope # +########################################################################## + +SET @@session.long_query_time = 0; +SELECT @@session.long_query_time; +SET @@session.long_query_time = 1; +SELECT @@session.long_query_time; +SET @@session.long_query_time = 50050; +SELECT @@session.long_query_time; +SET @@session.long_query_time = 31536000; +SELECT @@session.long_query_time; +SET @@session.long_query_time = 65550; +SELECT @@session.long_query_time; + + +--echo '#------------------FN_DYNVARS_068_05-----------------------#' +######################################################## +# Change the value of long_query_time to an invalid value # +######################################################## + +SET @@global.long_query_time = 100000000000; +SELECT @@global.long_query_time; +SET @@global.long_query_time = -1; +SELECT @@global.long_query_time; +--Error ER_PARSE_ERROR +SET @@global.long_query_time = 65530.34.; +SELECT @@global.long_query_time; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.long_query_time = test; +SELECT @@global.long_query_time; + +SET @@session.long_query_time = 100000000000; +SELECT @@session.long_query_time; +SET @@session.long_query_time = -2; +SELECT @@session.long_query_time; +--Error ER_PARSE_ERROR +SET @@session.long_query_time = 65530.34.; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.long_query_time = test; +SELECT @@session.long_query_time; + + +--echo '#------------------FN_DYNVARS_068_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.long_query_time = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='long_query_time'; + +--echo '#------------------FN_DYNVARS_068_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.long_query_time = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='long_query_time'; + + +--echo '#------------------FN_DYNVARS_068_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.long_query_time = TRUE; +SELECT @@global.long_query_time; +SET @@global.long_query_time = FALSE; +SELECT @@global.long_query_time; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.long_query_time = 10; +SELECT @@long_query_time = @@global.long_query_time; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@long_query_time = 100; +SELECT @@long_query_time = @@local.long_query_time; +SELECT @@local.long_query_time = @@session.long_query_time; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +########################################################################## +# Check if long_query_time can be accessed with and without @@ sign # +########################################################################## + +SET long_query_time = 1; +SELECT @@long_query_time; +--Error ER_UNKNOWN_TABLE +SELECT local.long_query_time; +--Error ER_UNKNOWN_TABLE +SELECT session.long_query_time; +--Error ER_BAD_FIELD_ERROR +SELECT long_query_time = @@session.long_query_time; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.long_query_time = @start_global_value; +SELECT @@global.long_query_time; +SET @@session.long_query_time = @start_session_value; +SELECT @@session.long_query_time; + + +#################################################### +# END OF long_query_time TESTS # +#################################################### + diff --git a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test new file mode 100644 index 00000000000..0ce4ee8f921 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test @@ -0,0 +1,222 @@ +############## mysql-test\t\low_priority_updates_basic.test ################### +# # +# Variable Name: low_priority_updates # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Range: # +# # +# # +# Creation Date: 2008-02-11 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable low_priority_updates # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_low-priority-updates # +# # +############################################################################### + +--source include/load_sysvars.inc + +#################################################################### +# START OF low_priority_updates TESTS # +#################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.low_priority_updates; +SELECT @start_global_value; +SET @start_session_value = @@session.low_priority_updates; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_069_01-------------------------#' +#################################################################### +# Display the DEFAULT value of low_priority_updates # +#################################################################### + +SET @@global.low_priority_updates = ON; +SET @@global.low_priority_updates = DEFAULT; +SELECT @@global.low_priority_updates; + +SET @@session.low_priority_updates = ON; +SET @@session.low_priority_updates = DEFAULT; +SELECT @@session.low_priority_updates; + + +--echo '#--------------------FN_DYNVARS_069_02-------------------------#' +######################################################################## +# Check the DEFAULT value of low_priority_updates # +######################################################################## + +SET @@global.low_priority_updates = DEFAULT; +SELECT @@global.low_priority_updates = 'FALSE'; + +SET @@session.low_priority_updates = DEFAULT; +SELECT @@session.low_priority_updates = 'FALSE'; + + +--echo '#--------------------FN_DYNVARS_069_03-------------------------#' +############################################################################## +# Change the value of low_priority_updates to a valid value for GLOBAL Scope # +############################################################################## + +SET @@global.low_priority_updates = ON; +SELECT @@global.low_priority_updates; +SET @@global.low_priority_updates = OFF; +SELECT @@global.low_priority_updates; +SET @@global.low_priority_updates = 0; +SELECT @@global.low_priority_updates; +SET @@global.low_priority_updates = 1; +SELECT @@global.low_priority_updates; +SET @@global.low_priority_updates = TRUE; +SELECT @@global.low_priority_updates; +SET @@global.low_priority_updates = FALSE; +SELECT @@global.low_priority_updates; + + + +--echo '#--------------------FN_DYNVARS_069_04-------------------------#' +############################################################################### +# Change the value of low_priority_updates to a valid value for SESSION Scope # +############################################################################### + +SET @@session.low_priority_updates = ON; +SELECT @@session.low_priority_updates; +SET @@session.low_priority_updates = OFF; +SELECT @@session.low_priority_updates; +SET @@session.low_priority_updates = 0; +SELECT @@session.low_priority_updates; +SET @@session.low_priority_updates = 1; +SELECT @@session.low_priority_updates; +SET @@session.low_priority_updates = TRUE; +SELECT @@session.low_priority_updates; +SET @@session.low_priority_updates = FALSE; +SELECT @@session.low_priority_updates; + + +--echo '#------------------FN_DYNVARS_069_05-----------------------#' +################################################################ +# Change the value of low_priority_updates to an invalid value # +################################################################ + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = "OFFF"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.low_priority_updates = test; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = ONF; + +SET @@session.low_priority_updates = OF; +SELECT @@session.low_priority_updates; +--echo 'Bug# 34828: OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = 'OFN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = -2; +--Error ER_PARSE_ERROR +SET @@session.low_priority_updates = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = 65550; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.low_priority_updates = test; + + +--echo '#------------------FN_DYNVARS_069_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.low_priority_updates = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='low_priority_updates'; + +--echo '#------------------FN_DYNVARS_069_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.low_priority_updates = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='low_priority_updates'; + + +--echo '#---------------------FN_DYNVARS_069_08----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + +SET @@low_priority_updates = FALSE; +SET @@global.low_priority_updates = TRUE; +SELECT @@low_priority_updates = @@global.low_priority_updates; + + +--echo '#---------------------FN_DYNVARS_069_09----------------------#' +######################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE # +# points to same session variable # +######################################################################## + +SET @@low_priority_updates = ON; +SELECT @@low_priority_updates = @@local.low_priority_updates; +SELECT @@local.low_priority_updates = @@session.low_priority_updates; + + +--echo '#---------------------FN_DYNVARS_069_10----------------------#' +############################################################################### +# Check if low_priority_updates can be accessed with and without @@ sign # +############################################################################### + +SET low_priority_updates = 1; +SELECT @@low_priority_updates; +--Error ER_UNKNOWN_TABLE +SELECT local.low_priority_updates; +--Error ER_UNKNOWN_TABLE +SELECT session.low_priority_updates; +--Error ER_BAD_FIELD_ERROR +SELECT low_priority_updates = @@session.low_priority_updates; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.low_priority_updates = @start_global_value; +SELECT @@global.low_priority_updates; +SET @@session.low_priority_updates = @start_session_value; +SELECT @@session.low_priority_updates; + + +######################################################### +# END OF low_priority_updates TESTS # +######################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test new file mode 100644 index 00000000000..8be0e5f670e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_basic.test @@ -0,0 +1,231 @@ +############## mysql-test\t\max_allowed_packet_basic.test ############### +# # +# Variable Name: max_allowed_packet # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:1048576 # +# Range:1024-1073741824 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_allowed_packet # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################################## +# START OF max_allowed_packet TESTS # +################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_allowed_packet; +SELECT @start_global_value; + +# give a known value to @@session.max_allowed_packet by assigning to +# @@global and setting up a new connection (for deterministic result +# file diffing) +SET @@global.max_allowed_packet = DEFAULT; +connect (conn1, localhost, root,,); + + + +--echo '#--------------------FN_DYNVARS_070_01-------------------------#' +################################################################## +# Display the DEFAULT value of max_allowed_packet # +################################################################## + +SET @@global.max_allowed_packet = 1000; +SET @@global.max_allowed_packet = DEFAULT; +SELECT @@global.max_allowed_packet; + +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 20000; +--Error ER_NO_DEFAULT +SET @@session.max_allowed_packet = DEFAULT; +SELECT @@session.max_allowed_packet; + + +--echo '#--------------------FN_DYNVARS_070_02-------------------------#' +################################################################## +# Check the DEFAULT value of max_allowed_packet # +################################################################## + +SET @@global.max_allowed_packet = DEFAULT; +SELECT @@global.max_allowed_packet = 1048576; + + +--echo '#--------------------FN_DYNVARS_070_03-------------------------#' +############################################################################ +# Change the value of max_allowed_packet to a valid value for GLOBAL Scope # +############################################################################ + +SET @@global.max_allowed_packet = 1024; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 1025; +SELECT @@global.max_allowed_packet; +--echo : 'Bug# 34841: "Invalid values are coming in variable on assigning valid value'; +SET @@global.max_allowed_packet = 1073741824; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 1073741823; +SELECT @@global.max_allowed_packet; + +--echo '#--------------------FN_DYNVARS_070_04-------------------------#' +############################################################################# +# Change the value of max_allowed_packet to a valid value for SESSION Scope # +############################################################################# + +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1024; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1025; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 65535; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1073741824; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1073741823; +SELECT @@session.max_allowed_packet; + + +--echo '#------------------FN_DYNVARS_070_05-----------------------#' +############################################################## +# Change the value of max_allowed_packet to an invalid value # +############################################################## + +SET @@global.max_allowed_packet = 0; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = -1024; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 1023; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 10737418241; +SELECT @@global.max_allowed_packet; +--Error ER_PARSE_ERROR +SET @@global.max_allowed_packet = 65530.34.; +SELECT @@global.max_allowed_packet; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_allowed_packet = test; +SELECT @@global.max_allowed_packet; + +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 0; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1023; +SELECT @@session.max_allowed_packet; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = -2; +SELECT @@session.max_allowed_packet; +--Error ER_PARSE_ERROR +SET @@session.max_allowed_packet = 65530.34.; +--Error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 10737418241; +SELECT @@session.max_allowed_packet; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_allowed_packet = test; +SELECT @@session.max_allowed_packet; + + +--echo '#------------------FN_DYNVARS_070_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_allowed_packet = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_allowed_packet'; + +--echo '#------------------FN_DYNVARS_070_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_allowed_packet = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_allowed_packet'; + + +--echo '#------------------FN_DYNVARS_070_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_allowed_packet = TRUE; +SELECT @@global.max_allowed_packet; +SET @@global.max_allowed_packet = FALSE; +SELECT @@global.max_allowed_packet; + + +--echo '#---------------------FN_DYNVARS_070_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_allowed_packet = 2048; +SELECT @@max_allowed_packet = @@global.max_allowed_packet; + + +--echo '#---------------------FN_DYNVARS_070_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +--Error ER_VARIABLE_IS_READONLY +SET @@max_allowed_packet = 100000; +SELECT @@max_allowed_packet = @@local.max_allowed_packet; +SELECT @@local.max_allowed_packet = @@session.max_allowed_packet; + + +--echo '#---------------------FN_DYNVARS_070_11----------------------#' +############################################################################# +# Check if max_allowed_packet can be accessed with and without @@ sign # +############################################################################# + +--Error ER_VARIABLE_IS_READONLY +SET max_allowed_packet = 1024; +SELECT @@max_allowed_packet; +--Error ER_UNKNOWN_TABLE +SELECT local.max_allowed_packet; +--Error ER_UNKNOWN_TABLE +SELECT session.max_allowed_packet; +--Error ER_BAD_FIELD_ERROR +SELECT max_allowed_packet = @@session.max_allowed_packet; + + +#################################### +# Restore initial value # +#################################### + +connection default; +SET @@global.max_allowed_packet = @start_global_value; +SELECT @@global.max_allowed_packet; +SELECT @@session.max_allowed_packet; + + +####################################################### +# END OF max_allowed_packet TESTS # +####################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test new file mode 100644 index 00000000000..0cfbeb4de5f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test @@ -0,0 +1,85 @@ +################## mysql-test\t\max_allowed_packet_func.test ################## +# # +# Variable Name: max_allowed_packet # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:1048576 # +# Range:1024-1073741824 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable max_allowed_packet # +# that checks the functionality of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +#due to lost connection on win64 +--source include/not_windows.inc + +SET @start_max_allowed_packet= @@global.max_allowed_packet; +SET @start_value= @@global.net_buffer_length; + +--disable_warnings +drop table if exists t1; +--enable_warnings + +######################### +# Creating new table # +######################### + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name BLOB +); + +--echo '#--------------------FN_DYNVARS_070_01-------------------------#' +############################################################################### +# Setting initial value of max_allowed_packet to 1024 at session level +# should result in an error (session variable is readonly) +############################################################################### + +--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## +--error ER_VARIABLE_IS_READONLY +SET @@session.max_allowed_packet = 1024; +SELECT @@session.max_allowed_packet; + +--error ER_VARIABLE_IS_READONLY +SET @@session.net_buffer_length = 1024; +SELECT @@session.net_buffer_length; + + +--echo '#--------------------FN_DYNVARS_070_02-------------------------#' +############################################################################### +# Setting value of max_allowed_packet to 1024 at global level and +# verifying its behavior after inserting data greater than 1024 bytes +############################################################################### + +--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ## +SET @@global.max_allowed_packet = 1024; +SET @@global.net_buffer_length = 1024; +SELECT @@global.max_allowed_packet; +SELECT @@global.net_buffer_length; + +--echo ## Creating new connection test_con1 ## +connect (test_con1,localhost,root,,); +connection test_con1; + +--echo ## Inserting and fetching data of length greater than 1024 ## +--Error 0,ER_NET_PACKET_TOO_LARGE +INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"); + +disconnect test_con1; +connection default; +drop table t1; +SET @@global.max_allowed_packet= @start_max_allowed_packet; +SET @@global.net_buffer_length= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt new file mode 100644 index 00000000000..6e00d7157d6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt @@ -0,0 +1,2 @@ +--log-bin +--innodb diff --git a/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test new file mode 100644 index 00000000000..11d01b5c10f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_binlog_size_basic.test @@ -0,0 +1,183 @@ +############## mysql-test\t\max_binlog_size_basic.test ############### +# # +# Variable Name: max_binlog_size # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:1073741824 # +# Min Value:4096 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_binlog_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +################################################################## +# START OF max_binlog_size TESTS # +################################################################## + + +################################################################## +# Saving initial value of max_binlog_size in a temporary variable# +################################################################## + +SET @start_value = @@global.max_binlog_size; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_072_01------------------------#' +################################################################## +# Display the DEFAULT value of max_binlog_size # +################################################################## + +SET @@global.max_binlog_size = 5000; +SET @@global.max_binlog_size = DEFAULT; +SELECT @@global.max_binlog_size; +--echo 'Bug# 34878: This variable has invalid default value as compared to documentation'; + +--echo '#---------------------FN_DYNVARS_072_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.max_binlog_size = @start_value; +SELECT @@global.max_binlog_size = 1073741824; + +--echo '#--------------------FN_DYNVARS_072_03------------------------#' +################################################################## +# Change the value of max_binlog_size to a valid value # +################################################################## + +SET @@global.max_binlog_size = 4096; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 1073741824; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 1073741823; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 4097; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 65535; +SELECT @@global.max_binlog_size; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + + +--echo '#--------------------FN_DYNVARS_072_04-------------------------#' +##################################################################### +# Change the value of max_binlog_size to invalid value # +##################################################################### + +SET @@global.max_binlog_size = -1; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 100000000000; +SELECT @@global.max_binlog_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_binlog_size = 10000.01; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = -1024; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 1024; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 4294967296; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = 4095; +SELECT @@global.max_binlog_size; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_binlog_size = ON; +SELECT @@global.max_binlog_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_binlog_size = 'test'; +SELECT @@global.max_binlog_size; + + +--echo '#-------------------FN_DYNVARS_072_05----------------------------#' +##################################################################### +# Test if accessing session max_binlog_size gives error # +##################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.max_binlog_size = 4096; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.max_binlog_size; + + +--echo '#----------------------FN_DYNVARS_072_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.max_binlog_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_binlog_size'; + +SELECT @@max_binlog_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_binlog_size'; + + +--echo '#---------------------FN_DYNVARS_072_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.max_binlog_size = TRUE; +SELECT @@global.max_binlog_size; +SET @@global.max_binlog_size = FALSE; +SELECT @@global.max_binlog_size; + + +--echo '#---------------------FN_DYNVARS_072_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.max_binlog_size = 5000; +SELECT @@max_binlog_size = @@global.max_binlog_size; + + +--echo '#---------------------FN_DYNVARS_072_09----------------------#' +########################################################################## +# Check if max_binlog_size can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET max_binlog_size = 6000; +SELECT @@max_binlog_size; +--Error ER_PARSE_ERROR +SET local.max_binlog_size = 7000; +--Error ER_UNKNOWN_TABLE +SELECT local.max_binlog_size; +--Error ER_PARSE_ERROR +SET global.max_binlog_size = 8000; +--Error ER_UNKNOWN_TABLE +SELECT global.max_binlog_size; +--Error ER_BAD_FIELD_ERROR +SELECT max_binlog_size = @@session.max_binlog_size; + + +############################## +# Restore initial value # +############################## + +SET @@global.max_binlog_size = @start_value; +SELECT @@global.max_binlog_size; + + +################################################################## +# END OF max_binlog_size TESTS # +################################################################## + diff --git a/mysql-test/suite/sys_vars/t/max_connections_basic.test b/mysql-test/suite/sys_vars/t/max_connections_basic.test new file mode 100644 index 00000000000..ffc964db28f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_connections_basic.test @@ -0,0 +1,184 @@ +############## mysql-test\t\max_connections_basic.test ############### +# # +# Variable Name: max_connections # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:151 # +# Range: 1-100000 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_connections # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +############################################################### +# START OF max_connections TESTS # +############################################################### + + +################################################################### +# Saving initial value of max_connections in a temporary variable # +################################################################### + +SET @start_value = @@global.max_connections; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_074_01------------------------#' +################################################################## +# Display the DEFAULT value of max_connections # +################################################################## + +SET @@global.max_connections = 5000; +SET @@global.max_connections = DEFAULT; +SELECT @@global.max_connections; +--echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; + + +--echo '#---------------------FN_DYNVARS_074_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.max_connections = @start_value; +SELECT @@global.max_connections = 151; + + +--echo '#--------------------FN_DYNVARS_074_03------------------------#' +################################################################## +# Change the value of max_connections to a valid value # +################################################################## + +SET @@global.max_connections = 100000; +SELECT @@global.max_connections; +SET @@global.max_connections = 99999; +SELECT @@global.max_connections; +SET @@global.max_connections = 65536; +SELECT @@global.max_connections; +SET @@global.max_connections = 1; +SELECT @@global.max_connections; +SET @@global.max_connections = 2; +SELECT @@global.max_connections; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + + +--echo '#--------------------FN_DYNVARS_074_04-------------------------#' +##################################################################### +# Change the value of max_connections to invalid value # +##################################################################### + +SET @@global.max_connections = -1; +SELECT @@global.max_connections; +SET @@global.max_connections = 100000000000; +SELECT @@global.max_connections; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_connections = 10000.01; +SELECT @@global.max_connections; +SET @@global.max_connections = -1024; +SELECT @@global.max_connections; +SET @@global.max_connections = 0; +SELECT @@global.max_connections; +SET @@global.max_connections = 100001; +SELECT @@global.max_connections; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_connections = ON; +SELECT @@global.max_connections; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_connections = 'test'; +SELECT @@global.max_connections; + + +--echo '#-------------------FN_DYNVARS_074_05----------------------------#' +##################################################################### +# Test if accessing session max_connections gives error # +##################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.max_connections = 4096; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.max_connections; + + +--echo '#----------------------FN_DYNVARS_074_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.max_connections = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_connections'; + +SELECT @@max_connections = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_connections'; + + +--echo '#---------------------FN_DYNVARS_074_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.max_connections = TRUE; +SELECT @@global.max_connections; +SET @@global.max_connections = FALSE; +SELECT @@global.max_connections; + + +--echo '#---------------------FN_DYNVARS_074_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.max_connections = 5000; +SELECT @@max_connections = @@global.max_connections; + + +--echo '#---------------------FN_DYNVARS_074_09----------------------#' +########################################################################## +# Check if max_connections can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET max_connections = 6000; +SELECT @@max_connections; +--Error ER_PARSE_ERROR +SET local.max_connections = 7000; +--Error ER_UNKNOWN_TABLE +SELECT local.max_connections; +--Error ER_PARSE_ERROR +SET global.max_connections = 8000; +--Error ER_UNKNOWN_TABLE +SELECT global.max_connections; +--Error ER_BAD_FIELD_ERROR +SELECT max_connections = @@session.max_connections; + + +############################## +# Restore initial value # +############################## + +SET @@global.max_connections = @start_value; +SELECT @@global.max_connections; + + +################################################################## +# END OF max_connections TESTS # +################################################################## + diff --git a/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test new file mode 100644 index 00000000000..dc908c8396b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_delayed_threads_basic.test @@ -0,0 +1,229 @@ +############## mysql-test\t\max_delayed_threads_basic.test ############### +# # +# Variable Name: max_delayed_threads # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 20 # +# Range: 0-16384 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_delayed_threads # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################################## +# START OF max_delayed_threads TESTS # +################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_delayed_threads; +SELECT @start_global_value; +SET @start_session_value = @@session.max_delayed_threads; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_075_01-------------------------#' +################################################################## +# Display the DEFAULT value of max_delayed_threads # +################################################################## + +SET @@global.max_delayed_threads = 1000; +SET @@global.max_delayed_threads = DEFAULT; +SELECT @@global.max_delayed_threads; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 1000; +--echo 'Bug# 34882: Valid values are not allowed to assign in this variable'; +SET @@session.max_delayed_threads = DEFAULT; +SELECT @@session.max_delayed_threads; + + +--echo '#--------------------FN_DYNVARS_075_02-------------------------#' +################################################################## +# Check the DEFAULT value of max_delayed_threads # +################################################################## + +SET @@global.max_delayed_threads = DEFAULT; +SELECT @@global.max_delayed_threads = 20; + +SET @@session.max_delayed_threads = DEFAULT; +SELECT @@session.max_delayed_threads = 20; + + +--echo '#--------------------FN_DYNVARS_075_03-------------------------#' +############################################################################ +# Change the value of max_delayed_threads to a valid value for GLOBAL Scope # +############################################################################ + +SET @@global.max_delayed_threads = 1; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = 1025; +SELECT @@global.max_delayed_threads; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + +SET @@global.max_delayed_threads = 0; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = 16384; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = 16383; +SELECT @@global.max_delayed_threads; + +--echo '#--------------------FN_DYNVARS_075_04-------------------------#' +############################################################################# +# Change the value of max_delayed_threads to a valid value for SESSION Scope # +############################################################################# + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 1; +SELECT @@session.max_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 1025; +SELECT @@session.max_delayed_threads; + +SET @@session.max_delayed_threads = 0; +SELECT @@session.max_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 16384; +SELECT @@session.max_delayed_threads; + +SET @@session.max_delayed_threads = 16383; +SELECT @@session.max_delayed_threads; + + +--echo '#------------------FN_DYNVARS_075_05-----------------------#' +############################################################## +# Change the value of max_delayed_threads to an invalid value # +############################################################## + +SET @@global.max_delayed_threads = -1024; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = -1; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = 16385; +SELECT @@global.max_delayed_threads; +--Error ER_PARSE_ERROR +SET @@global.max_delayed_threads = 65530.34.; +SELECT @@global.max_delayed_threads; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_delayed_threads = test; +SELECT @@global.max_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 16385; +SELECT @@session.max_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = -1; +SELECT @@session.max_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = -2; +SELECT @@session.max_delayed_threads; +--Error ER_PARSE_ERROR +SET @@session.max_delayed_threads = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_delayed_threads = 10737418241; +SELECT @@session.max_delayed_threads; + + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_delayed_threads = test; +SELECT @@session.max_delayed_threads; + + +--echo '#------------------FN_DYNVARS_075_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_delayed_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_delayed_threads'; + +--echo '#------------------FN_DYNVARS_075_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_delayed_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_delayed_threads'; + + +--echo '#------------------FN_DYNVARS_075_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_delayed_threads = TRUE; +SELECT @@global.max_delayed_threads; +SET @@global.max_delayed_threads = FALSE; +SELECT @@global.max_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_delayed_threads = 2048; +SELECT @@max_delayed_threads = @@global.max_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@max_delayed_threads = 100000; +SELECT @@max_delayed_threads = @@local.max_delayed_threads; +SELECT @@local.max_delayed_threads = @@session.max_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +############################################################################# +# Check if max_delayed_threads can be accessed with and without @@ sign # +############################################################################# + +--Error ER_WRONG_VALUE_FOR_VAR +SET max_delayed_threads = 1024; +SELECT @@max_delayed_threads; +--Error ER_UNKNOWN_TABLE +SELECT local.max_delayed_threads; +--Error ER_UNKNOWN_TABLE +SELECT session.max_delayed_threads; +--Error ER_BAD_FIELD_ERROR +SELECT max_delayed_threads = @@session.max_delayed_threads; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_delayed_threads = @start_global_value; +SELECT @@global.max_delayed_threads; +SET @@session.max_delayed_threads = @start_session_value; +SELECT @@session.max_delayed_threads; + + +####################################################### +# END OF max_delayed_threads TESTS # +####################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_error_count_basic.test b/mysql-test/suite/sys_vars/t/max_error_count_basic.test new file mode 100644 index 00000000000..2b1e12843cf --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_error_count_basic.test @@ -0,0 +1,215 @@ +############## mysql-test\t\max_error_count_basic.test ############### +# # +# Variable Name: max_error_count # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 64 # +# Range: 0-65535 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_error_count # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +############################################################### +# START OF max_error_count TESTS # +############################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_error_count; +SELECT @start_global_value; +SET @start_session_value = @@session.max_error_count; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_076_01-------------------------#' +############################################################### +# Display the DEFAULT value of max_error_count # +############################################################### + +SET @@global.max_error_count = 1000; +SET @@global.max_error_count = DEFAULT; +SELECT @@global.max_error_count; + +SET @@session.max_error_count = 20000; +SET @@session.max_error_count = DEFAULT; +SELECT @@session.max_error_count; + + +--echo '#--------------------FN_DYNVARS_076_02-------------------------#' +################################################################## +# Check the DEFAULT value of max_error_count # +################################################################## + +SET @@global.max_error_count = DEFAULT; +SELECT @@global.max_error_count = 64; + +SET @@session.max_error_count = DEFAULT; +SELECT @@session.max_error_count = 64; + + +--echo '#--------------------FN_DYNVARS_076_03-------------------------#' +############################################################################ +# Change the value of max_error_count to a valid value for GLOBAL Scope # +############################################################################ + +SET @@global.max_error_count = 1; +SELECT @@global.max_error_count; +SET @@global.max_error_count = 0; +SELECT @@global.max_error_count; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + +SET @@global.max_error_count = 65535; +SELECT @@global.max_error_count; +SET @@global.max_error_count = 65534; +SELECT @@global.max_error_count; + +--echo '#--------------------FN_DYNVARS_076_04-------------------------#' +############################################################################# +# Change the value of max_error_count to a valid value for SESSION Scope # +############################################################################# + +SET @@session.max_error_count = 0; +SELECT @@session.max_error_count; +SET @@session.max_error_count = 1; +SELECT @@session.max_error_count; +SET @@session.max_error_count = 65535; +SELECT @@session.max_error_count; +SET @@session.max_error_count = 65534; +SELECT @@session.max_error_count; + + +--echo '#------------------FN_DYNVARS_076_05-----------------------#' +############################################################## +# Change the value of max_error_count to an invalid value # +############################################################## + +SET @@global.max_error_count = -1; +SELECT @@global.max_error_count; +SET @@global.max_error_count = -1024; +SELECT @@global.max_error_count; +SET @@global.max_error_count = 65536; +SELECT @@global.max_error_count; +SET @@global.max_error_count = 10737418241; +SELECT @@global.max_error_count; +--Error ER_PARSE_ERROR +SET @@global.max_error_count = 65530.34.; +SELECT @@global.max_error_count; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_error_count = test; +SELECT @@global.max_error_count; + +SET @@session.max_error_count = -1; +SELECT @@session.max_error_count; +SET @@session.max_error_count = 65536; +SELECT @@session.max_error_count; +SET @@session.max_error_count = -2; +SELECT @@session.max_error_count; +--Error ER_PARSE_ERROR +SET @@session.max_error_count = 65530.34.; +SET @@session.max_error_count = 10737418241; +SELECT @@session.max_error_count; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_error_count = test; +SELECT @@session.max_error_count; + + +--echo '#------------------FN_DYNVARS_076_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_error_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_error_count'; + +--echo '#------------------FN_DYNVARS_076_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_error_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_error_count'; + + +--echo '#------------------FN_DYNVARS_076_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_error_count = TRUE; +SELECT @@global.max_error_count; +SET @@global.max_error_count = FALSE; +SELECT @@global.max_error_count; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_error_count = 2048; +SELECT @@max_error_count = @@global.max_error_count; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@max_error_count = 60000; +SELECT @@max_error_count = @@local.max_error_count; +SELECT @@local.max_error_count = @@session.max_error_count; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +############################################################################# +# Check if max_error_count can be accessed with and without @@ sign # +############################################################################# + +SET max_error_count = 1024; +SELECT @@max_error_count; +--Error ER_UNKNOWN_TABLE +SELECT local.max_error_count; +--Error ER_UNKNOWN_TABLE +SELECT session.max_error_count; +--Error ER_BAD_FIELD_ERROR +SELECT max_error_count = @@session.max_error_count; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_error_count = @start_global_value; +SELECT @@global.max_error_count; +SET @@session.max_error_count = @start_session_value; +SELECT @@session.max_error_count; + + +####################################################### +# END OF max_error_count TESTS # +####################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test b/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test new file mode 100644 index 00000000000..d165ddc11fe --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_insert_delayed_threads_basic.test @@ -0,0 +1,231 @@ +############## mysql-test\t\max_insert_delayed_threads_basic.test ############### +# # +# Variable Name: max_insert_delayed_threads # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: - # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_insert_delayed_threads # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################################## +# START OF max_insert_delayed_threads TESTS # +################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_insert_delayed_threads; +SELECT @start_global_value; +SET @start_session_value = @@session.max_insert_delayed_threads; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_078_01-------------------------#' +################################################################## +# Display the DEFAULT value of max_insert_delayed_threads # +################################################################## + +SET @@global.max_insert_delayed_threads = 1000; +--Error ER_NO_DEFAULT +SET @@global.max_insert_delayed_threads = DEFAULT; +SELECT @@global.max_insert_delayed_threads; + + +SET @@session.max_insert_delayed_threads = 1000; +SET @@session.max_insert_delayed_threads = DEFAULT; +SELECT @@session.max_insert_delayed_threads; + + +--echo '#--------------------FN_DYNVARS_078_02-------------------------#' +################################################################## +# Check the DEFAULT value of max_insert_delayed_threads # +################################################################## + +--Error ER_NO_DEFAULT +SET @@global.max_insert_delayed_threads = DEFAULT; +SELECT @@global.max_insert_delayed_threads = 20; + +SET @@session.max_insert_delayed_threads = DEFAULT; +SELECT @@session.max_insert_delayed_threads = 20; +--echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; + + +--echo '#--------------------FN_DYNVARS_078_03-------------------------#' +###############################################################$$$$$$$$############# +# Change the value of max_insert_delayed_threads to a valid value for GLOBAL Scope # +###############################################################$$$$$$$$############# + +SET @@global.max_insert_delayed_threads = 1; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = 1025; +SELECT @@global.max_insert_delayed_threads; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + +SET @@global.max_insert_delayed_threads = 0; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = 16384; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = 16383; +SELECT @@global.max_insert_delayed_threads; + +--echo '#--------------------FN_DYNVARS_078_04-------------------------#' +##################################################################################### +# Change the value of max_insert_delayed_threads to a valid value for SESSION Scope # +##################################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = 1; +SELECT @@session.max_insert_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = 1025; +SELECT @@session.max_insert_delayed_threads; + +SET @@session.max_insert_delayed_threads = 0; +SELECT @@session.max_insert_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = 16384; +SELECT @@session.max_insert_delayed_threads; + +SET @@session.max_insert_delayed_threads = 16383; +SELECT @@session.max_insert_delayed_threads; + + +--echo '#------------------FN_DYNVARS_078_05-----------------------#' +###################################################################### +# Change the value of max_insert_delayed_threads to an invalid value # +###################################################################### + +SET @@global.max_insert_delayed_threads = -1024; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = -1; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = 16385; +SELECT @@global.max_insert_delayed_threads; +--Error ER_PARSE_ERROR +SET @@global.max_insert_delayed_threads = 65530.34.; +SELECT @@global.max_insert_delayed_threads; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_insert_delayed_threads = test; +SELECT @@global.max_insert_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = 16385; +SELECT @@session.max_insert_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = -1; +SELECT @@session.max_insert_delayed_threads; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = -2; +SELECT @@session.max_insert_delayed_threads; +--Error ER_PARSE_ERROR +SET @@session.max_insert_delayed_threads = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.max_insert_delayed_threads = 10737418241; +SELECT @@session.max_insert_delayed_threads; + + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_insert_delayed_threads = test; +SELECT @@session.max_insert_delayed_threads; + + +--echo '#------------------FN_DYNVARS_078_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_insert_delayed_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_insert_delayed_threads'; + +--echo '#------------------FN_DYNVARS_078_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_insert_delayed_threads = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_insert_delayed_threads'; + + +--echo '#------------------FN_DYNVARS_078_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_insert_delayed_threads = TRUE; +SELECT @@global.max_insert_delayed_threads; +SET @@global.max_insert_delayed_threads = FALSE; +SELECT @@global.max_insert_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_078_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_insert_delayed_threads = 2048; +SELECT @@max_insert_delayed_threads = @@global.max_insert_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_078_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@max_insert_delayed_threads = 100000; +SELECT @@max_insert_delayed_threads = @@local.max_insert_delayed_threads; +SELECT @@local.max_insert_delayed_threads = @@session.max_insert_delayed_threads; + + +--echo '#---------------------FN_DYNVARS_078_11----------------------#' +##################################################################################### +# Check if max_insert_delayed_threads can be accessed with and without @@ sign # +##################################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET max_insert_delayed_threads = 1024; +SELECT @@max_insert_delayed_threads; +--Error ER_UNKNOWN_TABLE +SELECT local.max_insert_delayed_threads; +--Error ER_UNKNOWN_TABLE +SELECT session.max_insert_delayed_threads; +--Error ER_BAD_FIELD_ERROR +SELECT max_insert_delayed_threads = @@session.max_insert_delayed_threads; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_insert_delayed_threads = @start_global_value; +SELECT @@global.max_insert_delayed_threads; +SET @@session.max_insert_delayed_threads = @start_session_value; +SELECT @@session.max_insert_delayed_threads; + + +############################################################### +# END OF max_insert_delayed_threads TESTS # +############################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_join_size_func.test b/mysql-test/suite/sys_vars/t/max_join_size_func.test new file mode 100644 index 00000000000..0ea0d77bcd6 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_join_size_func.test @@ -0,0 +1,124 @@ +################# mysql-test\t\max_join_size_func.test ######################## +# # +# Variable Name: max_join_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 4294967295 # +# Range: 1-4294967295 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable max_join_size # +# that checks the functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + + +--disable_warnings +drop table if exists t1; +--enable_warnings + +############################## +# Creating two new tables # +############################## + +--echo ## Creating new table t1 ## +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +--echo ## Creating another table t2 ## +CREATE TABLE t2 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name VARCHAR(30) +); + +######################################### +# Inserting some data in both tables # +######################################### + +--echo ## Inserting records in both the tables ## +INSERT INTO t1(name) VALUES('Record_1'); +INSERT INTO t1(name) VALUES('Record_2'); +INSERT INTO t1(name) VALUES('Record_3'); +INSERT INTO t1(name) VALUES('Record_4'); +INSERT INTO t1(name) VALUES('Record_5'); + +INSERT INTO t2(name) VALUES('Record_1_1'); +INSERT INTO t2(name) VALUES('Record_2_1'); +INSERT INTO t2(name) VALUES('Record_3_1'); +INSERT INTO t2(name) VALUES('Record_4_1'); +INSERT INTO t2(name) VALUES('Record_5_1'); + + +--echo '#--------------------FN_DYNVARS_079_01-------------------------#' +####################################################################### +# Verifying case where max_join_size is greater than the join size # +####################################################################### + + +--echo ## Setting max_join size value to 10 ## +SET @@session.max_join_size=10; + +--echo ## This should work ## +SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id; + + +--echo '#--------------------FN_DYNVARS_079_02-------------------------#' +#################################################################### +# Verifying case where max_join_size is less than the join size # +#################################################################### + +--echo ## Creating new connection test_con1 ## +connect (test_con1, localhost, root,,); +connection test_con1; + +--echo ## Setting value of max_join_size ## +SET @@session.max_join_size=8; + +--echo ## Since total joins are more than max_join_size value so error will occur ## +--Error ER_TOO_BIG_SELECT +SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id; + + +--echo '#--------------------FN_DYNVARS_079_03-------------------------#' +########################################################## +# Verifying behavior of max_join_size on global scope # +########################################################## + +--echo ## Setting global value of variable ## +SET @@global.max_join_size=8; + +--echo ## Creating and switching to new connection test_con2 ## +connect (test_con2, localhost, root,,); +connection test_con2; + +--echo ## Verifying value of max_join_size ## +SELECT @@global.max_join_size; + +--echo ## Since total joins are more than max_join_size value so error will occur ## +--Error ER_TOO_BIG_SELECT +SELECT * FROM t1 INNER JOIN t2 ON t1.id = t2.id; + +--echo ## Dropping both the tables ## +Drop table t1, t2; + +--echo ## Restoring values ## +SET @@global.max_join_size = DEFAULT; +SET @@session.max_join_size = DEFAULT; + +--echo ## Dropping connections ## +disconnect test_con1; +disconnect test_con2; + diff --git a/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test new file mode 100644 index 00000000000..682e14146d7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_length_for_sort_data_basic.test @@ -0,0 +1,224 @@ +############## mysql-test\t\max_length_for_sort_data_basic.test ############### +# # +# Variable Name: max_length_for_sort_data # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 1024 # +# Range: 4-8388608 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_length_for_sort_data # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +##################################################### +# START OF max_length_for_sort_data TESTS # +##################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_length_for_sort_data; +SELECT @start_global_value; +SET @start_session_value = @@session.max_length_for_sort_data; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_080_01-------------------------#' +################################################################ +# Display the DEFAULT value of max_length_for_sort_data # +################################################################ + +SET @@global.max_length_for_sort_data = 1000; +SET @@global.max_length_for_sort_data = DEFAULT; +SELECT @@global.max_length_for_sort_data; + + +SET @@session.max_length_for_sort_data = 1000; +SET @@session.max_length_for_sort_data = DEFAULT; +SELECT @@session.max_length_for_sort_data; + + +--echo '#--------------------FN_DYNVARS_080_02-------------------------#' +################################################################ +# Check the DEFAULT value of max_length_for_sort_data # +################################################################ + +SET @@global.max_length_for_sort_data = DEFAULT; +SELECT @@global.max_length_for_sort_data = 1024; + +SET @@session.max_length_for_sort_data = DEFAULT; +SELECT @@session.max_length_for_sort_data = 1024; + + + +--echo '#--------------------FN_DYNVARS_080_03-------------------------#' +################################################################################## +# Change the value of max_length_for_sort_data to a valid value for GLOBAL Scope # +################################################################################## + +SET @@global.max_length_for_sort_data = 4; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 5; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 8388608; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 8388607; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 65536; +SELECT @@global.max_length_for_sort_data; + +--echo '#--------------------FN_DYNVARS_080_04-------------------------#' +################################################################################### +# Change the value of max_length_for_sort_data to a valid value for SESSION Scope # +################################################################################### + +SET @@session.max_length_for_sort_data = 4; +SELECT @@session.max_length_for_sort_data; + +SET @@session.max_length_for_sort_data = 5; +SELECT @@session.max_length_for_sort_data; + +SET @@session.max_length_for_sort_data = 8388608; +SELECT @@session.max_length_for_sort_data; + +SET @@session.max_length_for_sort_data = 8388607; +SELECT @@session.max_length_for_sort_data; + +SET @@session.max_length_for_sort_data = 65536; +SELECT @@session.max_length_for_sort_data; + + +--echo '#------------------FN_DYNVARS_080_05-----------------------#' +#################################################################### +# Change the value of max_length_for_sort_data to an invalid value # +#################################################################### + +SET @@global.max_length_for_sort_data = -1024; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 3; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 8388609; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = 0; +SELECT @@global.max_length_for_sort_data; +--Error ER_PARSE_ERROR +SET @@global.max_length_for_sort_data = 65530.34.; +SELECT @@global.max_length_for_sort_data; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_length_for_sort_data = test; +SELECT @@global.max_length_for_sort_data; + +SET @@session.max_length_for_sort_data = 8388610; +SELECT @@session.max_length_for_sort_data; +SET @@session.max_length_for_sort_data = -1; +SELECT @@session.max_length_for_sort_data; +SET @@session.max_length_for_sort_data = 3; +SELECT @@session.max_length_for_sort_data; +SET @@session.max_length_for_sort_data = 0; +SELECT @@session.max_length_for_sort_data; +--Error ER_PARSE_ERROR +SET @@session.max_length_for_sort_data = 65530.34.; +SET @@session.max_length_for_sort_data = 10737418241; +SELECT @@session.max_length_for_sort_data; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_length_for_sort_data = test; +SELECT @@session.max_length_for_sort_data; + + +--echo '#------------------FN_DYNVARS_080_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_length_for_sort_data = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_length_for_sort_data'; + +--echo '#------------------FN_DYNVARS_080_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_length_for_sort_data = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_length_for_sort_data'; + + +--echo '#------------------FN_DYNVARS_080_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_length_for_sort_data = TRUE; +SELECT @@global.max_length_for_sort_data; +SET @@global.max_length_for_sort_data = FALSE; +SELECT @@global.max_length_for_sort_data; + + +--echo '#---------------------FN_DYNVARS_080_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_length_for_sort_data = 2048; +SELECT @@max_length_for_sort_data = @@global.max_length_for_sort_data; + + +--echo '#---------------------FN_DYNVARS_080_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@max_length_for_sort_data = 100000; +SELECT @@max_length_for_sort_data = @@local.max_length_for_sort_data; +SELECT @@local.max_length_for_sort_data = @@session.max_length_for_sort_data; + + +--echo '#---------------------FN_DYNVARS_080_11----------------------#' +################################################################################### +# Check if max_length_for_sort_data can be accessed with and without @@ sign # +################################################################################### + + +SET max_length_for_sort_data = 1024; +SELECT @@max_length_for_sort_data; +--Error ER_UNKNOWN_TABLE +SELECT local.max_length_for_sort_data; +--Error ER_UNKNOWN_TABLE +SELECT session.max_length_for_sort_data; +--Error ER_BAD_FIELD_ERROR +SELECT max_length_for_sort_data = @@session.max_length_for_sort_data; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_length_for_sort_data = @start_global_value; +SELECT @@global.max_length_for_sort_data; +SET @@session.max_length_for_sort_data = @start_session_value; +SELECT @@session.max_length_for_sort_data; + + +############################################################# +# END OF max_length_for_sort_data TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test new file mode 100644 index 00000000000..2206a388abb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_basic.test @@ -0,0 +1,185 @@ +############## mysql-test\t\max_prepared_stmt_count_basic.test ############### +# # +# Variable Name: max_prepared_stmt_count # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 16382 # +# Range: 0-1048576 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +#Due to differences in the results, ps-protocol is switched off. +--disable_ps_protocol + +--source include/load_sysvars.inc + + +######################################################################## +# START OF max_prepared_stmt_count TESTS # +######################################################################## + + +########################################################################### +# Saving initial value of max_prepared_stmt_count in a temporary variable # +########################################################################### + +SET @start_value = @@global.max_prepared_stmt_count; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_081_01------------------------#' +########################################################################## +# Display the DEFAULT value of max_prepared_stmt_count # +########################################################################## + +SET @@global.max_prepared_stmt_count = 5000; +SET @@global.max_prepared_stmt_count = DEFAULT; +SELECT @@global.max_prepared_stmt_count; + + +--echo '#---------------------FN_DYNVARS_081_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.max_prepared_stmt_count = @start_value; +SELECT @@global.max_prepared_stmt_count = 16382; + + +--echo '#--------------------FN_DYNVARS_081_03------------------------#' +########################################################################## +# Change the value of max_prepared_stmt_count to a valid value # +########################################################################## + +SET @@global.max_prepared_stmt_count = 0; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 1; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 1048576; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 1048575; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 65535; +SELECT @@global.max_prepared_stmt_count; + + +--echo '#--------------------FN_DYNVARS_081_04-------------------------#' +############################################################################# +# Change the value of max_prepared_stmt_count to invalid value # +############################################################################# + +SET @@global.max_prepared_stmt_count = -1; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 100000000000; +SELECT @@global.max_prepared_stmt_count; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_prepared_stmt_count = 10000.01; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = -1024; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 1048577; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = 104857612; +SELECT @@global.max_prepared_stmt_count; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_prepared_stmt_count = ON; +SELECT @@global.max_prepared_stmt_count; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_prepared_stmt_count = 'test'; +SELECT @@global.max_prepared_stmt_count; + + +--echo '#-------------------FN_DYNVARS_081_05----------------------------#' +############################################################################# +# Test if accessing session max_prepared_stmt_count gives error # +############################################################################# + +--Error ER_GLOBAL_VARIABLE +SET @@session.max_prepared_stmt_count = 4096; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.max_prepared_stmt_count; + + +--echo '#----------------------FN_DYNVARS_081_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.max_prepared_stmt_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_prepared_stmt_count'; + +SELECT @@max_prepared_stmt_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_prepared_stmt_count'; + + +--echo '#---------------------FN_DYNVARS_081_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.max_prepared_stmt_count = TRUE; +SELECT @@global.max_prepared_stmt_count; +SET @@global.max_prepared_stmt_count = FALSE; +SELECT @@global.max_prepared_stmt_count; + + +--echo '#---------------------FN_DYNVARS_081_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.max_prepared_stmt_count = 5000; +SELECT @@max_prepared_stmt_count = @@global.max_prepared_stmt_count; + + +--echo '#---------------------FN_DYNVARS_081_09----------------------#' +################################################################################ +# Check if max_prepared_stmt_count can be accessed with and without @@ sign # +################################################################################ + +--Error ER_GLOBAL_VARIABLE +SET max_prepared_stmt_count = 6000; +SELECT @@max_prepared_stmt_count; +--Error ER_PARSE_ERROR +SET local.max_prepared_stmt_count = 7000; +--Error ER_UNKNOWN_TABLE +SELECT local.max_prepared_stmt_count; +--Error ER_PARSE_ERROR +SET global.max_prepared_stmt_count = 8000; +--Error ER_UNKNOWN_TABLE +SELECT global.max_prepared_stmt_count; +--Error ER_BAD_FIELD_ERROR +SELECT max_prepared_stmt_count = @@session.max_prepared_stmt_count; + + +############################## +# Restore initial value # +############################## + +SET @@global.max_prepared_stmt_count = @start_value; +SELECT @@global.max_prepared_stmt_count; + +--enable_ps_protocol +######################################################################## +# END OF max_prepared_stmt_count TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test new file mode 100644 index 00000000000..6617c4ad2ea --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_prepared_stmt_count_func.test @@ -0,0 +1,152 @@ +############# mysql-test\t\max_prepared_stmt_count_fn.test ##################### +# # +# Variable Name: max_prepared_stmt_count # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 16382 # +# Values: 0-1048576 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "max_prepared_stmt_count" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# +# option_mysqld_max_prepared_stmt_count # +# # +################################################################################ + + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @global_max_prepared_stmt_count = @@global.max_prepared_stmt_count; + + +--echo '#---------------------FN_DYNVARS_031_01----------------------#' +################################################################################# +# Check if prepared stmt Can be created more then max_prepared_stmt_count value# +################################################################################# + +SET GLOBAL max_prepared_stmt_count=2; +--echo ** Prepare statements ** +#preparing stmts +PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--Error ER_MAX_PREPARED_STMT_COUNT_REACHED +PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--echo Expected error "Max prepared statements count reached" + +SHOW STATUS like 'Prepared_stmt_count'; +--echo 2 Expected + + +--echo '#---------------------FN_DYNVARS_031_02----------------------#' +################################################################################ +# Check if prepared stmt Can be created more then max_prepared_stmt_count value +################################################################################ + +SET GLOBAL max_prepared_stmt_count=0; + +--Error ER_MAX_PREPARED_STMT_COUNT_REACHED +PREPARE stmt3 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--echo Expected error "Max prepared statements count reached" + +SHOW STATUS like 'Prepared_stmt_count'; +--echo 2 Expected + +--Error ER_MAX_PREPARED_STMT_COUNT_REACHED +PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--echo Expected error "Max prepared statements count reached" + +SHOW STATUS like 'Prepared_stmt_count'; +--echo 2 Expected +--echo 'Bug#35389 A pre existing valid prepared statement DROPS if a PREPARE' +--echo 'STATEMENT command is issued with the same name that' +--echo 'causes ER_MAX_PREPARED_STMT_COUNT_REACHED error' + + +--echo '#---------------------FN_DYNVARS_031_03----------------------#' +############################################################################## +# check the status of prepared_max stmt after setting max_prepared_stmt_count +############################################################################## + + +SHOW STATUS like 'Prepared_stmt_count'; +SET GLOBAL max_prepared_stmt_count=4; +PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt3 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--echo ** Value of prepared stmt' +SHOW STATUS LIKE 'Prepared_stmt_count'; +--echo 4 Expected + + +--echo '#---------------------FN_DYNVARS_031_04----------------------#' +###################################################################### +# Setting value lower then number of prepared stmt # +###################################################################### + +--echo ** preparing stmts ** +#preparing stmts + +PREPARE stmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt1 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +PREPARE stmt2 from "SELECT * FROM information_schema.CHARACTER_SETS C"; + +--echo ** setting value ** +SET GLOBAL max_prepared_stmt_count=3; +--echo ** Check wether any more statements can be prepared ** + +--Error ER_MAX_PREPARED_STMT_COUNT_REACHED +PREPARE stmt5 from "SELECT * FROM information_schema.CHARACTER_SETS C"; +--echo Expected error "Max prepared statements count reached" + +SHOW STATUS LIKE 'Prepared_stmt_count'; +--echo 4 Expected + + +--echo '#---------------------FN_DYNVARS_031_05----------------------#' +########################################################################### +# Checking in stored procedure# +########################################################################### + +SET GLOBAL max_prepared_stmt_count=3; + +--echo ** Creating procedure ** +# create procedure to add rows +DROP PROCEDURE IF EXISTS sp_checkstmts; + +DELIMITER //; + +CREATE PROCEDURE sp_checkstmts () +BEGIN +PREPARE newstmt from "SELECT * FROM information_schema.CHARACTER_SETS C"; +END // + +DELIMITER ;// + +-- Error ER_MAX_PREPARED_STMT_COUNT_REACHED +CALL sp_checkstmts(); +--echo Expected error "Max prepared statements count reached" + +# +# Cleanup +# + +DROP PREPARE stmt; +DROP PREPARE stmt1; +DROP PREPARE stmt2; +DROP PREPARE stmt3; + +DROP PROCEDURE sp_checkstmts; + +SET @@global.max_prepared_stmt_count = @global_max_prepared_stmt_count; diff --git a/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test new file mode 100644 index 00000000000..b780aa2b444 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_relay_log_size_basic.test @@ -0,0 +1,184 @@ +############## mysql-test\t\max_relay_log_size_basic.test ############### +# # +# Variable Name: max_relay_log_size # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 1024 # +# Range: 0-1073741824 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_relay_log_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################### +# START OF max_relay_log_size TESTS # +################################################################### + + +###################################################################### +# Saving initial value of max_relay_log_size in a temporary variable # +###################################################################### + +SET @start_value = @@global.max_relay_log_size; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_082_01------------------------#' +##################################################################### +# Display the DEFAULT value of max_relay_log_size # +##################################################################### + +SET @@global.max_relay_log_size = 5000; +SET @@global.max_relay_log_size = DEFAULT; +SELECT @@global.max_relay_log_size; + + +--echo '#---------------------FN_DYNVARS_082_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.max_relay_log_size = @start_value; +SELECT @@global.max_relay_log_size = 1024; +--echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; + + +--echo '#--------------------FN_DYNVARS_082_03------------------------#' +##################################################################### +# Change the value of max_relay_log_size to a valid value # +##################################################################### + +SET @@global.max_relay_log_size = 0; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 1; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 1073741824; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 1073741823; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 65535; +SELECT @@global.max_relay_log_size; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + +--echo '#--------------------FN_DYNVARS_082_04-------------------------#' +######################################################################## +# Change the value of max_relay_log_size to invalid value # +######################################################################## + +SET @@global.max_relay_log_size = -1; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 100000000000; +SELECT @@global.max_relay_log_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_relay_log_size = 10000.01; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = -1024; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 1073741825; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = 10737418241; +SELECT @@global.max_relay_log_size; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_relay_log_size = ON; +SELECT @@global.max_relay_log_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_relay_log_size = 'test'; +SELECT @@global.max_relay_log_size; + + +--echo '#-------------------FN_DYNVARS_082_05----------------------------#' +######################################################################## +# Test if accessing session max_relay_log_size gives error # +######################################################################## + +--Error ER_GLOBAL_VARIABLE +SET @@session.max_relay_log_size = 4096; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.max_relay_log_size; + + +--echo '#----------------------FN_DYNVARS_082_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.max_relay_log_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_relay_log_size'; + +SELECT @@max_relay_log_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_relay_log_size'; + + +--echo '#---------------------FN_DYNVARS_082_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.max_relay_log_size = TRUE; +SELECT @@global.max_relay_log_size; +SET @@global.max_relay_log_size = FALSE; +SELECT @@global.max_relay_log_size; + + +--echo '#---------------------FN_DYNVARS_082_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.max_relay_log_size = 5000; +SELECT @@max_relay_log_size = @@global.max_relay_log_size; + + +--echo '#---------------------FN_DYNVARS_082_09----------------------#' +############################################################################# +# Check if max_relay_log_size can be accessed with and without @@ sign # +############################################################################# + +--Error ER_GLOBAL_VARIABLE +SET max_relay_log_size = 6000; +SELECT @@max_relay_log_size; +--Error ER_PARSE_ERROR +SET local.max_relay_log_size = 7000; +--Error ER_UNKNOWN_TABLE +SELECT local.max_relay_log_size; +--Error ER_PARSE_ERROR +SET global.max_relay_log_size = 8000; +--Error ER_UNKNOWN_TABLE +SELECT global.max_relay_log_size; +--Error ER_BAD_FIELD_ERROR +SELECT max_relay_log_size = @@session.max_relay_log_size; + + +############################## +# Restore initial value # +############################## + +SET @@global.max_relay_log_size = @start_value; +SELECT @@global.max_relay_log_size; + + +##################################################################### +# END OF max_relay_log_size TESTS # +##################################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test new file mode 100644 index 00000000000..d49382b9f4f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test @@ -0,0 +1,100 @@ +# Test for max_seeks_for_key # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + + +######################### +# Creating new table # +######################### + +CREATE TABLE t1 +(a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(20) +); + +SET @start_value= @@global.max_seeks_for_key; + +--echo '#--------------------FN_DYNVARS_084_01-------------------------#' +########################################################## +# Test behavior of variable on new connection # 01 # +########################################################## + +CONNECT (test_con1,localhost,root,,); +CONNECTION test_con1; + +# Value of session & global vairable here should be 10 +SELECT @@global.max_seeks_for_key = 10; +SELECT @@session.max_seeks_for_key = 10; + +# Setting global value of variable and inserting data in table +SET @@global.max_seeks_for_key = 20; +SELECT @@global.max_seeks_for_key; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; + +# Setting session value of variable and inserting data in table +SET @@session.max_seeks_for_key = 2; +SELECT @@session.max_seeks_for_key; +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; + + +--echo '#--------------------FN_DYNVARS_084_02-------------------------#' +########################################################## +# Test behavior of variable on new connection # 02 # +########################################################## + + +CONNECT (test_con2,localhost,root,,); +connection test_con2; + + +# Value of session & global vairable here should be 10 +SELECT @@global.max_seeks_for_key = 10; +SELECT @@session.max_seeks_for_key = 10; + +# Setting global value of variable and inserting data in table +SET @@global.max_seeks_for_key = 20; +SELECT @@global.max_seeks_for_key; +INSERT INTO t1(b) VALUES("AREc"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; + +# Setting session value of variable and inserting data in table +SET @@session.max_seeks_for_key = 2; +SELECT @@session.max_seeks_for_key; +INSERT INTO t1(b) VALUES("BREc"); +INSERT INTO t1(b) VALUES("CRec"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; + +###################################################### +# Inserting values in table t and analyzing table # +###################################################### + +INSERT INTO t1 VALUES(null,"test"); +INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"), + (null,"a"),(null,"a"),(null,"a"),(null,"a"), + (null,"a"),(null,"a"),(null,"a"); +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; +ANALYZE TABLE t1; + +################################################################### +# Setting new value for max_seeks_for_key and anaylyzing table # +################################################################### + +SET MAX_SEEKS_FOR_KEY=1; + + +EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; +SET MAX_SEEKS_FOR_KEY=DEFAULT; + +connection default; +disconnect test_con1; +disconnect test_con2; + +DROP TABLE t1; + +SET @@global.max_seeks_for_key= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_basic.test b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test new file mode 100644 index 00000000000..1198d7b1851 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_sort_length_basic.test @@ -0,0 +1,225 @@ +############## mysql-test\t\max_sort_length_basic.test ############### +# # +# Variable Name: max_sort_length # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 1024 # +# Range: 4-8388608 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_sort_length # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +############################################ +# START OF max_sort_length TESTS # +############################################ + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_sort_length; +SELECT @start_global_value; +SET @start_session_value = @@session.max_sort_length; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_084_01-------------------------#' +####################################################### +# Display the DEFAULT value of max_sort_length # +####################################################### + +SET @@global.max_sort_length = 1000; +SET @@global.max_sort_length = DEFAULT; +SELECT @@global.max_sort_length; + + +SET @@session.max_sort_length = 1000; +SET @@session.max_sort_length = DEFAULT; +SELECT @@session.max_sort_length; + + +--echo '#--------------------FN_DYNVARS_084_02-------------------------#' +####################################################### +# Check the DEFAULT value of max_sort_length # +####################################################### + +SET @@global.max_sort_length = DEFAULT; +SELECT @@global.max_sort_length = 1024; + +SET @@session.max_sort_length = DEFAULT; +SELECT @@session.max_sort_length = 1024; + + + +--echo '#--------------------FN_DYNVARS_084_03-------------------------#' +######################################################################### +# Change the value of max_sort_length to a valid value for GLOBAL Scope # +######################################################################### + +SET @@global.max_sort_length = 4; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 5; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 8388608; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 8388607; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 65536; +SELECT @@global.max_sort_length; + +--echo '#--------------------FN_DYNVARS_084_04-------------------------#' +########################################################################## +# Change the value of max_sort_length to a valid value for SESSION Scope # +########################################################################## + +SET @@session.max_sort_length = 4; +SELECT @@session.max_sort_length; + +SET @@session.max_sort_length = 5; +SELECT @@session.max_sort_length; + +SET @@session.max_sort_length = 8388608; +SELECT @@session.max_sort_length; + +SET @@session.max_sort_length = 8388607; +SELECT @@session.max_sort_length; + +SET @@session.max_sort_length = 65536; +SELECT @@session.max_sort_length; + + +--echo '#------------------FN_DYNVARS_084_05-----------------------#' +########################################################### +# Change the value of max_sort_length to an invalid value # +########################################################### + +SET @@global.max_sort_length = -1024; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 3; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 8388609; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = 0; +SELECT @@global.max_sort_length; +--Error ER_PARSE_ERROR +SET @@global.max_sort_length = 65530.34.; +SELECT @@global.max_sort_length; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_sort_length = test; +SELECT @@global.max_sort_length; + +SET @@session.max_sort_length = 8388610; +SELECT @@session.max_sort_length; +SET @@session.max_sort_length = -1; +SELECT @@session.max_sort_length; +SET @@session.max_sort_length = 3; +SELECT @@session.max_sort_length; +SET @@session.max_sort_length = 0; +SELECT @@session.max_sort_length; +--Error ER_PARSE_ERROR +SET @@session.max_sort_length = 65530.34.; +SET @@session.max_sort_length = 10737418241; +SELECT @@session.max_sort_length; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_sort_length = test; +SELECT @@session.max_sort_length; + + +--echo '#------------------FN_DYNVARS_084_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_sort_length = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_sort_length'; + +--echo '#------------------FN_DYNVARS_084_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_sort_length = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_sort_length'; + + +--echo '#------------------FN_DYNVARS_084_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_sort_length = TRUE; +SELECT @@global.max_sort_length; +SET @@global.max_sort_length = FALSE; +SELECT @@global.max_sort_length; + + +--echo '#---------------------FN_DYNVARS_084_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_sort_length = 2048; +SELECT @@max_sort_length = @@global.max_sort_length; + + +--echo '#---------------------FN_DYNVARS_084_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@max_sort_length = 100000; +SELECT @@max_sort_length = @@local.max_sort_length; +SELECT @@local.max_sort_length = @@session.max_sort_length; + + +--echo '#---------------------FN_DYNVARS_084_11----------------------#' +########################################################################## +# Check if max_sort_length can be accessed with and without @@ sign # +########################################################################## + + +SET max_sort_length = 1024; +SELECT @@max_sort_length; +--Error ER_UNKNOWN_TABLE +SELECT local.max_sort_length; +--Error ER_UNKNOWN_TABLE +SELECT session.max_sort_length; +--Error ER_BAD_FIELD_ERROR +SELECT max_sort_length = @@session.max_sort_length; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_sort_length = @start_global_value; +SELECT @@global.max_sort_length; +SET @@session.max_sort_length = @start_session_value; +SELECT @@session.max_sort_length; + + +#################################################### +# END OF max_sort_length TESTS # +#################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test new file mode 100644 index 00000000000..74642a10861 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test @@ -0,0 +1,257 @@ +############# mysql-test\t\max_sort_length_func.test ########################### +# # +# Variable Name: sql_warnings # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 1024 # +# Values: 4-8388608 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable max_sort_length # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ + +# +# Setup +# + +SET @start_value= @@global.max_sort_length; + +SET @session_max_sort_length = @@Session.max_sort_length; + + +--disable_warnings +DROP TABLE IF EXISTS t; +--enable_warnings + +######################### +# Creating new table # +######################### + + +--echo ** creating tables ** +CREATE TABLE t +( +id INT AUTO_INCREMENT PRIMARY KEY, +c TEXT(30) +); + +CREATE TABLE t1 +( +id INT AUTO_INCREMENT PRIMARY KEY, +c BLOB(30) +); + +CREATE TABLE t2 +( +id INT AUTO_INCREMENT PRIMARY KEY, +c TEXT(30) +); + + + +--echo '#--------------------FN_DYNVARS_098_01-------------------------#' +########################################################## +# Test behavior of variable on new connection # 01 # +########################################################## + + +--echo ** Connecting test_con1 using username 'root' ** +connect (test_con1,localhost,root,,); +--echo ** Connection test_con1 ** +connection test_con1; + +# Value of session & global vairable here should be 10 +SELECT @@global.max_sort_length = 10; +SELECT @@session.max_sort_length = 10; + +# Setting global value of variable and inserting data in table +--echo ** Setting value to 30 and inserting data ** +SET @@global.max_sort_length = 30; +SELECT @@global.max_sort_length; +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); +SELECT c from t ORDER BY c, id; +--echo ** Results should be sorted ** + +# Setting session value of variable and inserting data in table +SET @@session.max_sort_length = 29; +SELECT @@session.max_sort_length; +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); +SELECT c from t ORDER BY c, id; +--echo ** Results should be sorted ** + +--echo '#--------------------FN_DYNVARS_098_02-------------------------#' +########################################################## +# Test behavior of variable on new connection # 02 # +########################################################## + +--echo ** Connecting test_con2 using username 'root' ** +connect (test_con2,localhost,root,,); +--echo ** Connection test_con2 ** +connection test_con2; + + +## Setting global value of variable and inserting data in table +SET @@global.max_sort_length = 30; +SELECT @@global.max_sort_length; +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); +SELECT c from t ORDER BY c, id; + +--echo ** Results should be sorted ** + +# Setting session value of variable and inserting data in table +SET @@session.max_sort_length = 20; +SELECT @@session.max_sort_length; +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); +SELECT c from t ORDER BY c, id; + +--echo ** Results should not be sorted ** + +--echo '#--------------------FN_DYNVARS_098_03-------------------------#' +######################################################### +#Check if sorting is applied with the max_sort_length=20# +######################################################### + +########################################### +# Setting new value for max_sort_length # +########################################### + +SET max_sort_length=20; + +################################### +# Inserting values in table t # +################################### + +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); + +SELECT c from t ORDER BY c, id; +--echo ** Results should not be sorted ** + +RESET QUERY CACHE; + + +--echo '#--------------------FN_DYNVARS_098_04-------------------------#' +######################################################### +#Check if sorting is applied with the max_sort_length=29# +######################################################### + +SET max_sort_length=29; +SELECT c from t ORDER BY c, id; +--echo ** Results should be sorted ** + +--echo '#--------------------FN_DYNVARS_098_05-------------------------#' +######################################################### +#Check if sorting is applied with the max_sort_length=30# +######################################################### + +SET max_sort_length=30; +SELECT c from t ORDER BY c, id; +--echo ** Results should be sorted ** + +--echo '#--------------------FN_DYNVARS_098_06-------------------------#' +############################################################## +#Check if sorting is applied with the max_sort_length=Default# +############################################################## + + +SET max_sort_length=default; +SELECT c from t ORDER BY c, id; +--echo ** Results should be sorted ** + + +--echo '#--------------------FN_DYNVARS_098_07-------------------------#' +########################################### +#Check if sorting is applied on BLOB type # +########################################### +--echo Testing type BLOB +# Setting global value of variable and inserting data in table +SET @@global.max_sort_length = 30; +SELECT @@global.max_sort_length; +INSERT INTO t1 set c = repeat('x',29); +INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); +SELECT c from t1 ORDER BY c, id; +--echo ** Results should be sorted ** + +# Setting session value of variable and inserting data in table +SET @@session.max_sort_length = 20; +SELECT @@session.max_sort_length; +INSERT INTO t1 set c = repeat('x',29); +INSERT INTO t1 set c = concat(repeat('x',28),'r','x'); +INSERT INTO t1 set c = concat(repeat('x',28),'s','y'); +INSERT INTO t1 set c = concat(repeat('x',28),'g','w'); +SELECT c from t1 ORDER BY c, id; +--echo ** Results should not be sorted ** + +--echo '#--------------------FN_DYNVARS_098_08-------------------------#' +########################################### +#Check if sorting is applied on CHAR type # +########################################### +--echo Testing type CHAR +# Setting global value of variable and inserting data in table +SET @@global.max_sort_length = 30; +SELECT @@global.max_sort_length; +INSERT INTO t2 set c = repeat('x',29); +INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +SELECT c from t2 ORDER BY c, id; +--echo ** Results should not be sorted ** + +# Setting session value of variable and inserting data in table +SET @@session.max_sort_length = 20; +SELECT @@session.max_sort_length; +INSERT INTO t2 set c = repeat('x',29); +INSERT INTO t2 set c = concat(repeat('x',28),'r','x'); +INSERT INTO t2 set c = concat(repeat('x',28),'s','y'); +INSERT INTO t2 set c = concat(repeat('x',28),'g','w'); +SELECT c from t2 ORDER BY c, id; +--echo ** Results should not be sorted ** + + +# +# Cleanup +# + +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting test_con1, test_con2 ** +disconnect test_con1; +disconnect test_con2; + +SET @@SESSION.max_sort_length = @session_max_sort_length; + +--disable_warnings +DROP TABLE IF EXISTS t; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +SET @@global.max_sort_length= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test new file mode 100644 index 00000000000..8089951c8a2 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_basic.test @@ -0,0 +1,225 @@ +############## mysql-test\t\max_sp_recursion_depth_basic.test ############### +# # +# Variable Name: max_sp_recursion_depth # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:0 # +# Max value:255 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_sp_recursion_depth # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +############################################ +# START OF max_sp_recursion_depth TESTS # +############################################ + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_sp_recursion_depth; +SELECT @start_global_value; +SET @start_session_value = @@session.max_sp_recursion_depth; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_085_01-------------------------#' +############################################################## +# Display the DEFAULT value of max_sp_recursion_depth # +############################################################## + +SET @@global.max_sp_recursion_depth = 1000; +SET @@global.max_sp_recursion_depth = DEFAULT; +SELECT @@global.max_sp_recursion_depth; + + +SET @@session.max_sp_recursion_depth = 1000; +SET @@session.max_sp_recursion_depth = DEFAULT; +SELECT @@session.max_sp_recursion_depth; + + +--echo '#--------------------FN_DYNVARS_085_02-------------------------#' +############################################################## +# Check the DEFAULT value of max_sp_recursion_depth # +############################################################## + +SET @@global.max_sp_recursion_depth = DEFAULT; +SELECT @@global.max_sp_recursion_depth = 0; + +SET @@session.max_sp_recursion_depth = DEFAULT; +SELECT @@session.max_sp_recursion_depth = 0; + + + +--echo '#--------------------FN_DYNVARS_085_03-------------------------#' +######################################################################### +# Change the value of max_sp_recursion_depth to a valid value for GLOBAL Scope # +######################################################################### + +SET @@global.max_sp_recursion_depth = 0; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 1; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 254; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 255; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 150; +SELECT @@global.max_sp_recursion_depth; + +--echo '#--------------------FN_DYNVARS_085_04-------------------------#' +################################################################################# +# Change the value of max_sp_recursion_depth to a valid value for SESSION Scope # +################################################################################# + +SET @@session.max_sp_recursion_depth = 0; +SELECT @@session.max_sp_recursion_depth; + +SET @@session.max_sp_recursion_depth = 1; +SELECT @@session.max_sp_recursion_depth; + +SET @@session.max_sp_recursion_depth = 254; +SELECT @@session.max_sp_recursion_depth; + +SET @@session.max_sp_recursion_depth = 255; +SELECT @@session.max_sp_recursion_depth; + +SET @@session.max_sp_recursion_depth = 150; +SELECT @@session.max_sp_recursion_depth; + + +--echo '#------------------FN_DYNVARS_085_05-----------------------#' +################################################################## +# Change the value of max_sp_recursion_depth to an invalid value # +################################################################## + +SET @@global.max_sp_recursion_depth = -1024; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 256; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = -1; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = 3000; +SELECT @@global.max_sp_recursion_depth; +--Error ER_PARSE_ERROR +SET @@global.max_sp_recursion_depth = 65530.34.; +SELECT @@global.max_sp_recursion_depth; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_sp_recursion_depth = test; +SELECT @@global.max_sp_recursion_depth; + +SET @@session.max_sp_recursion_depth = 256; +SELECT @@session.max_sp_recursion_depth; +SET @@session.max_sp_recursion_depth = -1; +SELECT @@session.max_sp_recursion_depth; +SET @@session.max_sp_recursion_depth = 500000; +SELECT @@session.max_sp_recursion_depth; +SET @@session.max_sp_recursion_depth = -001; +SELECT @@session.max_sp_recursion_depth; +--Error ER_PARSE_ERROR +SET @@session.max_sp_recursion_depth = 65530.34.; +SET @@session.max_sp_recursion_depth = 10737418241; +SELECT @@session.max_sp_recursion_depth; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.max_sp_recursion_depth = test; +SELECT @@session.max_sp_recursion_depth; + + +--echo '#------------------FN_DYNVARS_085_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_sp_recursion_depth = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_sp_recursion_depth'; + +--echo '#------------------FN_DYNVARS_085_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.max_sp_recursion_depth = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='max_sp_recursion_depth'; + + +--echo '#------------------FN_DYNVARS_085_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_sp_recursion_depth = TRUE; +SELECT @@global.max_sp_recursion_depth; +SET @@global.max_sp_recursion_depth = FALSE; +SELECT @@global.max_sp_recursion_depth; + + +--echo '#---------------------FN_DYNVARS_085_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_sp_recursion_depth = 20; +SELECT @@max_sp_recursion_depth = @@global.max_sp_recursion_depth; + + +--echo '#---------------------FN_DYNVARS_085_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@max_sp_recursion_depth = 255; +SELECT @@max_sp_recursion_depth = @@local.max_sp_recursion_depth; +SELECT @@local.max_sp_recursion_depth = @@session.max_sp_recursion_depth; + + +--echo '#---------------------FN_DYNVARS_085_11----------------------#' +########################################################################## +# Check if max_sp_recursion_depth can be accessed with and without @@ sign # +########################################################################## + + +SET max_sp_recursion_depth = 102; +SELECT @@max_sp_recursion_depth; +--Error ER_UNKNOWN_TABLE +SELECT local.max_sp_recursion_depth; +--Error ER_UNKNOWN_TABLE +SELECT session.max_sp_recursion_depth; +--Error ER_BAD_FIELD_ERROR +SELECT max_sp_recursion_depth = @@session.max_sp_recursion_depth; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_sp_recursion_depth = @start_global_value; +SELECT @@global.max_sp_recursion_depth; +SET @@session.max_sp_recursion_depth = @start_session_value; +SELECT @@session.max_sp_recursion_depth; + + +#################################################### +# END OF max_sp_recursion_depth TESTS # +#################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test new file mode 100644 index 00000000000..ab43536457b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_sp_recursion_depth_func.test @@ -0,0 +1,182 @@ +############# mysql-test\t\max_sp_recursion_depth_func.test ################### +# # +# Variable Name: max_sp_recursion_depth # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 0 # +# Max Value: 25 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "max_sp_recursion_depth # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +#Reference:http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# +# option_mysqld_max_sp_recursion_depth # +# # +############################################################################### + + +# +# Setup +# + +SET @session_max_recursion_depth = @@SESSION.max_sp_recursion_depth; + + +--echo '#--------------------FN_DYNVARS_099_01-------------------------#' +########################################################## +# Test behavior of variable on new connection # 01 # +########################################################## +--echo ** Connecting test_con1 using username 'root' ** +CONNECT (test_con1,localhost,root,,); +--echo ** Connection test_con1 ** +CONNECTION test_con1; + + +# Setting session value of variable +SET @@session.max_sp_recursion_depth = 10; +SELECT @@session.max_sp_recursion_depth; +# create procedure to add rows + +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRecords; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT) +BEGIN +SELECT var1,var2; +IF var1 < var2 THEN + CALL sp_addRecords(var1+1,var2); + SELECT var1,var2; +END IF; +END // + +DELIMITER ;// + + +CALL sp_addRecords(0,8); + +--echo '#--------------------FN_DYNVARS_099_02-------------------------#' +########################################################## +# Test behavior of variable on new connection # 02 # +########################################################## + +--echo ** Connecting test_con2 using username 'root' ** +CONNECT (test_con2,localhost,root,,); +--echo ** Connection test_con2 ** +connection test_con2; + + +# Setting session value of variable and inserting data in table +SET @@session.max_sp_recursion_depth = 4; +SELECT @@session.max_sp_recursion_depth; +# create procedure to add rows + +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRecords1; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE sp_addRecords1 (IN var1 INT,IN var2 INT) +BEGIN +SELECT var1,var2; +IF var1 < var2 THEN + CALL sp_addRecords1(var1+1,var2); + SELECT var1,var2; +END IF; +END // + +DELIMITER ;// + + +CALL sp_addRecords1(0,4); + + + + +--echo '#---------------------FN_DYNVARS_99_03----------------------#' +#################################################################### +# Check if max_sp_recursion_depth value is set to 10 # +#################################################################### +SET @@max_sp_recursion_depth = 10; +# create procedure to add rows + +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRecords2; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE sp_addRecords2(IN var1 INT,IN var2 INT) +BEGIN +SELECT var1,var2; +IF var1 < var2 THEN + CALL sp_addRecords2(var1+1,var2); + SELECT var1,var2; +END IF; +END // + +DELIMITER ;// + + +CALL sp_addRecords2(0,8); + + +--echo '#---------------------FN_DYNVARS_99_04----------------------#' +############################################################################### +#Check if max_sp_recursion_depth value is set lower then called recursion value +############################################################################### + + +SET @@max_sp_recursion_depth = 4; +# create procedure to add rows +#DROP PROCEDURE IF EXISTS sp_addRecords1; + +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRecords3; +--enable_warnings + +DELIMITER //; + +CREATE PROCEDURE sp_addRecords3 (IN var1 INT,IN var2 INT) +BEGIN +SELECT var1,var2; +IF var1 < var2 THEN + CALL sp_addRecords3(var1+1,var2); + SELECT var1,var2; +END IF; +END // + +DELIMITER ;// + +--echo Expected error 'SP Recursion limit' +--ERROR ER_SP_RECURSION_LIMIT +CALL sp_addRecords3(0,8); + +# +# Cleanup +# + +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting test_con1, test_con2 ** +disconnect test_con1; +disconnect test_con2; + +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRecords; +DROP PROCEDURE IF EXISTS sp_addRecords1; +DROP PROCEDURE IF EXISTS sp_addRecords2; +DROP PROCEDURE IF EXISTS sp_addRecords3; +--enable_warnings + +SET @@SESSION.max_sp_recursion_depth = @session_max_recursion_depth; diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_basic.test b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test new file mode 100644 index 00000000000..eb231bd8076 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_user_connections_basic.test @@ -0,0 +1,172 @@ +############## mysql-test\t\max_user_connections_basic.test ############### +# # +# Variable Name: max_user_connections # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: - # +# Range: 1-4294967295 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable max_user_connections # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +#################################### +# START OF max_user_connections TESTS # +#################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.max_user_connections; +SELECT @start_global_value; +SET @start_session_value = @@session.max_user_connections; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_087_01-------------------------#' +###################################################### +# Display the DEFAULT value of max_user_connections # +###################################################### + +SET @@global.max_user_connections = 1000; +SET @@global.max_user_connections = DEFAULT; +SELECT @@global.max_user_connections; + +--Error ER_GLOBAL_VARIABLE +SET @@session.max_user_connections = 1000; +--Error ER_NO_DEFAULT +SET @@session.max_user_connections = DEFAULT; +SELECT @@session.max_user_connections; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + + +--echo '#--------------------FN_DYNVARS_087_02-------------------------#' +###################################################### +# Check the DEFAULT value of max_user_connections # +###################################################### + +SET @@global.max_user_connections = DEFAULT; +SELECT @@global.max_user_connections = 0; + +--Error ER_NO_DEFAULT +SET @@session.max_user_connections = DEFAULT; +SELECT @@session.max_user_connections = 0; + + + +--echo '#--------------------FN_DYNVARS_087_03-------------------------#' +######################################################################## +# Change the value of max_user_connections to a valid value for GLOBAL Scope # +######################################################################## + +SET @@global.max_user_connections = 1; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 2; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 65536; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 4294967295; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 4294967294; +SELECT @@global.max_user_connections; + + + +--echo '#------------------FN_DYNVARS_087_05-----------------------#' +########################################################## +# Change the value of max_user_connections to an invalid value # +########################################################## + +SET @@global.max_user_connections = -1024; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 4294967296; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = -1; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = 429496729500; +SELECT @@global.max_user_connections; +--Error ER_PARSE_ERROR +SET @@global.max_user_connections = 65530.34.; +SELECT @@global.max_user_connections; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.max_user_connections = test; +SELECT @@global.max_user_connections; + + + +--echo '#------------------FN_DYNVARS_087_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.max_user_connections = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='max_user_connections'; + + +--echo '#------------------FN_DYNVARS_087_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.max_user_connections = TRUE; +SELECT @@global.max_user_connections; +SET @@global.max_user_connections = FALSE; +SELECT @@global.max_user_connections; + + +--echo '#---------------------FN_DYNVARS_087_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.max_user_connections = 20; +SELECT @@max_user_connections = @@global.max_user_connections; + + +--echo '#---------------------FN_DYNVARS_087_11----------------------#' +######################################################################### +# Check if max_user_connections can be accessed with and without @@ sign # +######################################################################### + + +SET @@global.max_user_connections = 102; +SELECT @@max_user_connections; +--Error ER_UNKNOWN_TABLE +SELECT local.max_user_connections; +--Error ER_UNKNOWN_TABLE +SELECT session.max_user_connections; +--Error ER_BAD_FIELD_ERROR +SELECT max_user_connections = @@session.max_user_connections; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.max_user_connections = @start_global_value; +SELECT @@global.max_user_connections; + + +################################################### +# END OF max_user_connections TESTS # +################################################### + diff --git a/mysql-test/suite/sys_vars/t/max_user_connections_func.test b/mysql-test/suite/sys_vars/t/max_user_connections_func.test new file mode 100644 index 00000000000..841a630c5ce --- /dev/null +++ b/mysql-test/suite/sys_vars/t/max_user_connections_func.test @@ -0,0 +1,92 @@ +############# mysql-test\t\max_user_connections_func.test #################### +# # +# Variable Name: max_user_connections # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: - # +# Values: 1-4294967295 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "max_user_connections # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# option_mysqld_max_user_connections # +# # +# Modified: 2008-07-10 HHUNGER: Inserted wait condition # +# # +############################################################################## + +--echo ** Setup ** +--echo +# +# Setup +# + +--source include/not_embedded.inc + +SET @default_max_user_connections = @@global.max_user_connections; + +################################### +#Setting value max_user_connection# +################################### + +Set Global max_user_connections=2; + +--echo '#--------------------FN_DYNVARS_114_01-------------------------#' +######################################## +#Should not make more then 2 connection# +######################################## + +--echo ** Connecting conn1 using username 'root' ** +CONNECT (conn1,localhost,root,,); + +--echo ** Connecting conn2 using username 'root' ** +CONNECT (conn2,localhost,root,,); + +--echo ** Connecting conn3 using username 'root' ** +--disable_query_log +--Error ER_TOO_MANY_USER_CONNECTIONS +CONNECT (conn3,localhost,root,,); +--enable_query_log +--echo Expected error "too many connections" + +--echo ** Disconnecting conn1 ** +DISCONNECT conn1; + +--echo ** Poll till disconnected conn1 disappears from processlist +let $wait_condition= SELECT count(id) <= 2 + FROM information_schema.processlist WHERE user = 'root'; +--source include/wait_condition.inc + +--echo '#--------------------FN_DYNVARS_114_02-------------------------#' +##################################################### +#Set value to 3 and see if 3 connections can be made# +##################################################### + +Set Global max_user_connections=3; +--echo ** Connecting conn5 using username 'root' ** +CONNECT (conn5,localhost,root,,); +--echo ** Connecting conn6 using username 'root' ** +CONNECT (conn6,localhost,root,,); + +# +# Cleanup +# + +--echo ** Connection default ** +CONNECTION default; + +--echo ** Disconnecting conn5, conn6 ** +DISCONNECT conn2; +DISCONNECT conn5; +DISCONNECT conn6; + +SET @@global.max_user_connections = @default_max_user_connections; + diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test new file mode 100644 index 00000000000..d151c6000b8 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_basic.test @@ -0,0 +1,182 @@ + +############## mysql-test\t\myisam_data_pointer_size_basic.test ################ +# # +# Variable Name: myisam_data_pointer_size # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable myisam_data_pointer_size # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +################################################################################ + +--source include/load_sysvars.inc +################################################################### +# START OF myisam_data_pointer_size TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.myisam_data_pointer_size; +SELECT @start_global_value; + +--echo '#--------------------FN_DYNVARS_093_01-------------------------#' +################################################################### +# Display the DEFAULT value of myisam_data_pointer_size # +################################################################### + +SET @@global.myisam_data_pointer_size = 5; +SET @@global.myisam_data_pointer_size = DEFAULT; +SELECT @@global.myisam_data_pointer_size; + +--echo '#--------------------FN_DYNVARS_093_02-------------------------#' +################################################################### +# Check the DEFAULT value of myisam_data_pointer_size # +################################################################### + +SET @@global.myisam_data_pointer_size = DEFAULT; +SELECT @@global.myisam_data_pointer_size = 6; + +--echo '#--------------------FN_DYNVARS_093_03-------------------------#' +################################################################################## +# Change the value of myisam_data_pointer_size to a valid value for GLOBAL Scope # +################################################################################## + +SET @@global.myisam_data_pointer_size = 2; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 3; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 4; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 5; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 6; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 7; +SELECT @@global.myisam_data_pointer_size; + +--echo '#--------------------FN_DYNVARS_093_04-------------------------#' +################################################################################# +# Check if variable can be access with session scope # +################################################################################# + +--Error ER_GLOBAL_VARIABLE +SET @@myisam_data_pointer_size = 2; + +--Error ER_GLOBAL_VARIABLE +SET @@session.myisam_data_pointer_size = 3; + +--Error ER_GLOBAL_VARIABLE +SET @@local.myisam_data_pointer_size = 4; + + + +--echo '#------------------FN_DYNVARS_093_05-----------------------#' +#################################################################### +# Change the value of myisam_data_pointer_size to an invalid value # +#################################################################### + +SET @@global.myisam_data_pointer_size = -1; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 8; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 1; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 4294967296; +SELECT @@global.myisam_data_pointer_size; +--Error ER_PARSE_ERROR +SET @@global.myisam_data_pointer_size = 65530.34.; +SELECT @@global.myisam_data_pointer_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.myisam_data_pointer_size = two; +SELECT @@global.myisam_data_pointer_size; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + + +--echo '#------------------FN_DYNVARS_093_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SET @@global.myisam_data_pointer_size = 3; +SELECT @@global.myisam_data_pointer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='myisam_data_pointer_size'; + + +--echo '#------------------FN_DYNVARS_093_07-----------------------#' +########################################################################### +# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES # +########################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='myisam_data_pointer_size'; + + +--echo '#------------------FN_DYNVARS_093_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.myisam_data_pointer_size = TRUE; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = FALSE; +SELECT @@global.myisam_data_pointer_size; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + + +SET @@global.myisam_data_pointer_size = 5; +SELECT @@myisam_data_pointer_size = @@global.myisam_data_pointer_size; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################################## +# Check if myisam_data_pointer_size can be accessed without @@ sign and scope # +################################################################################## + +--Error ER_GLOBAL_VARIABLE +SET myisam_data_pointer_size = 7; +--Error ER_BAD_FIELD_ERROR +SELECT myisam_data_pointer_size; + +SELECT @@myisam_data_pointer_size; + +#verifying another syntax for setting value# + +SET global myisam_data_pointer_size = 2; + +#################################### +# Restore initial value # +#################################### + +SET @@global.myisam_data_pointer_size = @start_global_value; +SELECT @@global.myisam_data_pointer_size; + +######################################################## +# END OF myisam_data_pointer_size TESTS # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test new file mode 100644 index 00000000000..37dd3a5a297 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test @@ -0,0 +1,109 @@ +############## mysql-test\t\myisam_data_pointer_size_func.test ################ +# # +# Variable Name: myisam_data_pointer_size # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable myisam_data_pointer_size # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ + +--echo '#--------------------FN_DYNVARS_093_01-------------------------#' +############################################################################### +# Check if setting myisam_data_pointer_size is changed in every new connection# +############################################################################### + +SET @start_value= @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 2; +# con1 will be default connection from now on +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.myisam_data_pointer_size; +SET @@global.myisam_data_pointer_size = 3; +--echo 'connect (con2,localhost,root,,,,)' +connect (con2,localhost,root,,,,); +--echo 'connection con2' +connection con2; +SELECT @@global.myisam_data_pointer_size; +disconnect con2; + + +--echo '#--------------------FN_DYNVARS_093_02-------------------------#' +################################################################# +# Begin the functionality Testing of myisam_data_pointer_size # +################################################################# + +--echo 'connection con1' +connection con1; + +#=========================================================== +# Checking myisam_data_pointer_size is 2 +#=========================================================== + +# create sp to add 'count' records +--disable_warnings +DROP PROCEDURE IF EXISTS sp_addRec; +DROP TABLE IF EXISTS t1; +--enable_warnings + +DELIMITER //; +CREATE PROCEDURE sp_addRec(IN count INT) +BEGIN + WHILE (count>0) DO + INSERT INTO t1 value(1); + SET count = count -1; + END WHILE; +END // +DELIMITER ;// + +# setting 2 will allow data pointer to access files with size < 65536 +SET @@global.myisam_data_pointer_size = 2; + +CREATE TABLE t1(a INT); + +CALL sp_addRec(65535); + +--Error ER_RECORD_FILE_FULL +CALL sp_addRec(1); + +SELECT count(*) from t1; + +#======================================================================= +--echo '--Checking myisam_data_pointer_size with MAX_ROWS table option--' +#======================================================================= + +# specifying MAX_ROWS table option renders pointer size useless +SET @@global.myisam_data_pointer_size = 2; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a INT)MAX_ROWS=70000; + +CALL sp_addRec(65536); + +SELECT count(*) from t1; + +DROP PROCEDURE sp_addRec; +DROP TABLE t1; + +connection default; +SET @@global.myisam_data_pointer_size= @start_value; +################################################################ +# End of functionality Testing for myisam_data_pointer_size # +################################################################ + diff --git a/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test new file mode 100644 index 00000000000..0045842269b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_basic.test @@ -0,0 +1,226 @@ +############## mysql-test\t\myisam_stats_method_basic.test #################### +# # +# Variable Name: myisam_stats_method # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: nulls_equal # +# Valid Values: nulls_equal, nulls_unequal # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable myisam_stats_method # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF myisam_stats_method TESTS # +######################################################################## + + +########################################################################### +# Saving initial value of myisam_stats_method in a temporary variable # +########################################################################### + +SET @global_start_value = @@global.myisam_stats_method; +SELECT @global_start_value; + +SET @session_start_value = @@session.myisam_stats_method; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_097_01------------------------#' +######################################################################## +# Display the DEFAULT value of myisam_stats_method # +######################################################################## + +SET @@global.myisam_stats_method = nulls_equal; +SET @@global.myisam_stats_method = DEFAULT; +SELECT @@global.myisam_stats_method; + +SET @@session.myisam_stats_method = nulls_equal; +SET @@session.myisam_stats_method = DEFAULT; +SELECT @@session.myisam_stats_method; + + +--echo '#---------------------FN_DYNVARS_097_02-------------------------#' +######################################################### +# Check if NULL or empty value is accepeted # +######################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = ''; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.myisam_stats_method = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.myisam_stats_method = ''; + +--echo '#--------------------FN_DYNVARS_097_03------------------------#' +######################################################################## +# Change the value of myisam_stats_method to a valid value # +######################################################################## + +SET @@global.myisam_stats_method = 'nulls_equal'; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 'nulls_unequal'; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 'nulls_ignored'; +SELECT @@global.myisam_stats_method; + +--echo 'Bug: Value of nulls_ignored is not documented. Its ordinal value is 2' + +SET @@session.myisam_stats_method = 'nulls_equal'; +SELECT @@session.myisam_stats_method; + +SET @@session.myisam_stats_method = 'nulls_unequal'; +SELECT @@session.myisam_stats_method; + +SET @@session.myisam_stats_method = 'nulls_ignored'; +SELECT @@session.myisam_stats_method; + + +--echo '#--------------------FN_DYNVARS_097_04-------------------------#' +########################################################################### +# Change the value of myisam_stats_method to invalid value # +########################################################################### + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = unequal; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = ENABLED; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = 'equal'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = 'null_equal'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = ' '; + + +--echo '#-------------------FN_DYNVARS_097_05----------------------------#' +######################################################################### +# Check if the value in session Table matches value in variable # +######################################################################### + +SELECT @@session.myisam_stats_method = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='myisam_stats_method'; + +--echo '#----------------------FN_DYNVARS_097_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.myisam_stats_method = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='myisam_stats_method'; + + +--echo '#---------------------FN_DYNVARS_097_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +# test if variable accepts 0,1,2 +SET @@global.myisam_stats_method = 0; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 1; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 2; +SELECT @@global.myisam_stats_method; + +# use of decimal values + +SET @@global.myisam_stats_method = 0.4; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 1.0; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 1.1; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 1.5; +SELECT @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = 2.49; +SELECT @@global.myisam_stats_method; + +SET @@session.myisam_stats_method = 0.5; +SELECT @@session.myisam_stats_method; + +SET @@session.myisam_stats_method = 1.6; +SELECT @@session.myisam_stats_method; + + +--echo 'Bug# 34877: Decimal values can be used within the range [0.0-2.5). Values'; +--echo 'are rounded to 0,1,2 as evident from outcome.'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.myisam_stats_method = 3; + + +--echo '#---------------------FN_DYNVARS_097_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.myisam_stats_method = TRUE; +SELECT @@global.myisam_stats_method; +SET @@global.myisam_stats_method = FALSE; +SELECT @@global.myisam_stats_method; + +--echo '#---------------------FN_DYNVARS_097_09----------------------#' +######################################################################### +# Check if myisam_stats_method can be accessed with and without @@ sign # +######################################################################### + +SET myisam_stats_method = 'nulls_equal'; + +--Error ER_PARSE_ERROR +SET session.myisam_stats_method = 'nulls_equal'; +--Error ER_PARSE_ERROR +SET global.myisam_stats_method = 'nulls_equal'; + +SET session myisam_stats_method = 'nulls_equal'; +SELECT @@myisam_stats_method; + +SET global myisam_stats_method = 'nulls_equal'; +SELECT @@global.myisam_stats_method; + +############################## +# Restore initial value # +############################## + +SET @@global.myisam_stats_method = @global_start_value; +SELECT @@global.myisam_stats_method; + +SET @@session.myisam_stats_method = @session_start_value; +SELECT @@session.myisam_stats_method; + +######################################################################## +# END OF myisam_stats_method TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test new file mode 100644 index 00000000000..a317f8d93da --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test @@ -0,0 +1,111 @@ +############## mysql-test\t\myisam_stats_method_func.test #################### +# # +# Variable Name: myisam_stats_method # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: nulls_equal # +# Valid Values: nulls_equal, nulls_unequal # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable myisam_stats_method # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--echo '#--------------------FN_DYNVARS_097_01-------------------------#' +##################################################################### +# Check if Setting myisam_stats_method is changed in new connection # +##################################################################### + +SET @start_value = @@global.myisam_stats_method; + +SET @@global.myisam_stats_method = nulls_equal; +--echo 'connect (con1,localhost,root,,,,)' +connect (con1,localhost,root,,,,); +--echo 'connection con1' +connection con1; +SELECT @@global.myisam_stats_method; +SELECT @@session.myisam_stats_method; +disconnect con1; + +--echo '#--------------------FN_DYNVARS_097_02-------------------------#' +########################################################### +# Begin the functionality Testing of myisam_stats_method # +########################################################### + +--echo 'connection default' +connection default; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT, KEY (a)); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4); +INSERT INTO t1 SELECT NULL FROM t1; + +#======================================= +--echo 'default: NULLs considered unequal' +#======================================= +SET myisam_stats_method = nulls_unequal; + +ANALYZE TABLE t1; +SHOW INDEX FROM t1; +INSERT INTO t1 VALUES (11); +DELETE FROM t1 WHERE a = 11; +CHECK TABLE t1; +SHOW INDEX FROM t1; + + +#===================================== +--echo 'Set nulls to be equal' +#===================================== +SET myisam_stats_method = nulls_equal; + +INSERT INTO t1 VALUES (11); +DELETE FROM t1 WHERE a = 11; +ANALYZE TABLE t1; +SHOW INDEX FROM t1; +INSERT INTO t1 VALUES (11); +DELETE FROM t1 WHERE a = 11; +CHECK TABLE t1; +SHOW INDEX FROM t1; + +#===================================== +--echo 'Set nulls to be ignored' +#===================================== + +SET myisam_stats_method = nulls_ignored; +SHOW VARIABLES LIKE 'myisam_stats_method'; +DROP TABLE t1; + +CREATE TABLE t1 ( + a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6), + KEY(a,b,c,d) +); +INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz'); +INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz'); +INSERT INTO t1 VALUES ('bce','def1', 'yuu', NULL); +INSERT INTO t1 VALUES ('bce','def2', NULL, 'quux'); +ANALYZE TABLE t1; +SHOW INDEX FROM t1; +DELETE FROM t1; +ANALYZE TABLE t1; +SHOW INDEX FROM t1; + +SET myisam_stats_method = DEFAULT; +DROP TABLE t1; + +SET @@global.myisam_stats_method= @start_value; + +######################################################## +# End of functionality Testing for myisam_stats_method # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test new file mode 100644 index 00000000000..d2cc39cfea7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test @@ -0,0 +1,104 @@ + + +################## mysql-test\t\myisam_use_mmap_basic.test #################### +# # +# Variable Name: myisam_use_mmap # +# Scope: Global # +# Access Type: Static # +# Data Type: # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable myisam_use_mmap # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_042_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.myisam_use_mmap); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_042_02----------------------#' +# +# Test case for Bug #35433 +# +#################################################################### +# Check if Value can set # +#################################################################### + +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SET @@GLOBAL.myisam_use_mmap=1; +--ECHO "BUG:It should give error on setting this variable as it is readonly variable" +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.myisam_use_mmap); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_042_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.myisam_use_mmap = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='myisam_use_mmap'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.myisam_use_mmap); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='myisam_use_mmap'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_042_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@myisam_use_mmap = @@GLOBAL.myisam_use_mmap; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_042_05----------------------#' +################################################################################ +# Check if myisam_use_mmap can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@myisam_use_mmap); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.myisam_use_mmap); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.myisam_use_mmap); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.myisam_use_mmap); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT myisam_use_mmap = @@SESSION.myisam_use_mmap; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test new file mode 100644 index 00000000000..0b9d3ada158 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test @@ -0,0 +1,216 @@ +############## mysql-test\t\ndb_log_update_as_write_basic.test ############### +# # +# Variable Name: ndb_log_update_as_write # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +############## mysql-test\t\ndb_log_update_as_write_basic.test ################ +# # +# Variable Name: ndb_log_update_as_write # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +################################################################################ +################# mysql-test\t\ndb_log_update_as_write_basic.test ###### +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable # +# ndb_log_update_as_write that check behavior of this # +# variable with valid values, invalid values, # +# accessing variable with scope that is # +# allowed and with scope that is now allowed. # +# Scope: Global # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # +# -variables.html # +# # +######################################################################## + +--source include/load_sysvars.inc + +######################################################################## +# START OF ndb_log_update_as_write TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of ndb_log_update_as_write in a temporary variable # +################################################################################ + + +--Error ER_UNKNOWN_SYSTEM_VARIABLE +SET @global_start_value = @@global.ndb_log_update_as_write; +--Error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@global.ndb_log_update_as_write; + +--echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22' + + +--echo '#--------------------FN_DYNVARS_102_01------------------------#' +######################################################################## +# Display the DEFAULT value of ndb_log_update_as_write # +######################################################################## + +#SET @@ndb_log_update_as_write = 0; +#SET @@ndb_log_update_as_write = DEFAULT; +#SELECT @@ndb_log_update_as_write; +# +#SET @@ndb_log_update_as_write = 1; +#SET @@ndb_log_update_as_write = DEFAULT; +#SELECT @@ndb_log_update_as_write; + + +--echo '#---------------------FN_DYNVARS_102_02-------------------------#' +############################################################################# +# Check if ndb_log_update_as_write can be accessed with and without @@ sign # +############################################################################# + +#SET ndb_log_update_as_write = 1; +#SELECT @@ndb_log_update_as_write; +#--Error ER_UNKNOWN_TABLE +#SELECT global.ndb_log_update_as_write; +# +#SET global ndb_log_update_as_write = 1; +#SELECT @@global.ndb_log_update_as_write; + + +--echo '#--------------------FN_DYNVARS_102_03------------------------#' +######################################################################## +# Change the value of ndb_log_update_as_write to a valid value # +######################################################################## + +#SET @@global.ndb_log_update_as_write = 0; +#SELECT @@global.ndb_log_update_as_write; +#SET @@global.ndb_log_update_as_write = 1; +#SELECT @@global.ndb_log_update_as_write; +## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +#SET @@global.ndb_log_update_as_write = 2; +#SELECT @@global.ndb_log_update_as_write; + +--echo '#--------------------FN_DYNVARS_102_04-------------------------#' +########################################################################### +# Change the value of ndb_log_update_as_write to invalid value # +########################################################################### + +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = -1; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = TRU; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = TRUE_F; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = FALS; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = OON; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = ONN; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = OOFF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = 0FF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = ' 1'; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_update_as_write = "0 "; + + + +--echo '#-------------------FN_DYNVARS_102_05----------------------------#' +########################################################################### +# Test if accessing session ndb_log_update_as_write gives error # +########################################################################### + +#--Error ER_LOCAL_VARIABLE +#SET @@session.ndb_log_update_as_write = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SET @@ndb_log_update_as_write = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SET @@local.ndb_log_update_as_write = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@session.ndb_log_update_as_write; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@local.ndb_log_update_as_write; + +--echo '#----------------------FN_DYNVARS_102_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write'; + + +--echo '#----------------------FN_DYNVARS_102_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +#SELECT @@global.ndb_log_update_as_write = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write'; + + +--echo '#---------------------FN_DYNVARS_102_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +#SET @@ndb_log_update_as_write = OFF; +#SELECT @@ndb_log_update_as_write; +#SET @@ndb_log_update_as_write = ON; +#SELECT @@ndb_log_update_as_write; + +--echo '#---------------------FN_DYNVARS_102_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +#SET @@ndb_log_update_as_write = TRUE; +#SELECT @@ndb_log_update_as_write; +#SET @@ndb_log_update_as_write = 'FALSE'; +#SELECT @@ndb_log_update_as_write; + +############################## +# Restore initial value # +############################## + +#SET @@ndb_log_update_as_write = @global_start_value; +#SELECT @@ndb_log_update_as_write; + +######################################################################## +# END OF ndb_log_update_as_write TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test new file mode 100644 index 00000000000..85b76cc88a4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test @@ -0,0 +1,216 @@ +############## mysql-test\t\ndb_log_updated_only_basic.test ############### +# # +# Variable Name: ndb_log_updated_only # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable ndb_log_updated_only # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### +############## mysql-test\t\ndb_log_updated_only_basic.test ################ +# # +# Variable Name: ndb_log_updated_only # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable ndb_log_updated_only # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +################################################################################ +################# mysql-test\t\ndb_log_updated_only_basic.test ######### +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable # +# ndb_log_updated_only that check behavior of this # +# variable with valid values, invalid values, # +# accessing variable with scope that is # +# allowed and with scope that is now allowed. # +# Scope: Global # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # +# -variables.html # +# # +######################################################################## + +--source include/load_sysvars.inc + +######################################################################## +# START OF ndb_log_updated_only TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of ndb_log_updated_only in a temporary variable # +################################################################################ + + +--Error ER_UNKNOWN_SYSTEM_VARIABLE +SET @global_start_value = @@global.ndb_log_updated_only; +--Error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@global.ndb_log_updated_only; + +--echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22' + + +--echo '#--------------------FN_DYNVARS_103_01------------------------#' +######################################################################## +# Display the DEFAULT value of ndb_log_updated_only # +######################################################################## + +#SET @@ndb_log_updated_only = 0; +#SET @@ndb_log_updated_only = DEFAULT; +#SELECT @@ndb_log_updated_only; +# +#SET @@ndb_log_updated_only = 1; +#SET @@ndb_log_updated_only = DEFAULT; +#SELECT @@ndb_log_updated_only; + + +--echo '#---------------------FN_DYNVARS_103_02-------------------------#' +############################################################################# +# Check if ndb_log_updated_only can be accessed with and without @@ sign # +############################################################################# + +#SET ndb_log_updated_only = 1; +#SELECT @@ndb_log_updated_only; +#--Error ER_UNKNOWN_TABLE +#SELECT global.ndb_log_updated_only; +# +#SET global ndb_log_updated_only = 1; +#SELECT @@global.ndb_log_updated_only; + + +--echo '#--------------------FN_DYNVARS_103_03------------------------#' +######################################################################## +# Change the value of ndb_log_updated_only to a valid value # +######################################################################## + +#SET @@global.ndb_log_updated_only = 0; +#SELECT @@global.ndb_log_updated_only; +#SET @@global.ndb_log_updated_only = 1; +#SELECT @@global.ndb_log_updated_only; +## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware +#SET @@global.ndb_log_updated_only = 2; +#SELECT @@global.ndb_log_updated_only; + +--echo '#--------------------FN_DYNVARS_103_04-------------------------#' +########################################################################### +# Change the value of ndb_log_updated_only to invalid value # +########################################################################### + +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = -1; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = TRU; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = TRUE_F; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = FALS; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = OON; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = ONN; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = OOFF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = 0FF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = ' 1'; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.ndb_log_updated_only = "0 "; + + + +--echo '#-------------------FN_DYNVARS_103_05----------------------------#' +########################################################################### +# Test if accessing session ndb_log_updated_only gives error # +########################################################################### + +#--Error ER_LOCAL_VARIABLE +#SET @@session.ndb_log_updated_only = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SET @@ndb_log_updated_only = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SET @@local.ndb_log_updated_only = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@session.ndb_log_updated_only; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@local.ndb_log_updated_only; + +--echo '#----------------------FN_DYNVARS_103_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only'; + + +--echo '#----------------------FN_DYNVARS_103_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +#SELECT @@global.ndb_log_updated_only = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only'; + + +--echo '#---------------------FN_DYNVARS_103_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +#SET @@ndb_log_updated_only = OFF; +#SELECT @@ndb_log_updated_only; +#SET @@ndb_log_updated_only = ON; +#SELECT @@ndb_log_updated_only; + +--echo '#---------------------FN_DYNVARS_103_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +#SET @@ndb_log_updated_only = TRUE; +#SELECT @@ndb_log_updated_only; +#SET @@ndb_log_updated_only = 'FALSE'; +#SELECT @@ndb_log_updated_only; + +############################## +# Restore initial value # +############################## + +#SET @@ndb_log_updated_only = @global_start_value; +#SELECT @@ndb_log_updated_only; + +######################################################################## +# END OF ndb_log_updated_only TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test new file mode 100644 index 00000000000..6e1e0559c61 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/net_buffer_length_basic.test @@ -0,0 +1,207 @@ +################# mysql-test\t\net_buffer_length_basic.test ################### +# # +# Variable Name: net_buffer_length # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 16384 # +# Range: 1024-1048576 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable net_buffer_length # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################# +# START OF net_buffer_length TESTS # +################################################################# + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.net_buffer_length; +# Due to differences in results of linux and windows +#SELECT @start_global_value; + +# give a known value to @@session.net_buffer_length by assigning to +# @@global and setting up a new connection (for deterministic result +# file diffing) +SET @@global.net_buffer_length = DEFAULT; +connect(con1,localhost,root,,); +connection con1; + +--echo '#--------------------FN_DYNVARS_109_01-------------------------#' +################################################################# +# Display the DEFAULT value of net_buffer_length # +################################################################# + +SET @@global.net_buffer_length = 10000; +SET @@global.net_buffer_length = DEFAULT; +SELECT @@global.net_buffer_length; + +--Error ER_VARIABLE_IS_READONLY +SET @@session.net_buffer_length = 20000; +--Error ER_NO_DEFAULT +SET @@session.net_buffer_length = DEFAULT; +SELECT @@session.net_buffer_length; + + +--echo '#--------------------FN_DYNVARS_109_02-------------------------#' +######################################################################## +# Check the DEFAULT value of net_buffer_length # +######################################################################## + +SET @@global.net_buffer_length = DEFAULT; +SELECT @@global.net_buffer_length = 16384; + + +--echo '#--------------------FN_DYNVARS_109_03-------------------------#' +########################################################################### +# Change the value of net_buffer_length to a valid value for GLOBAL Scope # +########################################################################### + +SET @@global.net_buffer_length = 1024; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 1025; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 1048576; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 1048575; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 65535; +SELECT @@global.net_buffer_length; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + + +--echo '#--------------------FN_DYNVARS_109_04-------------------------#' +############################################################################ +# Change the value of net_buffer_length to a valid value for SESSION Scope # +############################################################################ + +# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped + + +--echo '#------------------FN_DYNVARS_109_05-----------------------#' +############################################################# +# Change the value of net_buffer_length to an invalid value # +############################################################# + +SET @@global.net_buffer_length = 0; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = -1024; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 1023; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 1048577; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = 104857633; +SELECT @@global.net_buffer_length; +--Error ER_PARSE_ERROR +SET @@global.net_buffer_length = 65530.34.; +SELECT @@global.net_buffer_length; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.net_buffer_length = test; +SELECT @@global.net_buffer_length; + +# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.net_buffer_length = test; +SELECT @@session.net_buffer_length; + + +--echo '#------------------FN_DYNVARS_109_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.net_buffer_length = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='net_buffer_length'; + +--echo '#------------------FN_DYNVARS_109_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.net_buffer_length = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='net_buffer_length'; + + +--echo '#------------------FN_DYNVARS_109_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.net_buffer_length = TRUE; +SELECT @@global.net_buffer_length; +SET @@global.net_buffer_length = FALSE; +SELECT @@global.net_buffer_length; + + +--echo '#---------------------FN_DYNVARS_109_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.net_buffer_length = 2048; +SELECT @@net_buffer_length = @@global.net_buffer_length; + + +--echo '#---------------------FN_DYNVARS_109_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped + + +--echo '#---------------------FN_DYNVARS_109_11----------------------#' +############################################################################ +# Check if net_buffer_length can be accessed with and without @@ sign # +############################################################################ + +# Bug#22891: SESSION net_buffer_length is now read-only; assignments skipped +SELECT @@net_buffer_length; +--Error ER_UNKNOWN_TABLE +SELECT local.net_buffer_length; +--Error ER_UNKNOWN_TABLE +SELECT session.net_buffer_length; +--Error ER_BAD_FIELD_ERROR +SELECT net_buffer_length = @@session.net_buffer_length; + + +#################################### +# Restore initial value # +#################################### + +connection default; + +SET @@global.net_buffer_length = @start_global_value; +# Due to differences in results of linux and windows +#SELECT @@global.net_buffer_length; + + +###################################################### +# END OF net_buffer_length TESTS # +###################################################### diff --git a/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test new file mode 100644 index 00000000000..f0d32302e4f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/net_read_timeout_basic.test @@ -0,0 +1,207 @@ +############## mysql-test\t\net_read_timeout_basic.test ############### +# # +# Variable Name: net_read_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 30 # +# Min Vlue: 1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable net_read_timeout # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +##################################################################### +# START OF net_read_timeout TESTS # +##################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.net_read_timeout; +SELECT @start_global_value; +SET @start_session_value = @@session.net_read_timeout; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_110_01-------------------------#' +##################################################################### +# Display the DEFAULT value of net_read_timeout # +##################################################################### + +SET @@global.net_read_timeout = 100; +SET @@global.net_read_timeout = DEFAULT; +SELECT @@global.net_read_timeout; + +SET @@session.net_read_timeout = 200; +SET @@session.net_read_timeout = DEFAULT; +SELECT @@session.net_read_timeout; + + +--echo '#--------------------FN_DYNVARS_110_02-------------------------#' +######################################################################## +# Check the DEFAULT value of net_read_timeout # +######################################################################## + +SET @@global.net_read_timeout = DEFAULT; +SELECT @@global.net_read_timeout = 30; + +SET @@session.net_read_timeout = DEFAULT; +SELECT @@session.net_read_timeout = 30; + + +--echo '#--------------------FN_DYNVARS_110_03-------------------------#' +################################################################################## +# Change the value of net_read_timeout to a valid value for GLOBAL Scope # +################################################################################## + +SET @@global.net_read_timeout = 1; +SELECT @@global.net_read_timeout; +SET @@global.net_read_timeout = 60020; +SELECT @@global.net_read_timeout; +SET @@global.net_read_timeout = 65535; +SELECT @@global.net_read_timeout; + + +--echo '#--------------------FN_DYNVARS_110_04-------------------------#' +################################################################################### +# Change the value of net_read_timeout to a valid value for SESSION Scope # +################################################################################### + +SET @@session.net_read_timeout = 1; +SELECT @@session.net_read_timeout; +SET @@session.net_read_timeout = 50050; +SELECT @@session.net_read_timeout; +SET @@session.net_read_timeout = 65535; +SELECT @@session.net_read_timeout; + + +--echo '#------------------FN_DYNVARS_110_05-----------------------#' +#################################################################### +# Change the value of net_read_timeout to an invalid value # +#################################################################### + +SET @@global.net_read_timeout = 0; +SELECT @@global.net_read_timeout; +SET @@global.net_read_timeout = -1024; +SELECT @@global.net_read_timeout; +SET @@global.net_read_timeout = 655360354; +SELECT @@global.net_read_timeout; +--Error ER_PARSE_ERROR +SET @@global.net_read_timeout = 65530.34.; +SELECT @@global.net_read_timeout; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.net_read_timeout = test; +SELECT @@global.net_read_timeout; + +SET @@session.net_read_timeout = 0; +SELECT @@session.net_read_timeout; +SET @@session.net_read_timeout = -2; +SELECT @@session.net_read_timeout; +--Error ER_PARSE_ERROR +SET @@session.net_read_timeout = 65530.34.; +SET @@session.net_read_timeout = 6555015425; +SELECT @@session.net_read_timeout; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.net_read_timeout = test; +SELECT @@session.net_read_timeout; + + +--echo '#------------------FN_DYNVARS_110_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.net_read_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='net_read_timeout'; + +--echo '#------------------FN_DYNVARS_110_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.net_read_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='net_read_timeout'; + + +--echo '#------------------FN_DYNVARS_110_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.net_read_timeout = TRUE; +SELECT @@global.net_read_timeout; +SET @@global.net_read_timeout = FALSE; +SELECT @@global.net_read_timeout; + + +--echo '#---------------------FN_DYNVARS_110_09----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.net_read_timeout = 10; +SELECT @@net_read_timeout = @@global.net_read_timeout; + + +--echo '#---------------------FN_DYNVARS_110_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@net_read_timeout = 100; +SELECT @@net_read_timeout = @@local.net_read_timeout; +SELECT @@local.net_read_timeout = @@session.net_read_timeout; + + +--echo '#---------------------FN_DYNVARS_110_11----------------------#' +################################################################################### +# Check if net_read_timeout can be accessed with and without @@ sign # +################################################################################### + +SET net_read_timeout = 1; +SELECT @@net_read_timeout; +--Error ER_UNKNOWN_TABLE +SELECT local.net_read_timeout; +--Error ER_UNKNOWN_TABLE +SELECT session.net_read_timeout; +--Error ER_BAD_FIELD_ERROR +SELECT net_read_timeout = @@session.net_read_timeout; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.net_read_timeout = @start_global_value; +SELECT @@global.net_read_timeout; +SET @@session.net_read_timeout = @start_session_value; +SELECT @@session.net_read_timeout; + + +############################################################# +# END OF net_read_timeout TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test new file mode 100644 index 00000000000..84c682561e3 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/net_write_timeout_basic.test @@ -0,0 +1,203 @@ +############## mysql-test\t\net_write_timeout_basic.test ############### +# # +# Variable Name: net_write_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 60 # +# Min Value: 1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable net_write_timeout # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################# +# START OF net_write_timeout TESTS # +################################################################# + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.net_write_timeout; +SELECT @start_global_value; +SET @start_session_value = @@session.net_write_timeout; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_112_01-------------------------#' +################################################################# +# Display the DEFAULT value of net_write_timeout # +################################################################# + +SET @@global.net_write_timeout = 100; +SET @@global.net_write_timeout = DEFAULT; +SELECT @@global.net_write_timeout; + +SET @@session.net_write_timeout = 200; +SET @@session.net_write_timeout = DEFAULT; +SELECT @@session.net_write_timeout; + + +--echo '#--------------------FN_DYNVARS_112_02-------------------------#' +################################################################# +# Check the DEFAULT value of net_write_timeout # +################################################################# + +SET @@global.net_write_timeout = DEFAULT; +SELECT @@global.net_write_timeout = 60; + +SET @@session.net_write_timeout = DEFAULT; +SELECT @@session.net_write_timeout = 60; + + +--echo '#--------------------FN_DYNVARS_112_03-------------------------#' +########################################################################### +# Change the value of net_write_timeout to a valid value for GLOBAL Scope # +########################################################################### + +SET @@global.net_write_timeout = 1; +SELECT @@global.net_write_timeout; +SET @@global.net_write_timeout = 60020; +SELECT @@global.net_write_timeout; +SET @@global.net_write_timeout = 65535; +SELECT @@global.net_write_timeout; + + +--echo '#--------------------FN_DYNVARS_112_04-------------------------#' +############################################################################ +# Change the value of net_write_timeout to a valid value for SESSION Scope # +############################################################################ + +SET @@session.net_write_timeout = 1; +SELECT @@session.net_write_timeout; +SET @@session.net_write_timeout = 50050; +SELECT @@session.net_write_timeout; +SET @@session.net_write_timeout = 65535; +SELECT @@session.net_write_timeout; + + +--echo '#------------------FN_DYNVARS_112_05-----------------------#' +############################################################# +# Change the value of net_write_timeout to an invalid value # +############################################################# + +SET @@global.net_write_timeout = 0; +SELECT @@global.net_write_timeout; +SET @@global.net_write_timeout = -1024; +SELECT @@global.net_write_timeout; +SET @@global.net_write_timeout = 655360354; +SELECT @@global.net_write_timeout; +--Error ER_PARSE_ERROR +SET @@global.net_write_timeout = 65530.34.; +SELECT @@global.net_write_timeout; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.net_write_timeout = test; +SELECT @@global.net_write_timeout; + +SET @@session.net_write_timeout = 0; +SELECT @@session.net_write_timeout; +SET @@session.net_write_timeout = -2; +SELECT @@session.net_write_timeout; +--Error ER_PARSE_ERROR +SET @@session.net_write_timeout = 65530.34.; +SET @@session.net_write_timeout = 6555015425; +SELECT @@session.net_write_timeout; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.net_write_timeout = test; +SELECT @@session.net_write_timeout; + + +--echo '#------------------FN_DYNVARS_112_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.net_write_timeout = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='net_write_timeout'; + +--echo '#------------------FN_DYNVARS_112_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.net_write_timeout = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='net_write_timeout'; + + +--echo '#------------------FN_DYNVARS_112_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.net_write_timeout = TRUE; +SELECT @@global.net_write_timeout; +SET @@global.net_write_timeout = FALSE; +SELECT @@global.net_write_timeout; + + +--echo '#---------------------FN_DYNVARS_112_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.net_write_timeout = 10; +SELECT @@net_write_timeout = @@global.net_write_timeout; + + +--echo '#---------------------FN_DYNVARS_112_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@net_write_timeout = 100; +SELECT @@net_write_timeout = @@local.net_write_timeout; +SELECT @@local.net_write_timeout = @@session.net_write_timeout; + + +--echo '#---------------------FN_DYNVARS_112_11----------------------#' +############################################################################ +# Check if net_write_timeout can be accessed with and without @@ sign # +############################################################################ + +SET net_write_timeout = 1; +SELECT @@net_write_timeout; +--Error ER_UNKNOWN_TABLE +SELECT local.net_write_timeout; +--Error ER_UNKNOWN_TABLE +SELECT session.net_write_timeout; +--Error ER_BAD_FIELD_ERROR +SELECT net_write_timeout = @@session.net_write_timeout; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.net_write_timeout = @start_global_value; +SELECT @@global.net_write_timeout; +SET @@session.net_write_timeout = @start_session_value; +SELECT @@session.net_write_timeout; + + +###################################################### +# END OF net_write_timeout TESTS # +###################################################### + diff --git a/mysql-test/suite/sys_vars/t/new_basic.test b/mysql-test/suite/sys_vars/t/new_basic.test new file mode 100644 index 00000000000..b1d12c9a4de --- /dev/null +++ b/mysql-test/suite/sys_vars/t/new_basic.test @@ -0,0 +1,220 @@ +############## mysql-test\t\new_basic.test #################################### +# # +# Variable Name: new # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable "new" # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_new # +# # +############################################################################### + +--source include/load_sysvars.inc +################################################### +# START OF new TESTS # +################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.new; +SELECT @start_global_value; +SET @start_session_value = @@session.new; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_113_01-------------------------#' +################################################### +# Display the DEFAULT value of new # +################################################### + +SET @@global.new = ON; +SET @@global.new = DEFAULT; +SELECT @@global.new; + +SET @@session.new = ON; +SET @@session.new = DEFAULT; +SELECT @@session.new; + + +--echo '#--------------------FN_DYNVARS_113_02-------------------------#' +################################################### +# Check the DEFAULT value of new # +################################################### + +SET @@global.new = DEFAULT; +SELECT @@global.new = 'OFF'; + +SET @@session.new = DEFAULT; +SELECT @@session.new = 'OFF'; + + +--echo '#--------------------FN_DYNVARS_113_03-------------------------#' +############################################################# +# Change the value of new to a valid value for GLOBAL Scope # +############################################################# + +SET @@global.new = ON; +SELECT @@global.new; +SET @@global.new = OFF; +SELECT @@global.new; +SET @@global.new = 0; +SELECT @@global.new; +SET @@global.new = 1; +SELECT @@global.new; +SET @@global.new = TRUE; +SELECT @@global.new; +SET @@global.new = FALSE; +SELECT @@global.new; + + + +--echo '#--------------------FN_DYNVARS_113_04-------------------------#' +############################################################## +# Change the value of new to a valid value for SESSION Scope # +############################################################## + +SET @@session.new = ON; +SELECT @@session.new; +SET @@session.new = OFF; +SELECT @@session.new; +SET @@session.new = 0; +SELECT @@session.new; +SET @@session.new = 1; +SELECT @@session.new; +SET @@session.new = TRUE; +SELECT @@session.new; +SET @@session.new = FALSE; +SELECT @@session.new; + + +--echo '#------------------FN_DYNVARS_113_05-----------------------#' +############################################### +# Change the value of new to an invalid value # +############################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = "OFFF"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.new = test; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = ONF; + +SET @@session.new = OF; +SELECT @@session.new; +--echo 'Bug# 34828: FN_DYNVARS_113_05 - OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = 'OFN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = -2; +--Error ER_PARSE_ERROR +SET @@session.new = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = 65550; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.new = test; + + +--echo '#------------------FN_DYNVARS_113_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.new = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='new'; + +--echo '#------------------FN_DYNVARS_113_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.new = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='new'; + + + +--echo '#---------------------FN_DYNVARS_113_08----------------------#' +############################################################################### +# Check if global and session variable are independent of each other # +############################################################################### + +SET @@new = OFF; +SET @@global.new = ON; +SELECT @@new = @@global.new; + +--echo '#---------------------FN_DYNVARS_113_09----------------------#' +############################################################################### +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################### + +SET @@new = ON; +SELECT @@new = @@local.new; +SELECT @@local.new = @@session.new; + + +--echo '#---------------------FN_DYNVARS_113_10----------------------#' +############################################################## +# Check if new can be accessed with and without @@ sign # +############################################################## + +SET new = 1; +SELECT @@new; +--Error ER_UNKNOWN_TABLE +SELECT local.new; +--Error ER_UNKNOWN_TABLE +SELECT session.new; +--Error ER_BAD_FIELD_ERROR +SELECT new = @@session.new; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.new = @start_global_value; +SELECT @@global.new; +SET @@session.new = @start_session_value; +SELECT @@session.new; + + +######################################## +# END OF new TESTS # +######################################## + diff --git a/mysql-test/suite/sys_vars/t/old_passwords_basic.test b/mysql-test/suite/sys_vars/t/old_passwords_basic.test new file mode 100644 index 00000000000..b78ac9ca9b8 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/old_passwords_basic.test @@ -0,0 +1,220 @@ +############## mysql-test\t\old_passwords_basic.test ########################## +# # +# Variable Name: old_passwords # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable old_passwords # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_old-passwords # +# # +############################################################################### + +--source include/load_sysvars.inc +################################################### +# START OF old_passwords TESTS # +################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.old_passwords; +SELECT @start_global_value; +SET @start_session_value = @@session.old_passwords; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_114_01-------------------------#' +################################################### +# Display the DEFAULT value of old_passwords # +################################################### + +SET @@global.old_passwords = ON; +SET @@global.old_passwords = DEFAULT; +SELECT @@global.old_passwords; + +SET @@session.old_passwords = ON; +SET @@session.old_passwords = DEFAULT; +SELECT @@session.old_passwords; + + +--echo '#--------------------FN_DYNVARS_114_02-------------------------#' +################################################### +# Check the DEFAULT value of old_passwords # +################################################### + +SET @@global.old_passwords = DEFAULT; +SELECT @@global.old_passwords = FALSE; + +SET @@session.old_passwords = DEFAULT; +SELECT @@session.old_passwords = FALSE; + + +--echo '#--------------------FN_DYNVARS_114_03-------------------------#' +####################################################################### +# Change the value of old_passwords to a valid value for GLOBAL Scope # +####################################################################### + +SET @@global.old_passwords = ON; +SELECT @@global.old_passwords; +SET @@global.old_passwords = OFF; +SELECT @@global.old_passwords; +SET @@global.old_passwords = 0; +SELECT @@global.old_passwords; +SET @@global.old_passwords = 1; +SELECT @@global.old_passwords; +SET @@global.old_passwords = TRUE; +SELECT @@global.old_passwords; +SET @@global.old_passwords = FALSE; +SELECT @@global.old_passwords; + + + +--echo '#--------------------FN_DYNVARS_114_04-------------------------#' +######################################################################## +# Change the value of old_passwords to a valid value for SESSION Scope # +######################################################################## + +SET @@session.old_passwords = ON; +SELECT @@session.old_passwords; +SET @@session.old_passwords = OFF; +SELECT @@session.old_passwords; +SET @@session.old_passwords = 0; +SELECT @@session.old_passwords; +SET @@session.old_passwords = 1; +SELECT @@session.old_passwords; +SET @@session.old_passwords = TRUE; +SELECT @@session.old_passwords; +SET @@session.old_passwords = FALSE; +SELECT @@session.old_passwords; + + +--echo '#------------------FN_DYNVARS_114_05-----------------------#' +######################################################### +# Change the value of old_passwords to an invalid value # +######################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = 'ONN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = "OFFF"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = TTRUE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = FELSE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = -1024; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = 65536; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = 65530.34; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.old_passwords = test; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = ONF; + +SET @@session.old_passwords = OF; +SELECT @@session.old_passwords; +--echo 'Bug# 34828: OF is also working as OFF and no error is coming'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = 'OFN'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = -2; +--Error ER_PARSE_ERROR +SET @@session.old_passwords = 65530.34.; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = 65550; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.old_passwords = test; + + +--echo '#------------------FN_DYNVARS_114_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.old_passwords = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='old_passwords'; + +--echo '#------------------FN_DYNVARS_114_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.old_passwords = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='old_passwords'; + + +--echo '#---------------------FN_DYNVARS_114_08----------------------#' +############################################################################### +# Check if global and session variable are independent of each other # +############################################################################### + +SET @@old_passwords = OFF; +SET @@global.old_passwords = ON; +SELECT @@old_passwords = @@global.old_passwords; + + +--echo '#---------------------FN_DYNVARS_114_09----------------------#' +############################################################################### +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################### + +SET @@old_passwords = ON; +SELECT @@old_passwords = @@local.old_passwords; +SELECT @@local.old_passwords = @@session.old_passwords; + + +--echo '#---------------------FN_DYNVARS_114_10----------------------#' +######################################################################## +# Check if old_passwords can be accessed with and without @@ sign # +######################################################################## + +SET old_passwords = 1; +SELECT @@old_passwords; +--Error ER_UNKNOWN_TABLE +SELECT local.old_passwords; +--Error ER_UNKNOWN_TABLE +SELECT session.old_passwords; +--Error ER_BAD_FIELD_ERROR +SELECT old_passwords = @@session.old_passwords; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.old_passwords = @start_global_value; +SELECT @@global.old_passwords; +SET @@session.old_passwords = @start_session_value; +SELECT @@session.old_passwords; + + +################################################## +# END OF old_passwords TESTS # +################################################## + diff --git a/mysql-test/suite/sys_vars/t/old_passwords_func.test b/mysql-test/suite/sys_vars/t/old_passwords_func.test new file mode 100644 index 00000000000..2707fc3ab6d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/old_passwords_func.test @@ -0,0 +1,120 @@ +############# mysql-test\t\old_passwords_func.test ############################ +# # +# Variable Name: old_passwords # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: FALSE # +# Values: TRUE, FALSE # +# # +# # +# Creation Date: 2008-03-12 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "old_passwords" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.0/en # +# /server-options.html#option_mysqld_old-passwords # +# # +############################################################################### + +# +# Setup +# + +--source include/not_embedded.inc + +SET @global_old_passwords = @@GLOBAL.old_passwords; +SET @session_old_passwords = @@SESSION.old_passwords; +SET @global_secure_auth = @@GLOBAL.secure_auth; + + +--echo '#------------------------FN_DYNVARS_115_01---------------------------#' + +--echo ** Connection default ** +connection default; + +# +# 2 Users with FALSE value +# + +CREATE USER 'userNewPass1'@'localhost' IDENTIFIED BY 'pass1'; +CREATE USER 'userNewPass2'@'localhost' IDENTIFIED BY 'pass2'; + +SET GLOBAL old_passwords = TRUE; +SET SESSION old_passwords = TRUE; + +# +# 1 User with TRUE value +# + +CREATE USER 'userOldPass'@'localhost' IDENTIFIED BY 'pass3'; + +SET GLOBAL secure_auth = FALSE; + +--echo ** Connecting con1 using username 'userNewPass1' ** +connect (con1,localhost,userNewPass1,pass1,); +SELECT CURRENT_USER(); +--echo userNewPass1@localhost Expected + +--echo ** Connecting con2 using username 'userNewPass2' ** +connect (con2,localhost,userNewPass2,pass2,); +SELECT CURRENT_USER(); +--echo userNewPass2@localhost Expected + +--echo ** Connecting con3 using username 'userOldPass' ** +connect (con3,localhost,userOldPass,pass3,); +SELECT CURRENT_USER(); +--echo userOldPass@localhost Expected + +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting con1, con2, con3 ** +disconnect con1; +disconnect con2; +disconnect con3; + +--echo '#------------------------FN_DYNVARS_115_02---------------------------#' + +SET GLOBAL secure_auth = TRUE; + +--echo ** Connecting con1 using username 'userNewPass1' ** +connect (con1,localhost,userNewPass1,pass1,); +SELECT CURRENT_USER(); +--echo userNewPass1@localhost Expected + +--echo ** Connecting con2 using username 'userNewPass2' ** +connect (con2,localhost,userNewPass2,pass2,); +SELECT CURRENT_USER(); +--echo userNewPass2@localhost Expected + +--echo ** Connecting con3 using username 'userOldPass' ** +--disable_query_log +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE +connect (con3,localhost,userOldPass,pass3,); +--enable_query_log +--echo Expected Error 'Server is running in secure auth mode' +SELECT CURRENT_USER(); +--echo userNewPass2@localhost Expected + +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting con1, con2 ** +disconnect con1; +disconnect con2; + +# +# Cleanup +# + +DROP USER 'userNewPass1'@'localhost'; +DROP USER 'userNewPass2'@'localhost'; +DROP USER 'userOldPass'@'localhost'; + +SET @@GLOBAL.old_passwords = @global_old_passwords; +SET @@SESSION.old_passwords = @session_old_passwords; +SET @@GLOBAL.secure_auth = @global_secure_auth; diff --git a/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test new file mode 100644 index 00000000000..58c074d7d5e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/optimizer_prune_level_basic.test @@ -0,0 +1,228 @@ +############## mysql-test\t\optimizer_prune_level_basic.test ################## +# # +# Variable Name: optimizer_prune_level # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable optimizer_prune_level # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_optimizer_prune_level # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################### +# START OF optimizer_prune_level TESTS # +################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.optimizer_prune_level; +SELECT @start_global_value; +SET @start_session_value = @@session.optimizer_prune_level; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_115_01-------------------------#' +########################################################### +# Display the DEFAULT value of optimizer_prune_level # +########################################################### + +SET @@global.optimizer_prune_level = 0; +SET @@global.optimizer_prune_level = DEFAULT; +SELECT @@global.optimizer_prune_level; + +SET @@session.optimizer_prune_level = 0; +SET @@session.optimizer_prune_level = DEFAULT; +SELECT @@session.optimizer_prune_level; + + +--echo '#--------------------FN_DYNVARS_115_02-------------------------#' +########################################################### +# Check the DEFAULT value of optimizer_prune_level # +########################################################### + +SET @@global.optimizer_prune_level = DEFAULT; +SELECT @@global.optimizer_prune_level = 1; + +SET @@session.optimizer_prune_level = DEFAULT; +SELECT @@session.optimizer_prune_level = 1; + + +--echo '#--------------------FN_DYNVARS_115_03-------------------------#' +############################################################################### +# Change the value of optimizer_prune_level to a valid value for GLOBAL Scope # +############################################################################### + + +SELECT @@global.optimizer_prune_level; +SET @@global.optimizer_prune_level = 0; +SELECT @@global.optimizer_prune_level; +SET @@global.optimizer_prune_level = 1; +SELECT @@global.optimizer_prune_level; +SET @@global.optimizer_prune_level = TRUE; +SELECT @@global.optimizer_prune_level; +SET @@global.optimizer_prune_level = FALSE; +SELECT @@global.optimizer_prune_level; + + + +--echo '#--------------------FN_DYNVARS_115_04-------------------------#' +############################################################################### +# Change the value of optimizer_prune_level to a valid value for SESSION Scope# +############################################################################### + +SELECT @@session.optimizer_prune_level; +SET @@session.optimizer_prune_level = 0; +SELECT @@session.optimizer_prune_level; +SET @@session.optimizer_prune_level = 1; +SELECT @@session.optimizer_prune_level; +SET @@session.optimizer_prune_level = TRUE; +SELECT @@session.optimizer_prune_level; +SET @@session.optimizer_prune_level = FALSE; +SELECT @@session.optimizer_prune_level; + + +--echo '#------------------FN_DYNVARS_115_05-----------------------#' +################################################################# +# Change the value of optimizer_prune_level to an invalid value # +################################################################# + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = ON; +--echo 'Bug# 34840: Since it is a boolean variable, it should not give errors on 'ON' & 'OFF' values'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = OFF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = 'ONN'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = "OFFF"; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = TTRUE; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = FELSE; + +SET @@global.optimizer_prune_level = -1024; +SELECT @@global.optimizer_prune_level; + +--echo 'Bug# 34840: Since it is a boolean variable, it should give errors on numeric values'; + +SET @@global.optimizer_prune_level = 65536; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = 65530.34; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_prune_level = test; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = OFF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = ONN; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = ONF; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = OF; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = 'OFN'; +SET @@session.optimizer_prune_level = -2; +SELECT @@session.optimizer_prune_level; +--Error ER_PARSE_ERROR +SET @@session.optimizer_prune_level = 65530.34.; + +SET @@session.optimizer_prune_level = 65550; +SELECT @@session.optimizer_prune_level; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_prune_level = test; + +--echo '#------------------FN_DYNVARS_115_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.optimizer_prune_level = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='optimizer_prune_level'; + +--echo '#------------------FN_DYNVARS_115_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.optimizer_prune_level = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='optimizer_prune_level'; + + + +--echo '#---------------------FN_DYNVARS_115_08----------------------#' +############################################################################### +# Check if global and session variable are independent of each other # +############################################################################### + +SET @@optimizer_prune_level = 0; +SET @@global.optimizer_prune_level = 1; +SELECT @@optimizer_prune_level = @@global.optimizer_prune_level; + + +--echo '#---------------------FN_DYNVARS_115_09----------------------#' +############################################################################### +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################### + +SET @@optimizer_prune_level = 1; +SELECT @@optimizer_prune_level = @@local.optimizer_prune_level; +SELECT @@local.optimizer_prune_level = @@session.optimizer_prune_level; + + +--echo '#---------------------FN_DYNVARS_115_10----------------------#' +############################################################################### +# Check if optimizer_prune_level can be accessed with and without @@ sign # +############################################################################### + +SET optimizer_prune_level = 1; +SELECT @@optimizer_prune_level; +--Error ER_UNKNOWN_TABLE +SELECT local.optimizer_prune_level; +--Error ER_UNKNOWN_TABLE +SELECT session.optimizer_prune_level; +--Error ER_BAD_FIELD_ERROR +SELECT optimizer_prune_level = @@session.optimizer_prune_level; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.optimizer_prune_level = @start_global_value; +SELECT @@global.optimizer_prune_level; +SET @@session.optimizer_prune_level = @start_session_value; +SELECT @@session.optimizer_prune_level; + +########################################################## +# END OF optimizer_prune_level TESTS # +########################################################## + diff --git a/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test new file mode 100644 index 00000000000..42548c59d40 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/optimizer_search_depth_basic.test @@ -0,0 +1,210 @@ +############## mysql-test\t\optimizer_search_depth_basic.test ############### +# # +# Variable Name: optimizer_search_depth # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 62 # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable optimizer_search_depth # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +###################################################################### +# START OF optimizer_search_depth TESTS # +###################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.optimizer_search_depth; +SELECT @start_global_value; +SET @start_session_value = @@session.optimizer_search_depth; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_116_01-------------------------#' +###################################################################### +# Display the DEFAULT value of optimizer_search_depth # +###################################################################### + +SET @@global.optimizer_search_depth = 100; +SET @@global.optimizer_search_depth = DEFAULT; +SELECT @@global.optimizer_search_depth; + +SET @@session.optimizer_search_depth = 200; +SET @@session.optimizer_search_depth = DEFAULT; +SELECT @@session.optimizer_search_depth; + + +--echo '#--------------------FN_DYNVARS_116_02-------------------------#' +###################################################################### +# Check the DEFAULT value of optimizer_search_depth # +###################################################################### + +SET @@global.optimizer_search_depth = DEFAULT; +SELECT @@global.optimizer_search_depth = 62; + +SET @@session.optimizer_search_depth = DEFAULT; +SELECT @@session.optimizer_search_depth = 62; + + +--echo '#--------------------FN_DYNVARS_116_03-------------------------#' +################################################################################ +# Change the value of optimizer_search_depth to a valid value for GLOBAL Scope # +################################################################################ + +SET @@global.optimizer_search_depth = 0; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = 1; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = 62; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = 63; +SELECT @@global.optimizer_search_depth; + + +--echo '#--------------------FN_DYNVARS_116_04-------------------------#' +################################################################################# +# Change the value of optimizer_search_depth to a valid value for SESSION Scope # +################################################################################# + +SET @@session.optimizer_search_depth = 0; +SELECT @@session.optimizer_search_depth; +SET @@session.optimizer_search_depth = 1; +SELECT @@session.optimizer_search_depth; +SET @@session.optimizer_search_depth = 62; +SELECT @@session.optimizer_search_depth; +SET @@session.optimizer_search_depth = 63; +SELECT @@session.optimizer_search_depth; + + +--echo '#------------------FN_DYNVARS_116_05-----------------------#' +################################################################## +# Change the value of optimizer_search_depth to an invalid value # +################################################################## + +SET @@global.optimizer_search_depth = 64; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = -1; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = 65536; +SELECT @@global.optimizer_search_depth; +--Error ER_PARSE_ERROR +SET @@global.optimizer_search_depth = 65530.34.; +SELECT @@global.optimizer_search_depth; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.optimizer_search_depth = test; +SELECT @@global.optimizer_search_depth; + +SET @@session.optimizer_search_depth = 64; +SELECT @@session.optimizer_search_depth; +SET @@session.optimizer_search_depth = -2; +SELECT @@session.optimizer_search_depth; +--Error ER_PARSE_ERROR +SET @@session.optimizer_search_depth = 65530.34.; +SET @@session.optimizer_search_depth = 65550; +SELECT @@session.optimizer_search_depth; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.optimizer_search_depth = test; +SELECT @@session.optimizer_search_depth; + + +--echo '#------------------FN_DYNVARS_116_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.optimizer_search_depth = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='optimizer_search_depth'; + + +--echo '#------------------FN_DYNVARS_116_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.optimizer_search_depth = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='optimizer_search_depth'; + + +--echo '#------------------FN_DYNVARS_116_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.optimizer_search_depth = TRUE; +SELECT @@global.optimizer_search_depth; +SET @@global.optimizer_search_depth = FALSE; +SELECT @@global.optimizer_search_depth; + + +--echo '#---------------------FN_DYNVARS_116_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.optimizer_search_depth = 10; +SELECT @@optimizer_search_depth = @@global.optimizer_search_depth; + + +--echo '#---------------------FN_DYNVARS_116_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@optimizer_search_depth = 10; +SELECT @@optimizer_search_depth = @@local.optimizer_search_depth; +SELECT @@local.optimizer_search_depth = @@session.optimizer_search_depth; + + +--echo '#---------------------FN_DYNVARS_116_11----------------------#' +################################################################################# +# Check if optimizer_search_depth can be accessed with and without @@ sign # +################################################################################# + +SET optimizer_search_depth = 1; +SELECT @@optimizer_search_depth; +--Error ER_UNKNOWN_TABLE +SELECT local.optimizer_search_depth; +--Error ER_UNKNOWN_TABLE +SELECT session.optimizer_search_depth; +--Error ER_BAD_FIELD_ERROR +SELECT optimizer_search_depth = @@session.optimizer_search_depth; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.optimizer_search_depth = @start_global_value; +SELECT @@global.optimizer_search_depth; +SET @@session.optimizer_search_depth = @start_session_value; +SELECT @@session.optimizer_search_depth; + + +########################################################### +# END OF optimizer_search_depth TESTS # +########################################################### + diff --git a/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test new file mode 100644 index 00000000000..48b1e32676a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/preload_buffer_size_basic.test @@ -0,0 +1,217 @@ +############## mysql-test\t\preload_buffer_size_basic.test ############### +# # +# Variable Name: preload_buffer_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 32768 # +# Range:1024-1073741824 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable preload_buffer_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################### +# START OF preload_buffer_size TESTS # +################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.preload_buffer_size; +SELECT @start_global_value; +SET @start_session_value = @@session.preload_buffer_size; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_129_01-------------------------#' +################################################################### +# Display the DEFAULT value of preload_buffer_size # +################################################################### + +SET @@global.preload_buffer_size = 10000; +SET @@global.preload_buffer_size = DEFAULT; +SELECT @@global.preload_buffer_size; + +SET @@session.preload_buffer_size = 20000; +SET @@session.preload_buffer_size = DEFAULT; +SELECT @@session.preload_buffer_size; + + +--echo '#--------------------FN_DYNVARS_129_02-------------------------#' +################################################################### +# Check the DEFAULT value of preload_buffer_size # +################################################################### + +SET @@global.preload_buffer_size = DEFAULT; +SELECT @@global.preload_buffer_size = 32768; + +SET @@session.preload_buffer_size = DEFAULT; +SELECT @@session.preload_buffer_size = 32768; + + +--echo '#--------------------FN_DYNVARS_129_03-------------------------#' +############################################################################# +# Change the value of preload_buffer_size to a valid value for GLOBAL Scope # +############################################################################# + +SET @@global.preload_buffer_size = 1024; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 1025; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 1073741824; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 1073741823; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 65536; +SELECT @@global.preload_buffer_size; + +--echo '#--------------------FN_DYNVARS_129_04-------------------------#' +############################################################################## +# Change the value of preload_buffer_size to a valid value for SESSION Scope # +############################################################################## + +SET @@session.preload_buffer_size = 1024; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = 1025; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = 1073741824; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = 1073741823; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = 655536; +SELECT @@session.preload_buffer_size; + +--echo '#------------------FN_DYNVARS_129_05-----------------------#' +############################################################### +# Change the value of preload_buffer_size to an invalid value # +############################################################### + +SET @@global.preload_buffer_size = 64; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = -1; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 1023; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = 1073741825; +SELECT @@global.preload_buffer_size; +--Error ER_PARSE_ERROR +SET @@global.preload_buffer_size = 65530.34.; +SELECT @@global.preload_buffer_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.preload_buffer_size = test; +SELECT @@global.preload_buffer_size; + +SET @@session.preload_buffer_size = 64; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = -2; +SELECT @@session.preload_buffer_size; +--Error ER_PARSE_ERROR +SET @@session.preload_buffer_size = 65530.34.; +SET @@session.preload_buffer_size = 1023; +SELECT @@session.preload_buffer_size; +SET @@session.preload_buffer_size = 1073741825; +SELECT @@session.preload_buffer_size; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.preload_buffer_size = test; +SELECT @@session.preload_buffer_size; + + +--echo '#------------------FN_DYNVARS_129_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SELECT @@global.preload_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='preload_buffer_size'; + + +--echo '#------------------FN_DYNVARS_129_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.preload_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='preload_buffer_size'; + + +--echo '#------------------FN_DYNVARS_129_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.preload_buffer_size = TRUE; +SELECT @@global.preload_buffer_size; +SET @@global.preload_buffer_size = FALSE; +SELECT @@global.preload_buffer_size; + + +--echo '#---------------------FN_DYNVARS_129_09----------------------#' +################################################################################# +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################# + +SET @@global.preload_buffer_size = 2048; +SELECT @@preload_buffer_size = @@global.preload_buffer_size; + + +--echo '#---------------------FN_DYNVARS_129_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@preload_buffer_size = 5000; +SELECT @@preload_buffer_size = @@local.preload_buffer_size; +SELECT @@local.preload_buffer_size = @@session.preload_buffer_size; + + +--echo '#---------------------FN_DYNVARS_129_11----------------------#' +############################################################################## +# Check if preload_buffer_size can be accessed with and without @@ sign # +############################################################################## + +SET preload_buffer_size = 1024; +SELECT @@preload_buffer_size; +--Error ER_UNKNOWN_TABLE +SELECT local.preload_buffer_size; +--Error ER_UNKNOWN_TABLE +SELECT session.preload_buffer_size; +--Error ER_BAD_FIELD_ERROR +SELECT preload_buffer_size = @@session.preload_buffer_size; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.preload_buffer_size = @start_global_value; +SELECT @@global.preload_buffer_size; +SET @@session.preload_buffer_size = @start_session_value; +SELECT @@session.preload_buffer_size; + + +######################################################## +# END OF preload_buffer_size TESTS # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test new file mode 100644 index 00000000000..e90a0e6adda --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test @@ -0,0 +1,177 @@ +############# mysql-test\t\Query_cache_limit_func.test ######################## +# # +# Variable Name: Query_cache_limit # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 1048576 # +# Min Value: 0 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "Query_cache_limit" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @global_query_cache_limit = @@global.query_cache_limit; +SET @global_query_cache_size = @@global.query_cache_size; +SET @global_query_cache_type = @@global.query_cache_type; + +--echo ** warnings ** +--disable_warnings +DROP TABLE IF EXISTS t; + +--enable_warnings +#creating table# + +--echo ** creating table ** + +CREATE TABLE t +( +id INT AUTO_INCREMENT PRIMARY KEY, +c TEXT(30) +); + +#inserting value# + +--echo **inserting value ** + +INSERT INTO t set c = repeat('x',29); +INSERT INTO t set c = concat(repeat('x',28),'r','x'); +INSERT INTO t set c = concat(repeat('x',28),'s','y'); +INSERT INTO t set c = concat(repeat('x',28),'g','w'); + +# Reset cache & flush status +--echo ** Reset cache values ** +FLUSH STATUS; +RESET QUERY CACHE; + +# set query cache type value to on and allocating cache size +--echo ** On query_cache_type ** +SET GLOBAL query_cache_type = ON; + +--echo ** Allocating cache size ** +SET GLOBAL query_cache_size = 131072; + +# reset values +--echo ** Reset values +SET GLOBAL query_cache_size = 0; +SET GLOBAL query_cache_size = 131072; +SET GLOBAL query_cache_type = ON; + +--echo '#---------------------FN_DYNVARS_132_01----------------------#' +# +#Check if results are cacheing on default value # +# + +# Reset cache & flush status +--echo ** Reset cache values ** +FLUSH STATUS; +RESET QUERY CACHE; + + +#fetching results# +--echo ** fetching results ** +SELECT * FROM t; + +# Check status +--echo ** check status on not setting query_cache_limit value ** + +SHOW STATUS LIKE 'Qcache_not_cached'; +SHOW STATUS LIKE 'Qcache_queries_in_cache'; + + +--echo '#---------------------FN_DYNVARS_132_02----------------------#' +# +#Check if results are cacheing on setting value to 0 i.e. no caching# +# + +# Reset cache & flush status +--echo ** Reset cache values ** +FLUSH STATUS; +RESET QUERY CACHE; + +#set cache limit +--echo ** set cache limit ** +SET @@GLOBAL.query_cache_limit = 0; + +#fetching results# +--echo ** fetching results ** +SELECT * FROM t; + +# Check status after setting value# +--echo ** Check status after setting value ** +SHOW STATUS LIKE 'Qcache_not_cached'; +--echo 1 Expected +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + + +--echo '#---------------------FN_DYNVARS_132_03----------------------#' +# +# Check if setting to 0 makes any difference to the cache or not # +# + +#set cache limit to default +--echo ** set cache limit ** +SET @@GLOBAL.query_cache_limit = DEFAULT; + +# Reset cache & flush status +--echo ** Reset cache values ** +FLUSH STATUS; +RESET QUERY CACHE; + +#fetching results# +--echo ** fetching results ** +SELECT * FROM t; + +SHOW STATUS LIKE 'Qcache_not_cached'; +--echo 0 Expected +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +SET @@GLOBAL.query_cache_limit = 0; + +SHOW STATUS LIKE 'Qcache_not_cached'; +--echo 0 Expected +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +#fetching results# +--echo ** fetching results ** +SELECT * FROM t; + +# Check status after setting value# +--echo ** Check status after setting value ** + +SHOW STATUS LIKE 'Qcache_not_cached'; +--echo 0 Expected +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +# +# Cleanup +# + +SET @@GLOBAL.query_cache_limit = @global_query_cache_limit; +SET GLOBAL query_cache_size = @global_query_cache_size; +SET GLOBAL query_cache_type = @global_query_cache_type; + +--disable_warnings +DROP TABLE IF EXISTS t; +--enable_warnings + diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_basic.test b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test new file mode 100644 index 00000000000..ba7e26a3065 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_cache_type_basic.test @@ -0,0 +1,228 @@ +################ mysql-test\t\query_cache_type_basic.test ##################### +# # +# Variable Name: query_cache_type # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: 1 # +# Range: 0,1 & 2 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable query_cache_type # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF query_cache_type TESTS # +######################################################################## + + +########################################################################### +# Saving initial value of query_cache_type in a temporary variable # +########################################################################### + +SET @global_start_value = @@global.query_cache_type; +SELECT @global_start_value; + +SET @session_start_value = @@session.query_cache_type; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_134_01------------------------#' +######################################################################## +# Display the DEFAULT value of query_cache_type # +######################################################################## + +SET @@global.query_cache_type = 0; +SET @@global.query_cache_type = DEFAULT; +SELECT @@global.query_cache_type; + +SET @@session.query_cache_type = 0; +SET @@session.query_cache_type = DEFAULT; +SELECT @@session.query_cache_type; + + +--echo '#---------------------FN_DYNVARS_134_02-------------------------#' +######################################################### +# Check if NULL or empty value is accepeted # +######################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = ''; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_type = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_type = ''; + +--echo '#--------------------FN_DYNVARS_134_03------------------------#' +######################################################################## +# Change the value of query_cache_type to a valid value # +######################################################################## + +SET @@global.query_cache_type = OFF; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = ON; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = DEMAND; +SELECT @@global.query_cache_type; + +SET @@session.query_cache_type = OFF; +SELECT @@session.query_cache_type; + +SET @@session.query_cache_type = ON; +SELECT @@session.query_cache_type; + +SET @@session.query_cache_type = DEMAND; +SELECT @@session.query_cache_type; + + +--echo '#--------------------FN_DYNVARS_134_04-------------------------#' +########################################################################### +# Change the value of query_cache_type to invalid value # +########################################################################### + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = ONDEMAND; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = 'ON,OFF'; + +SET @@global.query_cache_type = 'OF'; +SELECT @@global.query_cache_type; + +--echo 'Bug# 34828: OF is taken as OFF.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = YES; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = ' '; + + +--echo '#-------------------FN_DYNVARS_134_05----------------------------#' +######################################################################### +# Check if the value in session Table matches value in variable # +######################################################################### + +SELECT @@session.query_cache_type = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='query_cache_type'; + +--echo '#----------------------FN_DYNVARS_134_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.query_cache_type = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='query_cache_type'; + + +--echo '#---------------------FN_DYNVARS_134_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +# test if variable accepts 0,1,2 +SET @@global.query_cache_type = 0; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 1; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 2; +SELECT @@global.query_cache_type; + +# use of decimal values + +SET @@global.query_cache_type = 0.4; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 1.0; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 1.1; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 1.5; +SELECT @@global.query_cache_type; + +SET @@global.query_cache_type = 2.49; +SELECT @@global.query_cache_type; + +SET @@session.query_cache_type = 0.5; +SELECT @@session.query_cache_type; + +SET @@session.query_cache_type = 1.6; +SELECT @@session.query_cache_type; + + +--echo 'Bug: Decimal values can be used within the range [0.0-2.5). Values'; +--echo 'are rounded to 0,1,2 as evident from outcome.'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_type = 3; + + +--echo '#---------------------FN_DYNVARS_134_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.query_cache_type = TRUE; +SELECT @@global.query_cache_type; +SET @@global.query_cache_type = FALSE; +SELECT @@global.query_cache_type; + +--echo '#---------------------FN_DYNVARS_134_09----------------------#' +###################################################################### +# Check if query_cache_type can be accessed with and without @@ sign # +###################################################################### + +SET query_cache_type = 'ON'; + +--Error ER_PARSE_ERROR +SET session.query_cache_type = 'OFF'; +--Error ER_PARSE_ERROR +SET global.query_cache_type = 'DEMAND'; + +SET session query_cache_type = 1; +SELECT @@query_cache_type; + +SET global query_cache_type = 0; +SELECT @@global.query_cache_type; + +############################## +# Restore initial value # +############################## + +SET @@global.query_cache_type = @global_start_value; +SELECT @@global.query_cache_type; + +SET @@session.query_cache_type = @session_start_value; +SELECT @@session.query_cache_type; + +######################################################################## +# END OF query_cache_type TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test new file mode 100644 index 00000000000..4679d1ec339 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test @@ -0,0 +1,317 @@ +############# mysql-test\t\query_cache_type_func.test ######################### +# # +# Variable Name: query_cache_type # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: ON # +# Values: ON, OFF, DEMAND # +# # +# # +# Creation Date: 2008-02-20 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "query_cache_type" # +# that checks behavior of this variable in the following ways # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--echo ** Setup ** +--echo + +# Setup +# + +# +# Save initial value +# + +--echo ** Connecting to con0 using root ** +connect (con0,localhost,root,,); +--echo ** Connection con0 ** +connection con0; + +SET @start_global_value = @@GLOBAL.query_cache_type; +SET @start_session_value = @@SESSION.query_cache_type; +SET @start_query_cache_size= @@global.query_cache_size; + +# +# Creating test table +# + +CREATE TABLE t1(id int, value varchar(10)); + +INSERT INTO t1 VALUES(1, 'val1'); +INSERT INTO t1 VALUES(2, 'val2'); +INSERT INTO t1 VALUES(3, 'val3'); + +# +# Clearing the query cache and setting up cache size +# + +SET @@GLOBAL.query_cache_size = 65536; + +--echo FLUSHING CACHE +SET @@GLOBAL.query_cache_size = 0; +SET @@GLOBAL.query_cache_size = 65536; + +# +# SESSION SCOPE +# + +--echo ** TESTING SESSION SCOPE ** + +--echo '#--------------------FN_DYNVARS_135_01-------------------------#' +# +# Testing default value it should be ON by default +# + +SET @@query_cache_type = DEFAULT; +SELECT @@query_cache_type; +--echo ON Expected + +--echo '#--------------------FN_DYNVARS_135_02-------------------------#' +# +# Testing valid possible values +# + +--error ER_WRONG_VALUE_FOR_VAR +SET @@query_cache_type = NULL; +--echo Expected error: Wrong value for variable + +SET @@query_cache_type = ON; +SELECT @@query_cache_type; +--echo ON Expected + +SET @@query_cache_type = OFF; +SELECT @@query_cache_type; +--echo OFF Expected + +SET @@query_cache_type = DEMAND; +SELECT @@query_cache_type; +--echo DEMAND Expected + +--error ER_WRONG_VALUE_FOR_VAR +SET @@query_cache_type = XYZ; +--echo Expected error: Wrong value for variable + + +# +# TESTING FOR VALUE ON or 1 +# + +--echo ** Turning cache to ON ** + +SET @@query_cache_type = ON; + +--echo '#--------------------FN_DYNVARS_135_03-------------------------#' +# +# TESTING CACHE ADDITION +# + +--echo ** CACHE ADDITION ** +--echo + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +SELECT value FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 2 Expected + +--echo '#--------------------FN_DYNVARS_135_04-------------------------#' +# +# TESTING CACHE HIT +# + +--echo ** CACHE HIT ** + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 2 Expected + +SELECT SQL_CACHE value FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 3 Expected + +SELECT SQL_NO_CACHE value FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 3 Expected + +--echo '#--------------------FN_DYNVARS_135_05-------------------------#' +# +# Testing with store procedure +# + +--echo Testing with store procedure + +delimiter |; + +CREATE PROCEDURE testProcHit() +BEGIN + SELECT * FROM t1; + SELECT SQL_CACHE value FROM t1; +END| + +delimiter ;| + +CALL testProcHit(); + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo Expected value : 3 +--echo ================== +--echo Bug#35388: Stored procedure execution causes improper behavior of query cache. + + +--echo '#--------------------FN_DYNVARS_135_06-------------------------#' +# +# TESTING FOR VALUE OFF or 0 +# + +--echo FLUSHING CACHE +SET @@GLOBAL.query_cache_size = 0; +SET @@GLOBAL.query_cache_size = 65536; + +--echo ** Turning cache to OFF ** + +SET @@query_cache_type = OFF; +SELECT @@query_cache_type; + +SELECT id FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +--echo '#--------------------FN_DYNVARS_135_07-------------------------#' +# +# TESTING QUERY WITH SQL_CACHE +# + +SELECT SQL_CACHE id FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +SELECT SQL_CACHE * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +--echo '#--------------------FN_DYNVARS_135_08-------------------------#' +# +# TESTING FOR VALUE DEMAND or 2 +# + +--echo FLUSHING CACHE +SET @@GLOBAL.query_cache_size = 0; +SET @@GLOBAL.query_cache_size = 65536; + +--echo ** Turning cache to DEMAND ** + +SET @@query_cache_type = DEMAND; +SELECT @@query_cache_type; + +--echo '#--------------------FN_DYNVARS_135_09-------------------------#' +# +# TESTING NORMAL QUERY +# + +SELECT value,id FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +SELECT SQL_CACHE * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +# +# GLOBAL SCOPE +# + +--echo ** TESTING GLOBAL SCOPE ** + +--echo '#--------------------FN_DYNVARS_135_10-------------------------#' +# +# Turning global cache to OFF +# + +SET @@GLOBAL.query_cache_type = OFF; + +--echo ** Connecting con1 using root ** +connect (con1,localhost,root,,); + +--echo ** Connection con1 ** +connection con1; + +SELECT @@query_cache_type; +--echo OFF Expected + +--echo '#--------------------FN_DYNVARS_135_11-------------------------#' +# +# Turning global cache to DEMAND +# +SET @@GLOBAL.query_cache_type = DEMAND; + +--echo ** Connecting con2 using root ** +connect (con2,localhost,root,,); + +--echo ** Connection con2 ** +connection con2; + +SELECT @@query_cache_type; +--echo DEMAND Expected + +--echo '#--------------------FN_DYNVARS_135_12-------------------------#' +# +# Turning global cache to ON +# +SET @@GLOBAL.query_cache_type = ON; + +--echo ** Connecting con3 using root ** +connect (con3,localhost,root,,); +--echo ** Connection con3 ** +connection con3; + +SELECT @@query_cache_type; +--echo ON Expected + +--echo +--echo ** Cleanup ** +--echo +# +# Cleanup +# + +--echo Disconnecting con1,con2,con3 +disconnect con1; +disconnect con2; +disconnect con3; + +--echo ** Connection con0 ** +connection con0; + +SET @@GLOBAL.query_cache_type = @start_global_value; +SET @@SESSION.query_cache_type = @start_session_value; +SET GLOBAL query_cache_size = @start_query_cache_size; + +DROP TABLE t1; + +DROP PROCEDURE testProcHit; + +--echo Disconnecting con0 +disconnect con0; + diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test new file mode 100644 index 00000000000..f253c1b4f43 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test @@ -0,0 +1,231 @@ +########### mysql-test\t\query_cache_wlock_invalidate_basic.test ############## +# # +# Variable Name: query_cache_wlock_invalidate # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Range: TRUE, FALSE # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable # +# query_cache_wlock_invalidate that checks the behavior of this # +# variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF query_cache_wlock_invalidate TESTS # +######################################################################## + + +############################################################################### +# Saving initial value of query_cache_wlock_invalidate in a temporary variable# +############################################################################### + +SET @session_start_value = @@session.query_cache_wlock_invalidate; +SELECT @session_start_value; + +SET @global_start_value = @@global.query_cache_wlock_invalidate; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_135_01------------------------#' +######################################################################## +# Display the DEFAULT value of query_cache_wlock_invalidate # +######################################################################## + +SET @@session.query_cache_wlock_invalidate = 1; +SET @@session.query_cache_wlock_invalidate = DEFAULT; +SELECT @@session.query_cache_wlock_invalidate; + +SET @@global.query_cache_wlock_invalidate = 1; +SET @@global.query_cache_wlock_invalidate = DEFAULT; +SELECT @@global.query_cache_wlock_invalidate; + +--echo '#---------------------FN_DYNVARS_135_02-------------------------#' +########################################################################### +# Check if query_cache_wlock_invalidate can be accessed with and without +# @@ sign +########################################################################### + +SET query_cache_wlock_invalidate = 1; +SELECT @@query_cache_wlock_invalidate; + +--Error ER_UNKNOWN_TABLE +SELECT session.query_cache_wlock_invalidate; + +--Error ER_UNKNOWN_TABLE +SELECT local.query_cache_wlock_invalidate; + +--Error ER_UNKNOWN_TABLE +SELECT global.query_cache_wlock_invalidate; + +#using another syntax for accessing system variables +SET session query_cache_wlock_invalidate = 0; +SELECT @@session.query_cache_wlock_invalidate; + +SET global query_cache_wlock_invalidate = 0; +SELECT @@global.query_cache_wlock_invalidate; + + +--echo '#--------------------FN_DYNVARS_135_03------------------------#' +########################################################################## +# change the value of query_cache_wlock_invalidate to a valid value # +########################################################################## +# for session +SET @@session.query_cache_wlock_invalidate = 0; +SELECT @@session.query_cache_wlock_invalidate; +SET @@session.query_cache_wlock_invalidate = 1; +SELECT @@session.query_cache_wlock_invalidate; + +# for global +SET @@global.query_cache_wlock_invalidate = 0; +SELECT @@global.query_cache_wlock_invalidate; +SET @@global.query_cache_wlock_invalidate = 1; +SELECT @@global.query_cache_wlock_invalidate; + + +--echo '#--------------------FN_DYNVARS_135_04-------------------------#' +########################################################################### +# Change the value of query_cache_wlock_invalidate to invalid value # +########################################################################### + +# for session +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = 1.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = ÕN; + +SET @@session.query_cache_wlock_invalidate = OF; +SELECT @@session.query_cache_wlock_invalidate; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.query_cache_wlock_invalidate = ÓFF; + +# for global + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = ÕN; + +SET @@global.query_cache_wlock_invalidate = OF; +SELECT @@global.query_cache_wlock_invalidate; + +--echo 'Bug 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.query_cache_wlock_invalidate = ÓFF; + + +--echo '#-------------------FN_DYNVARS_135_05----------------------------#' +########################################################################### +# Test if changing global variable effects session and vice versa # +########################################################################### + +SET @@global.query_cache_wlock_invalidate = 0; +SET @@session.query_cache_wlock_invalidate = 1; +SELECT @@global.query_cache_wlock_invalidate AS res_is_0; + +SET @@global.query_cache_wlock_invalidate = 0; +SELECT @@session.query_cache_wlock_invalidate AS res_is_1; + +--echo '#----------------------FN_DYNVARS_135_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.query_cache_wlock_invalidate = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; +SELECT @@global.query_cache_wlock_invalidate; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; + +--echo '#----------------------FN_DYNVARS_135_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.query_cache_wlock_invalidate = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; +SELECT @@session.query_cache_wlock_invalidate; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; + +--echo '#---------------------FN_DYNVARS_135_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.query_cache_wlock_invalidate = OFF; +SELECT @@session.query_cache_wlock_invalidate; +SET @@session.query_cache_wlock_invalidate = ON; +SELECT @@session.query_cache_wlock_invalidate; + +SET @@global.query_cache_wlock_invalidate = OFF; +SELECT @@global.query_cache_wlock_invalidate; +SET @@global.query_cache_wlock_invalidate = ON; +SELECT @@global.query_cache_wlock_invalidate; + +--echo '#---------------------FN_DYNVARS_135_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.query_cache_wlock_invalidate = TRUE; +SELECT @@session.query_cache_wlock_invalidate; +SET @@session.query_cache_wlock_invalidate = FALSE; +SELECT @@session.query_cache_wlock_invalidate; + +SET @@global.query_cache_wlock_invalidate = TRUE; +SELECT @@global.query_cache_wlock_invalidate; +SET @@global.query_cache_wlock_invalidate = FALSE; +SELECT @@global.query_cache_wlock_invalidate; + +############################## +# Restore initial value # +############################## + +SET @@session.query_cache_wlock_invalidate = @session_start_value; +SELECT @@session.query_cache_wlock_invalidate; + +SET @@global.query_cache_wlock_invalidate = @global_start_value; +SELECT @@global.query_cache_wlock_invalidate; + +############################################################### +# END OF query_cache_wlock_invalidate TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test new file mode 100644 index 00000000000..83b0c446b28 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test @@ -0,0 +1,285 @@ +############# mysql-test\t\query_cache_wlock_invalidate_func.test #################### +# # +# Variable Name: query_cache_wlock_invalidate # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Values: TRUE / 1, FALSE / 0 # +# # +# # +# Creation Date: 2008-02-21 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "query_cache_wlock_invalidate" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Cache behaviors # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_query_cache_wlock_invalidate # +# # +###################################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +# disabled due to differences in the result +--disable_ps_protocol +# +# Save initial value +# +--echo ** Connecting con0 using root ** +connect (con0,localhost,root,,); +--echo ** Connecting con1 using root ** +connect (con1, localhost, root,,); +--echo ** Connection con0 ** +connection con0; + +SET @start_global_value = @@GLOBAL.query_cache_wlock_invalidate; +SET @start_session_value = @@SESSION.query_cache_wlock_invalidate; + +SET @old_cache_size = @@GLOBAL.query_cache_size; +SET @old_cache_type = @@GLOBAL.query_cache_type; + +# +# Creating test table +# + +CREATE TABLE t1(id int, value varchar(10)); + +INSERT INTO t1 VALUES(1, 'val1'); +INSERT INTO t1 VALUES(2, 'val2'); +INSERT INTO t1 VALUES(3, 'val3'); + +# +# Clearing the query cache and setting up cache size +# + +SET GLOBAL query_cache_size = 131072; + +--echo FLUSHING CACHE +SET GLOBAL query_cache_size = 0; +SET GLOBAL query_cache_size = 131072; + +SET GLOBAL query_cache_type = ON; + +# +# Testing for value ON +# +--echo Testing for value ON + +--echo ** Connection con0 ** +connection con0; + +SET SESSION query_cache_wlock_invalidate = ON; + +--echo ** Connection con1 ** +connection con1; + +SET SESSION query_cache_wlock_invalidate = ON; + +--echo '#----------------------------FN_DYNVARS_136_01--------------#' +# +# Testing for cache invalidation +# + +--echo Testing for cache invalidation + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +LOCK TABLE t1 WRITE; + +UNLOCK TABLES; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 0 Expected + +--echo '#----------------------------FN_DYNVARS_136_02-----------------------#' +# +# Testing for blockage of access +# + +disable_result_log; + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; + +enable_result_log; + +--echo ** Connection con1 ** +connection con1; + +SELECT * FROM t1; + +--echo ** Connection con0 ** +connection con0; + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +--echo ** Asynchronous Execution ** +send SELECT * FROM t1; + +--echo ** Connection con0 ** +connection con0; + +--echo Sleeping 2 Seconds before unlock +--sleep 2 +UNLOCK TABLES; + +--echo ** Connection con1 ** +connection con1; +--echo ** Asynchronous Result ** +reap; + +# +# Testing for value OFF +# +--echo Testing for value OFF + +--echo ** Connection con0 ** +connection con0; + +SET SESSION query_cache_wlock_invalidate = OFF; + +--echo ** Connection con1 ** +connection con1; + +SET SESSION query_cache_wlock_invalidate = OFF; + +--echo '#----------------------------FN_DYNVARS_136_03------------------#' +# +# Testing for cache invalidation +# + +--echo Testing for cache invalidation + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +LOCK TABLE t1 WRITE; + +UNLOCK TABLES; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +--echo '#----------------------------FN_DYNVARS_136_04---------------------#' +# +# Testing for blockage of access +# + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Qcache_queries_in_cache'; +--echo 1 Expected + +--echo ** Connection con1 ** +connection con1; + +SELECT * FROM t1; + +--echo ** Connection con0 ** +connection con0; + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +--echo ** Should not be blocked ** +SELECT * FROM t1; + +--echo ** Connection con0 ** +connection con0; + +--echo Sleeping 2 Seconds before unlock +--sleep 2 +UNLOCK TABLES; + +--echo ** Connection con1 ** +connection con1; + +--echo '#----------------------------FN_DYNVARS_136_05------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL query_cache_wlock_invalidate = OFF; + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.query_cache_wlock_invalidate; +--echo Expected Value : 0 / OFF; +SET SESSION query_cache_wlock_invalidate = ON; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.query_cache_wlock_invalidate; +--echo Expected Value : 0 / OFF; + +SET SESSION query_cache_wlock_invalidate = OFF; + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.query_cache_wlock_invalidate; +--echo Expected Value : 1 / ON; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.query_cache_wlock_invalidate; +--echo Expected Value : 0 / OFF; + +SELECT @@GLOBAL.query_cache_wlock_invalidate; +--echo Expected Value : 0 / OFF; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# +--echo +--echo CLEANUP + +--echo ** Connection con0 ** +connection con0; + +SET @@GLOBAL.query_cache_wlock_invalidate = @start_global_value; +SET @@SESSION.query_cache_wlock_invalidate = @start_session_value ; +SET @@GLOBAL.query_cache_size = @old_cache_size; +SET @@GLOBAL.query_cache_type = @old_cache_type; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con0, con1 +disconnect con0; +disconnect con1; + +DROP TABLE t1; + +--enable_ps_protocol + diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test new file mode 100644 index 00000000000..7267b9e317e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test @@ -0,0 +1,92 @@ +############# mysql-test\t\query_prealloc_size_func.test ###################### +# # +# Variable Name: query_prealloc_size # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: integer # +# Default Value: 8192 # +# Values: 8192-4294967295 # +# # +# # +# Creation Date: 2008-02-22 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "query_prealloc_size" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Cache behaviors # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + + + +--echo ** Setup ** +--echo +# +# Setup +# + +# +# Save initial value +# + +SET @start_value = @@global.query_prealloc_size; + +CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200)); + +INSERT INTO t1 VALUES(NULL,'a'); +INSERT INTO t1 VALUES(NULL,'b'); +INSERT INTO t1 VALUES(NULL,'c'); +INSERT INTO t1 VALUES(NULL,'d'); + +SELECT * FROM t1 ORDER BY val; + +SET SESSION query_prealloc_size = 8192; + + +--echo '#----------------------------FN_DYNVARS_137_05-----------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL query_prealloc_size = 8192; + +connect (con_int1,localhost,root,,); +connection con_int1; + +SELECT @@SESSION.query_prealloc_size; +--echo Expected Value : 8192; +SET SESSION query_prealloc_size = 16384; + +connect (con_int2,localhost,root,,); +connection con_int2; + +SELECT @@SESSION.query_prealloc_size; +--echo Expected Value : 8192; + +SET SESSION query_prealloc_size = 8192; + +connection con_int1; +SELECT @@SESSION.query_prealloc_size; +--echo Expected Value : 16384; + +connection con_int2; +SELECT @@SESSION.query_prealloc_size; +--echo Expected Value : 8192; + +SELECT @@GLOBAL.query_prealloc_size; +--echo Expected Value : 8192; + +connection default; +disconnect con_int1; +disconnect con_int2; + +DROP TABLE t1; + +SET @@global.query_prealloc_size = @start_value; + diff --git a/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test new file mode 100644 index 00000000000..405bb9da6d8 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/read_buffer_size_basic.test @@ -0,0 +1,209 @@ +############## mysql-test\t\read_buffer_size_basic.test ############### +# # +# Variable Name: read_buffer_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 131072 # +# Range: 8200-2147479552 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable read_buffer_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +###################################################################### +# START OF read_buffer_size TESTS # +###################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.read_buffer_size; +SELECT @start_global_value; +SET @start_session_value = @@session.read_buffer_size; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_138_01-------------------------#' +###################################################################### +# Display the DEFAULT value of read_buffer_size # +###################################################################### + +SET @@global.read_buffer_size = 1000; +SET @@global.read_buffer_size = DEFAULT; +SELECT @@global.read_buffer_size; + +SET @@session.read_buffer_size = 2000; +SET @@session.read_buffer_size = DEFAULT; +SELECT @@session.read_buffer_size; + + +--echo '#--------------------FN_DYNVARS_138_02-------------------------#' +###################################################################### +# Check the DEFAULT value of read_buffer_size # +###################################################################### + +SET @@global.read_buffer_size = DEFAULT; +SELECT @@global.read_buffer_size = 131072; + +SET @@session.read_buffer_size = DEFAULT; +SELECT @@session.read_buffer_size = 131072; + + +--echo '#--------------------FN_DYNVARS_138_03-------------------------#' +################################################################################ +# Change the value of read_buffer_size to a valid value for GLOBAL Scope # +################################################################################ + +SET @@global.read_buffer_size = 8201; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +SET @@global.read_buffer_size = 8200; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +SET @@global.read_buffer_size = 2147479552; +SELECT @@global.read_buffer_size; +SET @@global.read_buffer_size = 2147479551; +SELECT @@global.read_buffer_size; + +--echo '#--------------------FN_DYNVARS_138_04-------------------------#' +################################################################################### +# Change the value of read_buffer_size to a valid value for SESSION Scope # +################################################################################### + +SET @@session.read_buffer_size = 8200; +SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; +SET @@session.read_buffer_size = 8201; +SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; +SET @@session.read_buffer_size = 2147479552; +SELECT @@session.read_buffer_size; +SET @@session.read_buffer_size = 2147479551; +SELECT @@session.read_buffer_size; + + +--echo '#------------------FN_DYNVARS_138_05-----------------------#' +################################################################## +# Change the value of read_buffer_size to an invalid value # +################################################################## + +SET @@global.read_buffer_size = 8199; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +SET @@global.read_buffer_size = -1024; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +SET @@global.read_buffer_size = 2147479553; +SELECT @@global.read_buffer_size; +--Error ER_PARSE_ERROR +SET @@global.read_buffer_size = 65530.34.; +SELECT @@global.read_buffer_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.read_buffer_size = test; +SELECT @@global.read_buffer_size; + +SET @@session.read_buffer_size = 8199; +SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; +SET @@session.read_buffer_size = -2; +SELECT @@session.read_buffer_size= 8200 OR @@session.read_buffer_size= 8228 ; +--Error ER_PARSE_ERROR +SET @@session.read_buffer_size = 65530.34.; +SET @@session.read_buffer_size = 2147479553; +SELECT @@session.read_buffer_size; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.read_buffer_size = test; +SELECT @@session.read_buffer_size; + + +--echo '#------------------FN_DYNVARS_138_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.read_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='read_buffer_size'; + +--echo '#------------------FN_DYNVARS_138_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.read_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='read_buffer_size'; + + +--echo '#------------------FN_DYNVARS_138_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.read_buffer_size = TRUE; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +SET @@global.read_buffer_size = FALSE; +SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; +echo 'Bug: FN_DYNVARS_138_08- Errors are not coming on assigning TRUE/FALSE to variable'; + + +--echo '#---------------------FN_DYNVARS_138_09----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.read_buffer_size = 9000; +SELECT @@read_buffer_size = @@global.read_buffer_size; + + +--echo '#---------------------FN_DYNVARS_138_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@read_buffer_size = 9000; +SELECT @@read_buffer_size = @@local.read_buffer_size; +SELECT @@local.read_buffer_size = @@session.read_buffer_size; + + +--echo '#---------------------FN_DYNVARS_138_11----------------------#' +################################################################################### +# Check if read_buffer_size can be accessed with and without @@ sign # +################################################################################### + +SET read_buffer_size = 9100; +SELECT @@read_buffer_size= 8200 OR @@read_buffer_size= 8228 ; +--Error ER_UNKNOWN_TABLE +SELECT local.read_buffer_size; +--Error ER_UNKNOWN_TABLE +SELECT session.read_buffer_size; +--Error ER_BAD_FIELD_ERROR +SELECT read_buffer_size = @@session.read_buffer_size; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.read_buffer_size = @start_global_value; +SELECT @@global.read_buffer_size; +SET @@session.read_buffer_size = @start_session_value; +SELECT @@session.read_buffer_size; + + +############################################################# +# END OF read_buffer_size TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/read_only_basic.test b/mysql-test/suite/sys_vars/t/read_only_basic.test new file mode 100644 index 00000000000..917842256b1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/read_only_basic.test @@ -0,0 +1,173 @@ +############## mysql-test\t\read_only_basic.test ############### +# # +# Variable Name: read_only # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 0 # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable read_only # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +################################################################ +# START OF read_only TESTS # +################################################################ + + +################################################################ +# Saving initial value of read_only in a temporary variable # +################################################################ + +SET @start_value = @@global.read_only; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_139_01------------------------#' +################################################################ +# Display the DEFAULT value of read_only # +################################################################ + +SET @@global.read_only = 1; +SET @@global.read_only = DEFAULT; +SELECT @@global.read_only; + + +--echo '#---------------------FN_DYNVARS_139_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.read_only = @start_value; +SELECT @@global.read_only = 0; + + +--echo '#--------------------FN_DYNVARS_139_03------------------------#' +################################################################# +# Change the value of read_only to a valid value # +################################################################# + +SET @@global.read_only = 0; +SELECT @@global.read_only; +SET @@global.read_only = 1; +SELECT @@global.read_only; +SET @@global.read_only = TRUE; +SELECT @@global.read_only; +SET @@global.read_only = FALSE; +SELECT @@global.read_only; +SET @@global.read_only = ON; +SELECT @@global.read_only; +SET @@global.read_only = OFF; +SELECT @@global.read_only; + +--echo '#--------------------FN_DYNVARS_139_04-------------------------#' +#################################################################### +# Change the value of read_only to invalid value # +#################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = -1; +SELECT @@global.read_only; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = 4294967296; +SELECT @@global.read_only; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = 10240022115; +SELECT @@global.read_only; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = 10000.01; +SELECT @@global.read_only; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = -1024; +SELECT @@global.read_only; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = 42949672950; +SELECT @@global.read_only; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.read_only = 'test'; +SELECT @@global.read_only; + + +--echo '#-------------------FN_DYNVARS_139_05----------------------------#' +#################################################################### +# Test if accessing session read_only gives error # +#################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.read_only = 0; +SELECT @@read_only; + + +--echo '#----------------------FN_DYNVARS_139_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.read_only = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='read_only'; + +SELECT @@read_only = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='read_only'; + + +--echo '#---------------------FN_DYNVARS_139_07----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.read_only = 1; +SELECT @@read_only = @@global.read_only; + + +--echo '#---------------------FN_DYNVARS_139_08----------------------#' +################################################################### +# Check if read_only can be accessed with and without @@ sign # +################################################################### + +--Error ER_GLOBAL_VARIABLE +SET read_only = 1; +SELECT @@read_only; +--Error ER_PARSE_ERROR +SET local.read_only = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.read_only; +--Error ER_PARSE_ERROR +SET global.read_only = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.read_only; +--Error ER_BAD_FIELD_ERROR +SELECT read_only = @@session.read_only; + + +############################## +# Restore initial value # +############################## + +SET @@global.read_only = @start_value; +SELECT @@global.read_only; + + +################################################################# +# END OF read_only TESTS # +################################################################# + diff --git a/mysql-test/suite/sys_vars/t/read_only_func.test b/mysql-test/suite/sys_vars/t/read_only_func.test new file mode 100644 index 00000000000..c8fb932544b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/read_only_func.test @@ -0,0 +1,151 @@ +############ mysql-test\t\read_only_func.test ################################## +# # +#Variable Name: read_only # +#Scope: SESSION # +#Access Type: Dynamic # +#Data Type: BOOLEAN # +#Default Value: OFF # +#Values: ON, OFF # +# # +# # +#Creation Date: 2008-03-02 # +#Author: Sharique Abdullah # +# # +#Description: Test Cases of Dynamic System Variable "read_only" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# +# option_mysqld_read_only # +# # +################################################################################ + +--echo ** Setup ** +--echo +# +# Setup +# + +--source include/not_embedded.inc + +SET @default_read_only = @@read_only; + +--echo '#--------------------FN_DYNVARS_140_01-------------------------#' +################################### +#Setting Read only value ON # +################################### + +SET Global read_only=ON; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +################################## +# Creating table # +################################## + + +# creating table +CREATE TABLE t1 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name BLOB +); + +################################## +# Inserting values # +################################## + + +INSERT into t1(name) values("aaassssssssddddddddffffff"); + +################################### +# Updating values # +################################### + +update t1 set name="jfjdf" where id=1; + +############################################### +# Select to see wether value is updated or not# +############################################### + +select * from t1 where id=1; + +--echo '#--------------------FN_DYNVARS_140_02-------------------------#' +######################################### +#Creating user without Super privilege # +######################################### + + +--echo ** Creating new user with out super privilege** +CREATE user sameea; +--echo ** Connecting connn using username 'sameea' ** +CONNECT (connn,localhost,sameea,,); + +--Error ER_SPECIFIC_ACCESS_DENIED_ERROR +SET Global read_ONLY=ON; +--Error ER_OPTION_PREVENTS_STATEMENT +CREATE TABLE t2 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name BLOB +); + +# With ps-protocol the error is ER_NO_SUCH_TABLE +--echo not updating values +--Error ER_OPTION_PREVENTS_STATEMENT,ER_NO_SUCH_TABLE +INSERT into t2(name) values("aaassssssssddddddddffffff"); + + +--Error ER_OPTION_PREVENTS_STATEMENT,ER_NO_SUCH_TABLE +UPDATE t2 SET name="samia" where id=1; + +--echo '#--------------------FN_DYNVARS_140_03-------------------------#' + +########################### +# Testing temporary table # +########################### +CREATE TEMPORARY TABLE t3(a int); + +--echo '#--------------------FN_DYNVARS_140_04-------------------------#' +########################### +# Turning read_only OFF # +########################### +--echo ** Connection default ** +connection default; + +SET Global read_only=OFF; +--echo ** Connection connn ** +connection connn; + +CREATE TABLE t2 +( +id INT NOT NULL auto_increment, +PRIMARY KEY (id), +name BLOB +); +--echo updating values +INSERT into t2(name) values("aaassssssssdddddddd"); + +UPDATE t2 SET name="samia" where id=1; + +# +# Cleanup +# +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting connn ** +DISCONNECT connn; + +DROP USER sameea; + +DROP TABLE t1; +DROP TABLE t2; +SET global read_only = @default_read_only; + +--disable_info +--enable_warnings diff --git a/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test new file mode 100644 index 00000000000..e3d2a4b89f7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/read_rnd_buffer_size_basic.test @@ -0,0 +1,209 @@ +############## mysql-test\t\read_rnd_buffer_size_basic.test ############### +# # +# Variable Name: read_rnd_buffer_size # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:262144 # +# Range: 8200-4294967295 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable read_rnd_buffer_size # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +###################################################################### +# START OF read_rnd_buffer_size TESTS # +###################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.read_rnd_buffer_size; +SELECT @start_global_value; +SET @start_session_value = @@session.read_rnd_buffer_size; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_140_01-------------------------#' +###################################################################### +# Display the DEFAULT value of read_rnd_buffer_size # +###################################################################### + +SET @@global.read_rnd_buffer_size = 1000; +SET @@global.read_rnd_buffer_size = DEFAULT; +SELECT @@global.read_rnd_buffer_size; + +SET @@session.read_rnd_buffer_size = 2000; +SET @@session.read_rnd_buffer_size = DEFAULT; +SELECT @@session.read_rnd_buffer_size; + + +--echo '#--------------------FN_DYNVARS_140_02-------------------------#' +###################################################################### +# Check the DEFAULT value of read_rnd_buffer_size # +###################################################################### + +SET @@global.read_rnd_buffer_size = DEFAULT; +SELECT @@global.read_rnd_buffer_size = 262144; + +SET @@session.read_rnd_buffer_size = DEFAULT; +SELECT @@session.read_rnd_buffer_size = 262144; +--echo 'Bug# 34876: This variable has invalid default value as compared to documentation'; + + +--echo '#--------------------FN_DYNVARS_140_03-------------------------#' +################################################################################ +# Change the value of read_rnd_buffer_size to a valid value for GLOBAL Scope # +################################################################################ + +SET @@global.read_rnd_buffer_size = 8201; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; +SET @@global.read_rnd_buffer_size = 8200; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; +SET @@global.read_rnd_buffer_size = 2147479552; +SELECT @@global.read_rnd_buffer_size; +SET @@global.read_rnd_buffer_size = 2147479551; +SELECT @@global.read_rnd_buffer_size; +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + + +--echo '#--------------------FN_DYNVARS_140_04-------------------------#' +################################################################################### +# Change the value of read_rnd_buffer_size to a valid value for SESSION Scope # +################################################################################### + +SET @@session.read_rnd_buffer_size = 8200; +SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228; +SET @@session.read_rnd_buffer_size = 8201; +SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228; +SET @@session.read_rnd_buffer_size = 2147479552; +SELECT @@session.read_rnd_buffer_size; +SET @@session.read_rnd_buffer_size = 2147479551; +SELECT @@session.read_rnd_buffer_size; + + +--echo '#------------------FN_DYNVARS_140_05-----------------------#' +################################################################## +# Change the value of read_rnd_buffer_size to an invalid value # +################################################################## + +SET @@global.read_rnd_buffer_size = 8199; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; +SET @@global.read_rnd_buffer_size = -1024; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; +SET @@global.read_rnd_buffer_size = 2147479553; +SELECT @@global.read_rnd_buffer_size; +--Error ER_PARSE_ERROR +SET @@global.read_rnd_buffer_size = 65530.34.; +SELECT @@global.read_rnd_buffer_size; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.read_rnd_buffer_size = test; +SELECT @@global.read_rnd_buffer_size; + +SET @@session.read_rnd_buffer_size = 8199; +SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228; +SET @@session.read_rnd_buffer_size = -2; +SELECT @@session.read_rnd_buffer_size= 8200 OR @@session.read_rnd_buffer_size= 8228; +--Error ER_PARSE_ERROR +SET @@session.read_rnd_buffer_size = 65530.34.; +SET @@session.read_rnd_buffer_size = 2147479553; +SELECT @@session.read_rnd_buffer_size; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.read_rnd_buffer_size = test; +SELECT @@session.read_rnd_buffer_size; + + +--echo '#------------------FN_DYNVARS_140_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.read_rnd_buffer_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='read_rnd_buffer_size'; + +--echo '#------------------FN_DYNVARS_140_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.read_rnd_buffer_size = +VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='read_rnd_buffer_size'; + + +--echo '#------------------FN_DYNVARS_140_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.read_rnd_buffer_size = TRUE; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; +SET @@global.read_rnd_buffer_size = FALSE; +SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 8228; + + +--echo '#---------------------FN_DYNVARS_140_09----------------------#' +#################################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +#################################################################################### + +SET @@global.read_rnd_buffer_size = 9000; +SELECT @@read_rnd_buffer_size = @@global.read_rnd_buffer_size; + + +--echo '#---------------------FN_DYNVARS_140_10----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@read_rnd_buffer_size = 9000; +SELECT @@read_rnd_buffer_size = @@local.read_rnd_buffer_size; +SELECT @@local.read_rnd_buffer_size = @@session.read_rnd_buffer_size; + + +--echo '#---------------------FN_DYNVARS_140_11----------------------#' +################################################################################### +# Check if read_rnd_buffer_size can be accessed with and without @@ sign # +################################################################################### + +SET read_rnd_buffer_size = 9100; +SELECT @@read_rnd_buffer_size= 8200 OR @@read_rnd_buffer_size= 8228; +--Error ER_UNKNOWN_TABLE +SELECT local.read_rnd_buffer_size; +--Error ER_UNKNOWN_TABLE +SELECT session.read_rnd_buffer_size; +--Error ER_BAD_FIELD_ERROR +SELECT read_rnd_buffer_size = @@session.read_rnd_buffer_size; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.read_rnd_buffer_size = @start_global_value; +SELECT @@global.read_rnd_buffer_size; +SET @@session.read_rnd_buffer_size = @start_session_value; +SELECT @@session.read_rnd_buffer_size; + + +############################################################# +# END OF read_rnd_buffer_size TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test new file mode 100644 index 00000000000..7e4d6a51440 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test @@ -0,0 +1,164 @@ +############## mysql-test\t\relay_log_purge_basic.test ######################## +# # +# Variable Name: relay_log_purge # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: TRUE # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable relay_log_purge # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_relay_log_purge # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc + +##################################################################### +# START OF relay_log_purge TESTS # +##################################################################### + + +####################################################################### +# Saving initial value of relay_log_purge in a temporary variable # +####################################################################### + +SET @start_value = @@global.relay_log_purge; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_141_01------------------------#' +############################################################# +# Display the DEFAULT value of relay_log_purge # +############################################################# + +SET @@global.relay_log_purge = FALSE; +SET @@global.relay_log_purge = DEFAULT; +SELECT @@global.relay_log_purge; + + +--echo '#---------------------FN_DYNVARS_141_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.relay_log_purge = @start_value; +SELECT @@global.relay_log_purge = TRUE; + + +--echo '#--------------------FN_DYNVARS_141_03------------------------#' +############################################################# +# Change the value of relay_log_purge to a valid value # +############################################################# + +SET @@global.relay_log_purge = ON; +SELECT @@global.relay_log_purge; +SET @@global.relay_log_purge = OFF; +SELECT @@global.relay_log_purge; +SET @@global.relay_log_purge = 0; +SELECT @@global.relay_log_purge; +SET @@global.relay_log_purge = 1; +SELECT @@global.relay_log_purge; +SET @@global.relay_log_purge = TRUE; +SELECT @@global.relay_log_purge; +SET @@global.relay_log_purge = FALSE; +SELECT @@global.relay_log_purge; + +--echo '#--------------------FN_DYNVARS_141_04-------------------------#' +########################################################################### +# Change the value of relay_log_purge to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.relay_log_purge = ''; + + +--echo '#-------------------FN_DYNVARS_141_05----------------------------#' +########################################################################### +# Test if accessing session relay_log_purge gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.relay_log_purge = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.relay_log_purge; + + +--echo '#----------------------FN_DYNVARS_141_06------------------------#' +##################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +##################################################################### + +SELECT @@global.relay_log_purge = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='relay_log_purge'; + +--echo '#---------------------FN_DYNVARS_141_07----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same session variable # +############################################################################### + +SET @@global.relay_log_purge = 1; +SELECT @@relay_log_purge = @@global.relay_log_purge; + + +--echo '#---------------------FN_DYNVARS_141_08----------------------#' +########################################################################## +# Check if relay_log_purge can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET relay_log_purge = 1; +--Error ER_PARSE_ERROR +SET global.relay_log_purge = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.relay_log_purge; +--Error ER_BAD_FIELD_ERROR +SELECT relay_log_purge = @@session.relay_log_purge; + + +############################## +# Restore initial value # +############################## + +SET @@global.relay_log_purge = @start_value; +SELECT @@global.relay_log_purge; + + +############################################################# +# END OF relay_log_purge TESTS # +############################################################# diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test new file mode 100644 index 00000000000..f17cc1289b1 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test @@ -0,0 +1,102 @@ +###################### mysql-test\t\init_slave_func.test ##################### +# # +# Variable Name: init_slave # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-03-08 # +# Author: Rizwan # +# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and # +# SQL-Satements to control master and slave, # +# deleted the sleep and made improvements like: # +# - Replaced the opt file by dynamic variables, # +# - Made the tests independant of the initial # +# values of the global variables, # +# - Reduced the test to the needed test case to # +# save run time, # +# - Beautification. # +# # +# Description: Test Cases of Dynamic System Variable init_slave # +# that checks the behavior of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +source include/master-slave.inc; +--echo connection slave +connection slave; +# +# save the current values + +SET @start_max_connections= @@global.max_connections; +SET @start_init_slave= @@global.init_slave; + +# setting of a global value with an effect on the next start of the slave server +# check that @@global.init_slave could be set +let $my_init_slave= + 'SET @@global.max_connections = @@global.max_connections + 1'; +eval SET @@global.init_slave = $my_init_slave; + +# show the data type of the variable +--disable_warnings +DROP TABLE IF EXISTS t1; +CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; +--enable_warnings +DESCRIBE t1; +DROP TABLE t1; +# +# check that the new setting of @@global.init_slave becomes immediately visible +eval SELECT @@global.init_slave = $my_init_slave; +--echo Expect 1 +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections; +--source include/wait_condition_sp.inc +# check that the action in init_slave does not happen immediately +SELECT @@global.max_connections= @start_max_connections; +--echo Expect 1 +# +# reset of the server +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# +# wait for the slave threads have set the global variable. +let $wait_timeout= 90; +let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1; +--source include/wait_condition_sp.inc +# check that the action in init_slave was executed and had the intended effect +SELECT @@global.max_connections = @start_max_connections + 1; +--echo Expect 1 +# +# Setting a variable(which is local to a session) and must not be visible +SET @@global.init_slave = "SET @a=5"; +# +STOP SLAVE; +--wait_for_slave_to_stop +RESET MASTER; +RESET SLAVE; +START SLAVE; +source include/wait_for_slave_to_start.inc; +# +SHOW VARIABLES LIKE 'init_slave'; +# expect NULL +SELECT @a; +--echo Expect NULL +# +# Clean up +SET @@global.max_connections= @start_max_connections; +SET @@global.init_slave= @start_init_slave; +################################################## +# End of functionality Testing for init_slave # +################################################## + diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt new file mode 100644 index 00000000000..bff213dfb0b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func-master.opt @@ -0,0 +1,2 @@ +--log --log-bin=mylog.log + diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test new file mode 100644 index 00000000000..c00db582deb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test @@ -0,0 +1,44 @@ +source include/have_log_bin.inc; + +############################################################################### +# Begin the functionality testing of max_binlog_size # +############################################################################### +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + + +#============================================================== +--echo '--- check if log file is rotated after 4096 bytes ----' +#============================================================== + +SET @saved_max_binlog_size= @@global.max_binlog_size; +SET @@global.max_binlog_size = 4096; +CREATE TABLE t1(a CHAR(5)); + +# around 50 records are required to rotate bin log +let $a = 50; +--disable_query_log +while ($a){ +INSERT INTO t1 VALUES ('mysql'); +dec $a; +} +--enable_query_log + +--sleep 2 + +# if log file is not created then this will fail +let $MYSQLD_DATADIR=`select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/mylog.000002 + +--echo 'mylog.000002 exists' + +SET @@global.max_binlog_size= @saved_max_binlog_size; + +DROP TABLE t1; + +############################################################################### +# End of functionality testing for max_binlog_size # +############################################################################### + diff --git a/mysql-test/suite/sys_vars/t/secure_auth_basic.test b/mysql-test/suite/sys_vars/t/secure_auth_basic.test new file mode 100644 index 00000000000..b52f219097b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/secure_auth_basic.test @@ -0,0 +1,170 @@ +################ mysql-test\t\secure_auth_basic.test ########################## +# # +# Variable Name: secure_auth # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Valid Values: TRUE, FALSE # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable secure_auth # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF secure_auth TESTS # +######################################################################## + + +############################################################################### +# Saving initial value of secure_auth in a temporary variable # +############################################################################### + +SET @global_start_value = @@global.secure_auth; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_143_01------------------------#' +######################################################################## +# Display the DEFAULT value of secure_auth # +######################################################################## + +SET @@global.secure_auth = 1; +SET @@global.secure_auth = DEFAULT; +SELECT @@global.secure_auth; + +--echo '#---------------------FN_DYNVARS_143_02-------------------------#' +############################################################################# +# Check if secure_auth can be accessed with and without @@ sign # +############################################################################# + +--Error ER_GLOBAL_VARIABLE +SET secure_auth = 1; +SELECT @@secure_auth; +--Error ER_UNKNOWN_TABLE +SELECT global.secure_auth; + +SET global secure_auth = 1; +SELECT @@global.secure_auth; + + +--echo '#--------------------FN_DYNVARS_143_03------------------------#' +######################################################################## +# Change the value of secure_auth to a valid value # +######################################################################## + +SET @@global.secure_auth = 0; +SELECT @@global.secure_auth; +SET @@global.secure_auth = 1; +SELECT @@global.secure_auth; + + +--echo '#--------------------FN_DYNVARS_143_04-------------------------#' +########################################################################### +# Change the value of secure_auth to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = YES; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = OOF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = ' 1'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.secure_auth = NO; + + +--echo '#-------------------FN_DYNVARS_143_05----------------------------#' +########################################################################### +# Test if accessing session secure_auth gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.secure_auth = 0; +--Error ER_GLOBAL_VARIABLE +SET @@secure_auth = 0; +--Error ER_GLOBAL_VARIABLE +SET @@local.secure_auth = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.secure_auth; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.secure_auth; + +--echo '#----------------------FN_DYNVARS_143_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='secure_auth'; + + +--echo '#----------------------FN_DYNVARS_143_07------------------------#' +######################################################################## +# Check if the value in GLOBAL Table matches value in variable # +######################################################################## + +SELECT @@global.secure_auth = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='secure_auth'; +SELECT @@global.secure_auth; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='secure_auth'; + +--echo '#---------------------FN_DYNVARS_143_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@global.secure_auth = OFF; +SELECT @@global.secure_auth; +SET @@global.secure_auth = ON; +SELECT @@global.secure_auth; + +--echo '#---------------------FN_DYNVARS_143_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.secure_auth = TRUE; +SELECT @@global.secure_auth; +SET @@global.secure_auth = FALSE; +SELECT @@global.secure_auth; + +############################## +# Restore initial value # +############################## + +SET @@global.secure_auth = @global_start_value; +SELECT @@global.secure_auth; + +############################################################### +# END OF secure_auth TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt new file mode 100644 index 00000000000..38ba956df15 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/secure_auth_func-master.opt @@ -0,0 +1,2 @@ +--secure-auth + diff --git a/mysql-test/suite/sys_vars/t/secure_auth_func.test b/mysql-test/suite/sys_vars/t/secure_auth_func.test new file mode 100644 index 00000000000..10dc383035d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/secure_auth_func.test @@ -0,0 +1,132 @@ +############# mysql-test\t\secure_auth_func.test ########################## +# # +# Variable Name: secure_auth # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Values: TRUE / 1, FALSE / 0 # +# # +# # +# Creation Date: 2008-02-22 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "secure_auth " # +# that checks behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Cache behaviors # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_secure_auth # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +--source include/not_embedded.inc + +# +# Save initial value +# + +SET @old_secure_auth = @@GLOBAL.secure_auth; + +--echo '#--------------------FN_DYNVARS_144_01-------------------------#' +# +# Testing command line option value +# + +SELECT @@GLOBAL.secure_auth; +--echo 1 / ON Expected + +--echo '#--------------------FN_DYNVARS_144_02-------------------------#' +# +# Value OFF +# +SET GLOBAL secure_auth = OFF; + +# +# Creating user with password in NEW format +# +CREATE USER 'testUser'@'localhost' IDENTIFIED BY 'newpass'; + +--echo ** Connecting con_user1 using testUser ** +connect (con_user1,localhost,testUser,newpass,); + +--echo ** Connection default** +connection default; + +# +# Setting password in OLD format +# +SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass'); + +--echo ** Connecting con_user2 using testUser ** +connect (con_user2,localhost,testUser,newpass,); + +--echo ** Connection default** +connection default; + +--echo '#--------------------FN_DYNVARS_144_03-------------------------#' +# +# Value ON +# +SET GLOBAL secure_auth = ON; + +# +# Setting password in NEW format +# +SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass'); + +--echo ** Connecting con_user3 using testUser ** +connect (con_user3,localhost,testUser,newpass,); +--echo ** Connection default ** +connection default; + +# +# Setting password in OLD format +# +SET PASSWORD FOR 'testUser'@'localhost' = OLD_PASSWORD('newpass'); + +--echo ** Connecting con_user4 using testUser ** +--disable_query_log +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE +connect (con_user4,localhost,testUser,newpass,); +--enable_query_log +--echo Expected error "Server is in secure auth mode" + +--echo ** Connection default** +connection default; + +# +# Setting password back in NEW format +# +SET PASSWORD FOR 'testUser'@'localhost' = PASSWORD('newpass'); + +--echo ** Connecting con_user4 using testUser ** +connect (con_user4,localhost,testUser,newpass,); + +--echo ** Connection default ** +connection default; + +# +# Cleanup +# + +SET GLOBAL secure_auth = @old_secure_auth; + +--echo Disconnecting Connections con_user1, con_user2, con_user3, con_user4 +disconnect con_user1; +disconnect con_user2; +disconnect con_user3; +disconnect con_user4; + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testUser'@'localhost'; + +DROP USER 'testUser'@'localhost'; diff --git a/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test new file mode 100644 index 00000000000..cf31917933a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test @@ -0,0 +1,167 @@ +############## mysql-test\t\slave_allow_batching_basic.test #################### +# # +# Variable Name: slave_allow_batching # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable slave_allow_batching # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +################################################################################ + +--source include/load_sysvars.inc + +######################################################################## +# START OF slave_allow_batching TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of slave_allow_batching in a temporary variable # +################################################################################ + +--Error ER_UNKNOWN_SYSTEM_VARIABLE +SET @global_start_value = @@global.slave_allow_batching; + +--echo 'Bug: This variable is not supported in mysql version 5.1.22' + +--echo '#--------------------FN_DYNVARS_145_01------------------------#' +######################################################################## +# Display the DEFAULT value of slave_allow_batching # +######################################################################## + +#SET @@global.slave_allow_batching = 1; +#SET @@global.slave_allow_batching = DEFAULT; +#SELECT @@global.slave_allow_batching; + +--echo '#---------------------FN_DYNVARS_145_02-------------------------#' +############################################################################# +# Check if slave_allow_batching can be accessed with and without @@ sign # +############################################################################# + +#--Error ER_GLOBAL_VARIABLE +#SET slave_allow_batching = 1; +#SELECT @@slave_allow_batching; +#--Error ER_UNKNOWN_TABLE +#SELECT global.slave_allow_batching; +# +#SET global slave_allow_batching = 1; +#SELECT @@global.slave_allow_batching; + + +--echo '#--------------------FN_DYNVARS_145_03------------------------#' +######################################################################## +# Change the value of slave_allow_batching to a valid value # +######################################################################## + +#SET @@global.slave_allow_batching = 0; +#SELECT @@global.slave_allow_batching; +#SET @@global.slave_allow_batching = 1; +#SELECT @@global.slave_allow_batching; + + +--echo '#--------------------FN_DYNVARS_145_04-------------------------#' +########################################################################### +# Change the value of slave_allow_batching to invalid value # +########################################################################### + +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = -1; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = 2; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = "T"; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = "Y"; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = YES; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = ONN; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = OOF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = 0FF; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = ' 1'; +#--Error ER_WRONG_VALUE_FOR_VAR +#SET @@global.slave_allow_batching = NO; + + +--echo '#-------------------FN_DYNVARS_145_05----------------------------#' +########################################################################### +# Test if accessing session slave_allow_batching gives error # +########################################################################### + +#--Error ER_GLOBAL_VARIABLE +#SET @@session.slave_allow_batching = 0; +#--Error ER_GLOBAL_VARIABLE +#SET @@slave_allow_batching = 0; +#--Error ER_GLOBAL_VARIABLE +#SET @@local.slave_allow_batching = 0; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@session.slave_allow_batching; +#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +#SELECT @@local.slave_allow_batching; + +--echo '#----------------------FN_DYNVARS_145_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +#SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; + + +--echo '#----------------------FN_DYNVARS_145_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +#SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; +#SELECT @@global.slave_allow_batching; +#SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; +#--echo 'Bug: value in information schema does not match' + +--echo '#---------------------FN_DYNVARS_145_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +#SET @@global.slave_allow_batching = OFF; +#SELECT @@global.slave_allow_batching; +#SET @@global.slave_allow_batching = ON; +#SELECT @@global.slave_allow_batching; + +--echo '#---------------------FN_DYNVARS_145_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +#SET @@global.slave_allow_batching = TRUE; +#SELECT @@global.slave_allow_batching; +#SET @@global.slave_allow_batching = FALSE; +#SELECT @@global.slave_allow_batching; + +############################## +# Restore initial value # +############################## + +#SET @@global.slave_allow_batching = @global_start_value; +#SELECT @@global.slave_allow_batching; + +############################################################### +# END OF slave_allow_batching TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test new file mode 100644 index 00000000000..29a3227a8f5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test @@ -0,0 +1,167 @@ +############# mysql-test\t\slave_compressed_protocol_basic.test ############### +# # +# Variable Name: slave_compressed_protocol # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: FALSE # +# Range: TRUE, FALSE # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable slave_compressed_protocol# +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc +######################################################################## +# START OF slave_compressed_protocol TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of slave_compressed_protocol in a temporary variable # +############################################################################## + +SET @global_start_value = @@global.slave_compressed_protocol; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_147_01------------------------#' +######################################################################## +# Display the DEFAULT value of slave_compressed_protocol # +######################################################################## + +SET @@global.slave_compressed_protocol = 1; +SET @@global.slave_compressed_protocol = DEFAULT; +SELECT @@global.slave_compressed_protocol; + +--echo '#---------------------FN_DYNVARS_147_02-------------------------#' +############################################################################### +# Check if slave_compressed_protocol can be accessed with and without @@ sign # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET slave_compressed_protocol = 1; +SELECT @@slave_compressed_protocol; +--Error ER_UNKNOWN_TABLE +SELECT global.slave_compressed_protocol; + +SET global slave_compressed_protocol = 1; +SELECT @@global.slave_compressed_protocol; + + +--echo '#--------------------FN_DYNVARS_147_03------------------------#' +######################################################################## +# Change the value of slave_compressed_protocol to a valid value # +######################################################################## + +SET @@global.slave_compressed_protocol = 0; +SELECT @@global.slave_compressed_protocol; +SET @@global.slave_compressed_protocol = 1; +SELECT @@global.slave_compressed_protocol; + + +--echo '#--------------------FN_DYNVARS_147_04-------------------------#' +########################################################################### +# Change the value of slave_compressed_protocol to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = "1.00"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = YES; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = ' 1'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slave_compressed_protocol = NO; + + +--echo '#-------------------FN_DYNVARS_147_05----------------------------#' +########################################################################### +# Test if accessing session slave_compressed_protocol gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.slave_compressed_protocol = 0; +--Error ER_GLOBAL_VARIABLE +SET @@slave_compressed_protocol = 0; +--Error ER_GLOBAL_VARIABLE +SET @@local.slave_compressed_protocol = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.slave_compressed_protocol; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.slave_compressed_protocol; + +--echo '#----------------------FN_DYNVARS_147_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_compressed_protocol'; + +--echo '#----------------------FN_DYNVARS_147_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_compressed_protocol'; +SELECT @@global.slave_compressed_protocol; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_compressed_protocol'; + +--echo '#---------------------FN_DYNVARS_147_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@global.slave_compressed_protocol = OFF; +SELECT @@global.slave_compressed_protocol; +SET @@global.slave_compressed_protocol = ON; +SELECT @@global.slave_compressed_protocol; + +--echo '#---------------------FN_DYNVARS_147_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.slave_compressed_protocol = TRUE; +SELECT @@global.slave_compressed_protocol; +SET @@global.slave_compressed_protocol = FALSE; +SELECT @@global.slave_compressed_protocol; + +############################## +# Restore initial value # +############################## + +SET @@global.slave_compressed_protocol = @global_start_value; +SELECT @@global.slave_compressed_protocol; + +############################################################### +# END OF slave_compressed_protocol TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test new file mode 100644 index 00000000000..5c5b4e7da1b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_exec_mode_basic.test @@ -0,0 +1,41 @@ +############## mysql-test\t\slave_exec_mode_basic.test ######################### +# # +# Variable Name: slave_exec_mode # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 1 # +# Range: 1 - 65536 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan Maredia # +# # +# Description: Test Cases of Dynamic System Variable slave_exec_mode # +# that checks the behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +################################################################################ + +--source include/load_sysvars.inc + +######################################################################## +# START OF slave_exec_mode TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of slave_exec_mode in a temporary variable # +######################################################################## +SET @start_value = @@global.slave_exec_mode; +--echo 'This variable is not supported in version 5.1.22. It is introduced in 5.1.24' + +######################################################################## +# END OF slave_exec_mode TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test new file mode 100644 index 00000000000..5662eec3957 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slave_net_timeout_basic.test @@ -0,0 +1,187 @@ +################## mysql-test\t\slave_net_timeout_basic.test ################## +# # +# Variable Name: slave_net_timeout # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 3600 # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable slave_net_timeout # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc +########################################################### +# START OF slave_net_timeout TESTS # +########################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.slave_net_timeout; +SELECT @start_global_value; + +--echo '#--------------------FN_DYNVARS_146_01-------------------------#' +########################################################### +# Display the DEFAULT value of slave_net_timeout # +########################################################### + +SET @@global.slave_net_timeout = 500000; +SET @@global.slave_net_timeout = DEFAULT; +SELECT @@global.slave_net_timeout; + +--echo '#--------------------FN_DYNVARS_146_02-------------------------#' +############################################################ +# Check the DEFAULT value of slave_net_timeout # +############################################################ + +SET @@global.slave_net_timeout = DEFAULT; +SELECT @@global.slave_net_timeout = 3600; + +--echo '#--------------------FN_DYNVARS_146_03-------------------------#' +########################################################################### +# Change the value of slave_net_timeout to a valid value for GLOBAL Scope # +########################################################################### + +SET @@global.slave_net_timeout = 0; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 1; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 15; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 1024; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 3600+1; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 2147483648; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = 2147483648*2-1; +SELECT @@global.slave_net_timeout; + + +--echo '#--------------------FN_DYNVARS_146_04-------------------------#' +############################################################################### +# Check if variable can be access with session scope # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@slave_net_timeout = 2; + +--Error ER_GLOBAL_VARIABLE +SET @@session.slave_net_timeout = 3; + +--Error ER_GLOBAL_VARIABLE +SET @@local.slave_net_timeout = 4; + + + +--echo '#------------------FN_DYNVARS_146_05-----------------------#' +############################################################# +# Change the value of slave_net_timeout to an invalid value # +############################################################# + +SET @@global.slave_net_timeout = -1; +SELECT @@global.slave_net_timeout; + +SET @@global.slave_net_timeout = -2147483648; +SELECT @@global.slave_net_timeout; + +SET @@global.slave_net_timeout = 2147483649*2; +SELECT @@global.slave_net_timeout; + +--Error ER_PARSE_ERROR +SET @@global.slave_net_timeout = 65530.34.; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_net_timeout = 100s; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_net_timeout = 7483649.56; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slave_net_timeout = 0.6; + +--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values'; + + +--echo '#------------------FN_DYNVARS_146_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + +SET @@global.slave_net_timeout = 3000; +SELECT @@global.slave_net_timeout = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slave_net_timeout'; + + +--echo '#------------------FN_DYNVARS_146_07-----------------------#' +########################################################################### +# Check if the value is present in INFORMATION_SCHEMA.SESSION_VARIABLES # +########################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slave_net_timeout'; + + +--echo '#------------------FN_DYNVARS_146_08-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +SET @@global.slave_net_timeout = TRUE; +SELECT @@global.slave_net_timeout; +SET @@global.slave_net_timeout = FALSE; +SELECT @@global.slave_net_timeout; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +############################################################################### +# Check if accessing variable with and without GLOBAL point to same variable # +############################################################################### + + +SET @@global.slave_net_timeout = 60*60; +SELECT @@slave_net_timeout = @@global.slave_net_timeout; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +########################################################################## +# Check if slave_net_timeout can be accessed without @@ sign and scope # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET slave_net_timeout = 2048; +--Error ER_BAD_FIELD_ERROR +SELECT slave_net_timeout; + +SELECT @@slave_net_timeout; + +#verifying another another syntax for setting value +SET global slave_net_timeout = 99; + +#################################### +# Restore initial value # +#################################### + +SET @@global.slave_net_timeout = @start_global_value; +SELECT @@global.slave_net_timeout; + +################################################ +# END OF slave_net_timeout TESTS # +################################################ + diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test b/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test new file mode 100644 index 00000000000..6289a91abb3 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_basic.test @@ -0,0 +1,177 @@ +############## mysql-test\t\slow_launch_time_basic.test ############### +# # +# Variable Name: slow_launch_time # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 2 # +# Range: - # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable slow_launch_time # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF slow_launch_time TESTS # +######################################################################## + + +######################################################################## +# Saving initial value of slow_launch_time in a temporary variable # +######################################################################## + +SET @start_value = @@global.slow_launch_time; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_150_01------------------------#' +######################################################################## +# Display the DEFAULT value of slow_launch_time # +######################################################################## + +SET @@global.slow_launch_time = 99; +SET @@global.slow_launch_time = DEFAULT; +SELECT @@global.slow_launch_time; + + +--echo '#---------------------FN_DYNVARS_150_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.slow_launch_time = @start_value; +SELECT @@global.slow_launch_time = 2; + + +--echo '#--------------------FN_DYNVARS_150_03------------------------#' +######################################################################## +# Change the value of slow_launch_time to a valid value # +######################################################################## + +SET @@global.slow_launch_time = 0; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 1; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 31536000; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 31535999; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 65536; +SELECT @@global.slow_launch_time; + +--echo '#--------------------FN_DYNVARS_150_04-------------------------#' +########################################################################### +# Change the value of slow_launch_time to invalid value # +########################################################################### + +SET @@global.slow_launch_time = -1; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 31536001; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 10240022115; +SELECT @@global.slow_launch_time; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slow_launch_time = 10000.01; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = -1024; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = 42949672950; +SELECT @@global.slow_launch_time; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slow_launch_time = ON; +SELECT @@global.slow_launch_time; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.slow_launch_time = 'test'; +SELECT @@global.slow_launch_time; + + +--echo '#-------------------FN_DYNVARS_150_05----------------------------#' +########################################################################### +# Test if accessing session slow_launch_time gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.slow_launch_time = 0; +SELECT @@slow_launch_time; + + +--echo '#----------------------FN_DYNVARS_150_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.slow_launch_time = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slow_launch_time'; + +SELECT @@slow_launch_time = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='slow_launch_time'; + + +--echo '#---------------------FN_DYNVARS_150_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.slow_launch_time = TRUE; +SELECT @@global.slow_launch_time; +SET @@global.slow_launch_time = FALSE; +SELECT @@global.slow_launch_time; + + +--echo '#---------------------FN_DYNVARS_150_08----------------------#' +######################################################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable # +######################################################################################################## + +SET @@global.slow_launch_time = 1; +SELECT @@slow_launch_time = @@global.slow_launch_time; + + +--echo '#---------------------FN_DYNVARS_150_09----------------------#' +########################################################################## +# Check if slow_launch_time can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET slow_launch_time = 1; +SELECT @@slow_launch_time; +--Error ER_PARSE_ERROR +SET local.slow_launch_time = 1; +--Error ER_UNKNOWN_TABLE +SELECT local.slow_launch_time; +--Error ER_PARSE_ERROR +SET global.slow_launch_time = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.slow_launch_time; +--Error ER_BAD_FIELD_ERROR +SELECT slow_launch_time = @@session.slow_launch_time; + + +############################## +# Restore initial value # +############################## + +SET @@global.slow_launch_time = @start_value; +SELECT @@global.slow_launch_time; + + +######################################################################## +# END OF slow_launch_time TESTS # +######################################################################## diff --git a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test new file mode 100644 index 00000000000..c9a7d28bb8a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test @@ -0,0 +1,104 @@ +############# mysql-test\t\slow_launch_time_func.test ########################## +# # +# Variable Name: slow_launch_time # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 2 # +# Values: - # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Last change: 2008-09-09 mleich Reimplementation of this test # +# - Fix Bug#36874 : main.slow_launch_time_func test fails # +# randomly # +# - Fix other failures and streamline the test # +# # +# Description: Test Cases of Dynamic System Variable "slow_launch_time " # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# option_mysqld_slow_launch_time # +# # +################################################################################ + +# +# Setup +# + +--source include/not_embedded.inc + +SET @global_slow_launch_time = @@GLOBAL.slow_launch_time; + +--echo ** Connection default ** +connection default; + +--echo '#--------------------FN_DYNVARS_124_01-------------------------#' + +######################################################################## +# Reveal that a new connect gets counted as "slow launched thread" if # +# @@GLOBAL.slow_launch_time = 0. # +# The value of slow_launch_threads must be increased by 1. # +######################################################################## + +SET @@GLOBAL.slow_launch_time=0; +SELECT @@GLOBAL.slow_launch_time; + +let $value_before= + query_get_value(show status like 'slow_launch_threads', Value, 1); +--echo ** Connecting conn1 using username 'root' ** +CONNECT (conn1,localhost,root,,); +let $value_after= + query_get_value(show status like 'slow_launch_threads', Value, 1); +if (!`SELECT $value_after = $value_before + 1`) +{ + --echo ERROR: Subtest FN_DYNVARS_124_01 failed + --echo A new connect should be counted as 'slow_launch_thread' if + --echo @@GLOBAL.slow_launch_time=0 + SELECT @@GLOBAL.slow_launch_time; + echo Number of slow_launch_threads before new connect: $value_before; + echo Number of slow_launch_threads after new connect: $value_after; +} +--echo ** Switch to connection default and disconnect conn1 ** +connection default; +disconnect conn1; + +--echo '#--------------------FN_DYNVARS_124_02-------------------------#' + +######################################################################## +# Reveal that a new connect gets not counted as "slow launched thread" # +# if @@GLOBAL.slow_launch_time is sufficient big. # +# The value of slow_launch_threads must not change. # +######################################################################## + +SET @@GLOBAL.slow_launch_time= 1000; +SELECT @@GLOBAL.slow_launch_time; + +let $value_before= + query_get_value(show status like 'slow_launch_threads', Value, 1); +--echo ** Connecting conn2 using username 'root' ** +CONNECT (conn2,localhost,root,,); +let $value_after= + query_get_value(show status like 'slow_launch_threads', Value, 1); +if (!`SELECT $value_after = $value_before`) +{ + --echo ERROR: Subtest FN_DYNVARS_124_02 failed + --echo A new connect must not be counted as 'slow_launch_thread' if + --echo @@GLOBAL.slow_launch_time is sufficient big. + SELECT @@GLOBAL.slow_launch_time; + echo Number of slow_launch_threads before new connect: $value_before; + echo Number of slow_launch_threads after new connect: $value_after; +} + +# +# Cleanup +# + +--echo ** Switch to connection default and disconnect conn2 ** +connection default; +disconnect conn2; +SET @@GLOBAL.slow_launch_time = @global_slow_launch_time; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test new file mode 100644 index 00000000000..3a1b2fbd9e7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test @@ -0,0 +1,170 @@ +##################### mysql-test\t\slow_query_log_basic.test ################### +# # +# Variable Name: slow_query_log # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-03-16 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "slow_query_log" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-options.html#option_mysqld_event-scheduler # +# # +################################################################################ + +--source include/load_sysvars.inc + +########################################################### +# START OF slow_query_log TESTS # +########################################################### + + +###################################################################### +# Saving initial value of slow_query_log in a temporary variable # +###################################################################### + +SET @start_value = @@global.slow_query_log; +SELECT @start_value; + + +--echo '#---------------------FN_DYNVARS_004_01-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.slow_query_log = DEFAULT; +SELECT @@global.slow_query_log = 0; + + +--echo '#--------------------FN_DYNVARS_004_02------------------------#' +###################################################################### +# Change the value of slow_query_log to a valid value # +###################################################################### + +SET @@global.slow_query_log = ON; +SELECT @@global.slow_query_log; +SET @@global.slow_query_log = OFF; +SELECT @@global.slow_query_log; + +--echo '#--------------------FN_DYNVARS_004_03-------------------------#' +###################################################################### +# Change the value of slow_query_log to invalid value # +###################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.slow_query_log = ''; + + +--echo '#-------------------FN_DYNVARS_004_04----------------------------#' +################################################################## +# Test if accessing session slow_query_log gives error # +################################################################## + +--Error ER_GLOBAL_VARIABLE +SET @@session.slow_query_log = OFF; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.slow_query_log; + + +--echo '#----------------------FN_DYNVARS_004_05------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.slow_query_log = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slow_query_log'; + + +--echo '#---------------------FN_DYNVARS_004_06----------------------#' +################################################################ +# Check if 0 and 1 values can be used on variable # +################################################################ + +SET @@global.slow_query_log = 0; +SELECT @@global.slow_query_log; +SET @@global.slow_query_log = 1; +SELECT @@global.slow_query_log; + +--echo '#---------------------FN_DYNVARS_004_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.slow_query_log = TRUE; +SELECT @@global.slow_query_log; +SET @@global.slow_query_log = FALSE; +SELECT @@global.slow_query_log; + +--echo '#---------------------FN_DYNVARS_004_08----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points # +# to same session variable # +############################################################################## + +SET @@global.slow_query_log = ON; +SELECT @@slow_query_log = @@global.slow_query_log; + +--echo '#---------------------FN_DYNVARS_004_09----------------------#' +###################################################################### +# Check if slow_query_log can be accessed with and without @@ sign # +###################################################################### +--Error ER_GLOBAL_VARIABLE +SET slow_query_log = ON; +--Error ER_PARSE_ERROR +SET local.slow_query_log = OFF; +--Error ER_UNKNOWN_TABLE +SELECT local.slow_query_log; +--Error ER_PARSE_ERROR +SET global.slow_query_log = ON; +--Error ER_UNKNOWN_TABLE +SELECT global.slow_query_log; +--Error ER_BAD_FIELD_ERROR +SELECT slow_query_log = @@session.slow_query_log; + + + +############################## +# Restore initial value # +############################## + +SET @@global.slow_query_log = @start_value; +SELECT @@global.slow_query_log; + + +#################################################### +# END OF slow_query_log TESTS # +#################################################### diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt new file mode 100644 index 00000000000..aca191f7fea --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic-master.opt @@ -0,0 +1 @@ +--log-slow-queries=slowtest.log diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test new file mode 100644 index 00000000000..9125b686cad --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test @@ -0,0 +1,72 @@ +################### mysql-test\t\slow_query_log_file_basic.test ################ +# # +# Variable Name: slow_query_log_file # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Filename # +# Default Value: host_name-slow.log # +# Valid Values: # +# # +# # +# Creation Date: 2008-03-16 # +# Author: Salman Rawala # +# Modified: HHunger 2008-09-11 set system var back to start value # +# # +# Description: Test Cases of Dynamic System Variable "slow_query_log_file" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html +# # +################################################################################ + +--source include/load_sysvars.inc + +########################################################### +# START OF slow_query_log_file TESTS # +########################################################### + + +########################################################################### +# Saving initial value of slow_query_log_file in a temporary variable # +########################################################################### + +SET @start_value = @@global.slow_query_log_file; + +--echo '#---------------------FN_DYNVARS_004_01-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.slow_query_log_file = DEFAULT; +SELECT RIGHT(@@global.slow_query_log_file,15); + + +--echo '#--------------------FN_DYNVARS_004_02------------------------#' +####################################################################### +# Change the value of slow_query_log_file to a invalid value # +####################################################################### + +# Assumed text if no quotes or numbers. +SET @@global.slow_query_log_file = mytest.log; +--error ER_WRONG_TYPE_FOR_VAR +SET @@global.slow_query_log_file = 12; + +--echo '#----------------------FN_DYNVARS_004_03------------------------#' +############################################################################## +# Check if the value in GLOBAL Tables matches values in variable # +############################################################################## + +SELECT @@global.slow_query_log_file = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='slow_query_log_file'; + +SET @@global.slow_query_log_file= @start_value; +##################################################### +# END OF slow_query_log_file TESTS # +##################################################### + diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt new file mode 100644 index 00000000000..e5b1c0948b0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func-master.opt @@ -0,0 +1,2 @@ +--log-slow-queries=my_slow_test.log + diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test new file mode 100644 index 00000000000..32420fc294a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test @@ -0,0 +1,33 @@ +########### mysql-test\t\slow_query_log_file_func.test ######################### +# # +# Variable Name: slow_query_log_file # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Boolean # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-03-17 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "slow_query_log_file" # +# that checks functionality of this variable # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_slow_query_log_file # +# # +################################################################################ + + +--echo '#--------------------FN_DYNVARS_018_01-------------------------#' +#################################################################### +# Verifying log file after setting it in opt file # +#################################################################### + +let $MYSQLD_DATADIR= `select @@datadir`; +--echo ## Checking if my_slow_test.log exists in servers datadir ## +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--file_exists $MYSQLD_DATADIR/my_slow_test.log + +--echo ## This case should pass because we have set this filename in opt file ## diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test new file mode 100644 index 00000000000..9bcbeb14fd7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test @@ -0,0 +1,39 @@ + +# save +SET @global_slow_query_log = @@global.slow_query_log; +SET @global_log_output = @@global.log_output; +############################################################################### +# Begin the functionality testing for slow_query_log # +############################################################################### + +SET @@session.long_query_time=1; + +SET @@global.log_output = 'TABLE'; + +#========================================= +--echo '----When slow_query_log = OFF----' +#========================================= + +SET @@global.slow_query_log = OFF; +TRUNCATE mysql.slow_log; +SELECT sleep(2); + +SELECT count(*) FROM mysql.slow_log; + +#========================================= +--echo '----When slow_query_log = ON-----' +#========================================= + +SET @@global.slow_query_log = ON; +TRUNCATE mysql.slow_log; +SELECT sleep(2); + +SELECT count(*) FROM mysql.slow_log; + +#restore +SET @@global.log_output = @global_log_output; +SET @global.slow_query_log = @global_slow_query_log; + +############################################################################### +# End of the functionality test for slow_query_log # +############################################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test new file mode 100644 index 00000000000..a843b88bf85 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test @@ -0,0 +1,101 @@ + + +################## mysql-test\t\sql_auto_is_null_basic.test ################### +# # +# Variable Name: sql_auto_is_null # +# Scope: Session # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable sql_auto_is_null # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_044_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### + +SELECT COUNT(@@SESSION.sql_auto_is_null); +--echo 1 Expected + +--echo '#---------------------BS_STVARS_044_02----------------------#' +# +# Test case for Bug #35433 +# +#################################################################### +# Check if Value can set # +#################################################################### + + +#--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.sql_auto_is_null=1; +--ECHO "BUG:It should give error on setting this variable as it is readonly variable" +--echo Expected error 'Read only variable' + +SELECT COUNT(@@SESSION.sql_auto_is_null); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_044_03----------------------#' +################################################################# +# Check if the value in SESSION Table matches value in variable # +################################################################# + +SELECT @@SESSION.sql_auto_is_null = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_auto_is_null'; +--echo 1 Expected + +SELECT COUNT(@@SESSION.sql_auto_is_null); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_auto_is_null'; +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_044_04----------------------#' +################################################################################ +# Check if accessing variable with and without SESSION point to same variable # +################################################################################ +SELECT @@sql_auto_is_null = @@SESSION.sql_auto_is_null; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_044_05----------------------#' +################################################################################ +# Check if sql_auto_is_null can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@sql_auto_is_null); +--echo 1 Expected +SELECT COUNT(@@local.sql_auto_is_null); +--echo 1 Expected +SELECT COUNT(@@SESSION.sql_auto_is_null); +--echo 1 Expected + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@GLOBAL.sql_auto_is_null); +--echo Expected error 'Variable is a SESSION variable' + +--error ER_BAD_FIELD_ERROR +SELECT COUNT(sql_auto_is_null = @@GLOBAL.sql_auto_is_null); +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test new file mode 100644 index 00000000000..dd83a19230a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test @@ -0,0 +1,174 @@ +############## mysql-test\t\sql_big_selects_basic.test ######################## +# # +# Variable Name: sql_big_selects # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_big_selects # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF sql_big_selects TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of sql_big_selects in a temporary variable # +################################################################################ + +SET @session_start_value = @@session.sql_big_selects; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_153_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_big_selects # +######################################################################## + +SET @@session.sql_big_selects = 0; +SET @@session.sql_big_selects = DEFAULT; +SELECT @@session.sql_big_selects; + + +--echo '#---------------------FN_DYNVARS_153_02-------------------------#' +############################################################################# +# Check if sql_big_selects can be accessed with and without @@ sign # +############################################################################# + +SET sql_big_selects = 1; +SELECT @@sql_big_selects; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_big_selects; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_big_selects; + +SET session sql_big_selects = 0; +SELECT @@session.sql_big_selects; + + +--echo '#--------------------FN_DYNVARS_153_03------------------------#' +##################################################################### +# change the value of sql_big_selects to a valid value # +##################################################################### + +SET @@session.sql_big_selects = 0; +SELECT @@session.sql_big_selects; +SET @@session.sql_big_selects = 1; +SELECT @@session.sql_big_selects; + + +--echo '#--------------------FN_DYNVARS_153_04-------------------------#' +######################################################################## +# Change the value of sql_big_selects to invalid value # +######################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = ÕN; + +SET @@session.sql_big_selects = OF; +SELECT @@session.sql_big_selects; + +--echo 'Bug # 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_selects = NO; + + +--echo '#-------------------FN_DYNVARS_153_05----------------------------#' +######################################################################## +# Test if accessing global sql_big_selects gives error # +######################################################################## + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_big_selects = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_big_selects; + +--echo '#----------------------FN_DYNVARS_153_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_big_selects'; + +--echo '#----------------------FN_DYNVARS_153_07------------------------#' +######################################################################## +# Check if the value in GLOBAL Table matches value in variable # +######################################################################## + +SELECT @@session.sql_big_selects = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_big_selects'; +SELECT @@session.sql_big_selects; + +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_big_selects'; + +--echo '#---------------------FN_DYNVARS_153_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_big_selects = OFF; +SELECT @@session.sql_big_selects; +SET @@session.sql_big_selects = ON; +SELECT @@session.sql_big_selects; + +--echo '#---------------------FN_DYNVARS_153_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_big_selects = TRUE; +SELECT @@session.sql_big_selects; +SET @@session.sql_big_selects = FALSE; +SELECT @@session.sql_big_selects; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_big_selects = @session_start_value; +SELECT @@session.sql_big_selects; + +############################################################ +# END OF sql_big_selects TESTS # +############################################################ + diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_func.test b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test new file mode 100644 index 00000000000..4aefda5e15e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_big_selects_func.test @@ -0,0 +1,133 @@ +############# mysql-test\t\sql_big_selects_func.test ###################### +# # +# Variable Name: sql_big_selects # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_big_selects" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @session_sql_big_selects = @@SESSION.sql_big_selects; +SET @session_max_join_size = @@SESSION.max_join_size; +SET @global_max_join_size = @@GLOBAL.max_join_size; +SET SQL_MAX_JOIN_SIZE=9; + +# +# Create tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20) not null, b varchar(20)); +CREATE TEMPORARY TABLE t2(a varchar(20) null, b varchar(20)); + +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa1','bb'); +INSERT INTO t1 VALUES('aa2','bb'); +INSERT INTO t1 VALUES('aa3','bb'); +INSERT INTO t1 VALUES('aa4','bb'); + +INSERT INTO t2 VALUES('aa','bb'); +INSERT INTO t2 VALUES('aa1','bb'); +INSERT INTO t2 VALUES('aa2','bb'); +INSERT INTO t2 VALUES('aa3','bb'); +INSERT INTO t2 VALUES('aa4','bb'); + +--echo '#--------------------FN_DYNVARS_154_01-------------------------#' +# +# Testing fail condition +# + +--echo Expected error "Too big select" +--error ER_TOO_BIG_SELECT +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo Expected error The SELECT would examine more than MAX_JOIN_SIZE rows. + +--echo '#--------------------FN_DYNVARS_154_02-------------------------#' +# +# Testing pass conditions +# + +SET SESSION SQL_BIG_SELECTS = 1; + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo This should work + +SET SESSION SQL_BIG_SELECTS = 0; + +DELETE FROM t2 WHERE a = 'aa4'; +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo This should work + +--echo '#--------------------FN_DYNVARS_154_03-------------------------#' +# +# Session data integrity check +# + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.sql_big_selects; +--echo 1 Expected +SET SESSION sql_big_selects = 0; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.sql_big_selects; +--echo 1 Expected + +SET SESSION sql_big_selects = 1; + +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.sql_big_selects; +--echo 0 Expected + +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.sql_big_selects; +--echo 1 Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# + + +SET @@SESSION.sql_big_selects = @session_sql_big_selects; +SET @@SESSION.max_join_size = @session_max_join_size; +SET @@GLOBAL.max_join_size = @global_max_join_size; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test new file mode 100644 index 00000000000..4e3dbdc9504 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test @@ -0,0 +1,175 @@ +###################### mysql-test\t\sql_big_tables_basic.test ################# +# # +# Variable Name: sql_big_tables # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values : 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_big_tables # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF sql_big_tables TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of sql_big_tables in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.sql_big_tables; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_154_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_big_tables # +######################################################################## + +SET @@session.sql_big_tables = 0; +SET @@session.sql_big_tables = DEFAULT; +SELECT @@session.sql_big_tables; + +SET @@session.sql_big_tables = 1; +SET @@session.sql_big_tables = DEFAULT; +SELECT @@session.sql_big_tables; + + +--echo '#---------------------FN_DYNVARS_154_02-------------------------#' +############################################################################# +# Check if sql_big_tables can be accessed with and without @@ sign # +############################################################################# + +SET sql_big_tables = 1; +SELECT @@sql_big_tables; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_big_tables; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_big_tables; + +SET session sql_big_tables = 0; +SELECT @@session.sql_big_tables; + + +--echo '#--------------------FN_DYNVARS_154_03------------------------#' +######################################################################## +# change the value of sql_big_tables to a valid value # +######################################################################## + +SET @@session.sql_big_tables = 0; +SELECT @@session.sql_big_tables; +SET @@session.sql_big_tables = 1; +SELECT @@session.sql_big_tables; + + +--echo '#--------------------FN_DYNVARS_154_04-------------------------#' +########################################################################### +# Change the value of sql_big_tables to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = ÕN; + +SET @@session.sql_big_tables = OF; +SELECT @@session.sql_big_tables; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_big_tables = NO; + + +--echo '#-------------------FN_DYNVARS_154_05----------------------------#' +########################################################################### +# Test if accessing global sql_big_tables gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_big_tables = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_big_tables; + +--echo '#----------------------FN_DYNVARS_154_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_big_tables'; + +--echo '#----------------------FN_DYNVARS_154_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_big_tables = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_big_tables'; +SELECT @@session.sql_big_tables; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_big_tables'; + +--echo '#---------------------FN_DYNVARS_154_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_big_tables = OFF; +SELECT @@session.sql_big_tables; +SET @@session.sql_big_tables = ON; +SELECT @@session.sql_big_tables; + +--echo '#---------------------FN_DYNVARS_154_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_big_tables = TRUE; +SELECT @@session.sql_big_tables; +SET @@session.sql_big_tables = FALSE; +SELECT @@session.sql_big_tables; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_big_tables = @session_start_value; +SELECT @@session.sql_big_tables; + +############################################################### +# END OF sql_big_tables TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_big_tables_func.test b/mysql-test/suite/sys_vars/t/sql_big_tables_func.test new file mode 100644 index 00000000000..5f919fac2c7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_big_tables_func.test @@ -0,0 +1,146 @@ +############# mysql-test\t\sql_big_tables_func.test ######################## +# # +# Variable Name: sql_big_tables # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 0 FALSE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_big_tables" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +# Due to difference in the result the ps-protocol is disabled +--disable_ps_protocol + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @old_big_tables = @@SESSION.sql_big_tables; + +# +# Create tables +# + +CREATE TABLE t1(a varchar(20), b varchar(20)); + +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); + +--echo '#--------------------FN_DYNVARS_155_01-------------------------#' +# +# TRUE mode +# + +SET SESSION sql_big_tables = 1; + +let $diskTablesBig = query_get_value(SHOW STATUS LIKE 'Created_tmp_disk_tables', Value, 1); +let $totalTablesBig = query_get_value(SHOW STATUS LIKE 'Created_tmp_tables', Value, 1); + +eval SET @diskTableCount = $diskTablesBig; +eval SET @tempTableCount = $totalTablesBig; + +SELECT * FROM (SELECT ta.a as a, tb.b as b +FROM t1 as ta INNER JOIN t1 as tb ON ta.a = tb.a) sub; + +let $newDiskTablesBig = query_get_value(SHOW STATUS LIKE 'Created_tmp_disk_tables', Value, 1); +let $newTotalTablesBig = query_get_value(SHOW STATUS LIKE 'Created_tmp_tables', Value, 1); + +eval SET @diskTableCount = $newDiskTablesBig - @diskTableCount; +eval SET @tempTableCount = $newTotalTablesBig - @tempTableCount; + +SELECT @diskTableCount; +--echo 1 Expected +SELECT @tempTableCount; +--echo 1 Expected + +--echo '#--------------------FN_DYNVARS_155_02-------------------------#' +# +# FALSE mode +# + +SET SESSION sql_big_tables = 0; + +let $diskTables = query_get_value(SHOW STATUS LIKE 'Created_tmp_disk_tables', Value, 1); +let $totalTables = query_get_value(SHOW STATUS LIKE 'Created_tmp_tables', Value, 1); + +eval SET @diskTableCount = $diskTables; +eval SET @tempTableCount = $totalTables; + +SELECT * FROM (SELECT ta.b as a, tb.a as b FROM t1 as ta INNER JOIN t1 as tb ON ta.a = tb.a) sub; + +let $newDiskTables= query_get_value(SHOW STATUS LIKE 'Created_tmp_disk_tables', Value, 1); +let $newTotalTables= query_get_value(SHOW STATUS LIKE 'Created_tmp_tables', Value, 1); + +eval SET @diskTableCount = $newDiskTables - @diskTableCount; +eval SET @tempTableCount = $newTotalTables - @tempTableCount; + +SELECT @diskTableCount; +--echo 0 Expected +SELECT @tempTableCount; +--echo 1 Expected + +--echo '#--------------------FN_DYNVARS_155_03-------------------------#' +# +# Session data integrity check +# +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.sql_big_tables; +--echo 0 / FALSE Expected; +SET SESSION sql_big_tables = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.sql_big_tables; +--echo 0 / FALSE Expected; + +SET SESSION sql_big_tables = TRUE; + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_big_tables; +--echo 0 / FALSE Expected; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_big_tables; +--echo 1 / TRUE Expected; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# + +SET SESSION sql_big_tables = @old_big_tables; + +DROP TABLE t1; + +--enable_ps_protocol + diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test new file mode 100644 index 00000000000..f5a5e323fc4 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test @@ -0,0 +1,184 @@ +############## mysql-test\t\sql_buffer_result_basic.test ###################### +# # +# Variable Name: sql_buffer_result # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values : 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_buffer_result # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF sql_buffer_result TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of sql_buffer_result in a temporary variable # +################################################################################ + +SET @session_start_value = @@session.sql_buffer_result; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_155_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_buffer_result # +######################################################################## + +SET @@session.sql_buffer_result = 0; +SET @@session.sql_buffer_result = DEFAULT; +SELECT @@session.sql_buffer_result; + +SET @@session.sql_buffer_result = 1; +SET @@session.sql_buffer_result = DEFAULT; +SELECT @@session.sql_buffer_result; + + +--echo '#---------------------FN_DYNVARS_155_02-------------------------#' +############################################################################# +# Check if sql_buffer_result can be accessed with and without @@ sign # +############################################################################# + +SET sql_buffer_result = 1; +SELECT @@sql_buffer_result; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_buffer_result; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_buffer_result; + +SET session sql_buffer_result = 0; +SELECT @@session.sql_buffer_result; + + +--echo '#--------------------FN_DYNVARS_155_03------------------------#' +######################################################################## +# change the value of sql_buffer_result to a valid value # +######################################################################## + +SET @@session.sql_buffer_result = 0; +SELECT @@session.sql_buffer_result; +SET @@session.sql_buffer_result = 1; +SELECT @@session.sql_buffer_result; + + +--echo '#--------------------FN_DYNVARS_155_04-------------------------#' +########################################################################### +# Change the value of sql_buffer_result to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = "TRU"; + +SET @@session.sql_buffer_result = 0.4; +SELECT @@session.sql_buffer_result; + +SET @@session.sql_buffer_result = 1.4; +SELECT @@session.sql_buffer_result; + +--echo 'Bug: Decimal values are accepted and rounded to an integer before'; +--echo 'assingment.'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = ÕN; + +SET @@session.sql_buffer_result = OF; +SELECT @@session.sql_buffer_result; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_buffer_result = NO; + + +--echo '#-------------------FN_DYNVARS_155_05----------------------------#' +########################################################################### +# Test if accessing global sql_buffer_result gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_buffer_result = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_buffer_result; + +--echo '#----------------------FN_DYNVARS_155_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_buffer_result'; + +--echo '#----------------------FN_DYNVARS_155_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_buffer_result = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_buffer_result'; +SELECT @@session.sql_buffer_result; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_buffer_result'; + +--echo '#---------------------FN_DYNVARS_155_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_buffer_result = OFF; +SELECT @@session.sql_buffer_result; +SET @@session.sql_buffer_result = ON; +SELECT @@session.sql_buffer_result; + +--echo '#---------------------FN_DYNVARS_155_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_buffer_result = TRUE; +SELECT @@session.sql_buffer_result; +SET @@session.sql_buffer_result = FALSE; +SELECT @@session.sql_buffer_result; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_buffer_result = @session_start_value; +SELECT @@session.sql_buffer_result; + +############################################################### +# END OF sql_buffer_result TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test new file mode 100644 index 00000000000..4530545b8f0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test @@ -0,0 +1,130 @@ +############# mysql-test\t\sql_buffer_result_func.test ##################### +# # +# Variable Name: sql_buffer_result # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 0 FALSE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_buffer_result" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @original_sql_buffer_result = @@sql_buffer_result; + +# +# Create tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); + +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa','bb'); + +--echo '#--------------------FN_DYNVARS_156_01-------------------------#' +# +# TRUE mode +# + +SET SESSION sql_buffer_result = 1; + +SHOW STATUS LIKE 'Created_tmp_tables'; +--echo Expected value : 0. + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Created_tmp_tables'; +--echo Expected value : 1. + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Created_tmp_tables'; +--echo Expected value : 2. + +--echo '#--------------------FN_DYNVARS_156_02-------------------------#' +# +# FALSE mode +# + +SET SESSION sql_buffer_result = 0; + +SHOW STATUS LIKE 'Created_tmp_tables'; +--echo Expected value : 2. + +SELECT * FROM t1; + +SHOW STATUS LIKE 'Created_tmp_tables'; +--echo Expected value : 2. + +--echo '#--------------------FN_DYNVARS_156_03-------------------------#' +# +# Session data integrity check +# +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.sql_buffer_result; +--echo 0 / FALSE Expected + +SET SESSION sql_buffer_result = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.sql_buffer_result; +--echo 0 / FALSE Expected + +SET SESSION sql_buffer_result = TRUE; + +--echo ** Connection con_int1 ** +connection con_int1; + +SELECT @@SESSION.sql_buffer_result; +--echo 0 / FALSE Expected + +--echo ** Connection con_int2 ** +connection con_int2; + +SELECT @@SESSION.sql_buffer_result; +--echo 1 / TRUE Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# +--echo ** Cleanup ** + +SET @@sql_buffer_result = @original_sql_buffer_result; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test new file mode 100644 index 00000000000..0f6d9e1e126 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test @@ -0,0 +1,174 @@ +####################### mysql-test\t\sql_log_bin_basic.test ################### +# # +# Variable Name: sql_log_bin # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_log_bin # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF sql_log_bin TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of sql_log_bin in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.sql_log_bin; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_156_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_log_bin # +######################################################################## + +SET @@session.sql_log_bin = 0; +SET @@session.sql_log_bin = DEFAULT; +SELECT @@session.sql_log_bin; + +SET @@session.sql_log_bin = 1; +SET @@session.sql_log_bin = DEFAULT; +SELECT @@session.sql_log_bin; + + +--echo '#---------------------FN_DYNVARS_156_02-------------------------#' +############################################################################# +# Check if sql_log_bin can be accessed with and without @@ sign # +############################################################################# + +SET sql_log_bin = 1; +SELECT @@sql_log_bin; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_log_bin; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_log_bin; + +SET session sql_log_bin = 0; +SELECT @@session.sql_log_bin; + + +--echo '#--------------------FN_DYNVARS_156_03------------------------#' +######################################################################## +# change the value of sql_log_bin to a valid value # +######################################################################## + +SET @@session.sql_log_bin = 0; +SELECT @@session.sql_log_bin; +SET @@session.sql_log_bin = 1; +SELECT @@session.sql_log_bin; + + +--echo '#--------------------FN_DYNVARS_156_04-------------------------#' +########################################################################### +# Change the value of sql_log_bin to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = ÕN; + +SET @@session.sql_log_bin = OF; +SELECT @@session.sql_log_bin; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_bin = NO; + + +--echo '#-------------------FN_DYNVARS_156_05----------------------------#' +########################################################################### +# Test if accessing global sql_log_bin gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_log_bin = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_log_bin; + +--echo '#----------------------FN_DYNVARS_156_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_log_bin'; + +--echo '#----------------------FN_DYNVARS_156_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_log_bin = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_log_bin'; +SELECT @@session.sql_log_bin; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_log_bin'; + +--echo '#---------------------FN_DYNVARS_156_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_log_bin = OFF; +SELECT @@session.sql_log_bin; +SET @@session.sql_log_bin = ON; +SELECT @@session.sql_log_bin; + +--echo '#---------------------FN_DYNVARS_156_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_log_bin = TRUE; +SELECT @@session.sql_log_bin; +SET @@session.sql_log_bin = FALSE; +SELECT @@session.sql_log_bin; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_log_bin = @session_start_value; +SELECT @@session.sql_log_bin; + +############################################################### +# END OF sql_log_bin TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test new file mode 100644 index 00000000000..bcf9e87c1dd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test @@ -0,0 +1,175 @@ +################# mysql-test\t\sql_log_off_basic.test ######################### +# # +# Variable Name: sql_log_off # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_log_off # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF sql_log_off TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of sql_log_off in a temporary variable # +################################################################################ + +SET @session_start_value = @@session.sql_log_off; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_157_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_log_off # +######################################################################## + +SET @@session.sql_log_off = 0; +SET @@session.sql_log_off = DEFAULT; +SELECT @@session.sql_log_off; + +SET @@session.sql_log_off = 1; +SET @@session.sql_log_off = DEFAULT; +SELECT @@session.sql_log_off; + + +--echo '#---------------------FN_DYNVARS_157_02-------------------------#' +############################################################################# +# Check if sql_log_off can be accessed with and without @@ sign # +############################################################################# + +SET sql_log_off = 1; +SELECT @@sql_log_off; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_log_off; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_log_off; + +SET session sql_log_off = 0; +SELECT @@session.sql_log_off; + + +--echo '#--------------------FN_DYNVARS_157_03------------------------#' +######################################################################## +# change the value of sql_log_off to a valid value # +######################################################################## + +SET @@session.sql_log_off = 0; +SELECT @@session.sql_log_off; +SET @@session.sql_log_off = 1; +SELECT @@session.sql_log_off; + + +--echo '#--------------------FN_DYNVARS_157_04-------------------------#' +########################################################################### +# Change the value of sql_log_off to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = ÕN; + +SET @@session.sql_log_off = OF; +SELECT @@session.sql_log_off; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_log_off = NO; + + +--echo '#-------------------FN_DYNVARS_157_05----------------------------#' +########################################################################### +# Test if accessing global sql_log_off gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_log_off = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_log_off; + +--echo '#----------------------FN_DYNVARS_157_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_log_off'; + +--echo '#----------------------FN_DYNVARS_157_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_log_off = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_log_off'; +SELECT @@session.sql_log_off; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_log_off'; + +--echo '#---------------------FN_DYNVARS_157_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_log_off = OFF; +SELECT @@session.sql_log_off; +SET @@session.sql_log_off = ON; +SELECT @@session.sql_log_off; + +--echo '#---------------------FN_DYNVARS_157_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_log_off = TRUE; +SELECT @@session.sql_log_off; +SET @@session.sql_log_off = FALSE; +SELECT @@session.sql_log_off; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_log_off = @session_start_value; +SELECT @@session.sql_log_off; + +############################################################### +# END OF sql_log_off TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_func.test b/mysql-test/suite/sys_vars/t/sql_log_off_func.test new file mode 100644 index 00000000000..fb06a12b264 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_log_off_func.test @@ -0,0 +1,115 @@ +############# mysql-test\t\sql_log_off_func.test ########################## +# # +# Variable Name: sql_log_off # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 0 FALSE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_log_off" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @default_sql_log_off = @@sql_log_off; + +# +# Create tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); + +INSERT INTO t1 VALUES('aa1','bb'); +INSERT INTO t1 VALUES('aa2','bb'); +INSERT INTO t1 VALUES('aa3','bb'); +INSERT INTO t1 VALUES('aa4','bb'); +INSERT INTO t1 VALUES('aa5','bb'); + +--echo '#--------------------FN_DYNVARS_158_01-------------------------#' +# +# Value ON +# + +SET SESSION sql_log_off = ON; + +UPDATE t1 SET a = 'aa1-updated' WHERE a = 'aa1'; + +--echo Checking if log contains the executed statement +SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1-updated\' WHERE a = \'aa1\''; + +--echo '#--------------------FN_DYNVARS_158_02-------------------------#' +# +# Value OFF +# + +SET SESSION sql_log_off = OFF; + +# With ps-protocol the UPDATE is executed twice +--disable_ps_protocol +UPDATE t1 SET a = 'aa1' WHERE a = 'aa1-updated'; +--enable_ps_protocol + +--echo Checking if log contains the executed statement +SELECT argument FROM mysql.general_log WHERE argument = 'UPDATE t1 SET a = \'aa1\' WHERE a = \'aa1-updated\''; + +--echo '#--------------------FN_DYNVARS_158_03--------------------------#' +# +# Session data integrity check +# +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_log_off; +--echo 0 / FALSE Expected + +SET SESSION sql_log_off = FALSE; +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_log_off; +--echo 0 / FALSE Expected + +SET SESSION sql_log_off = TRUE; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_log_off; +--echo 1 / TRUE Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_log_off; +--echo 0 / FALSE Expected + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +SET SESSION sql_log_off = @default_sql_log_off; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test new file mode 100644 index 00000000000..499723b636d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test @@ -0,0 +1,233 @@ +############## mysql-test\t\sql_low_priority_updates_basic.test ############### +# # +# Variable Name: sql_low_priority_updates # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_low_priority_updates # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF sql_low_priority_updates TESTS # +######################################################################## + + +############################################################################### +# Saving initial value of sql_low_priority_updates in a temporary variable # +############################################################################### + +SET @session_start_value = @@session.sql_low_priority_updates; +SELECT @session_start_value; + +SET @global_start_value = @@global.sql_low_priority_updates; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_159_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_low_priority_updates # +######################################################################## + +SET @@session.sql_low_priority_updates = 1; +SET @@session.sql_low_priority_updates = DEFAULT; +SELECT @@session.sql_low_priority_updates; + +SET @@global.sql_low_priority_updates = 1; +--Error ER_NO_DEFAULT +SET @@global.sql_low_priority_updates = DEFAULT; + +--echo 'Bug: DEFAULT value is only associated with session' + + +--echo '#---------------------FN_DYNVARS_159_02-------------------------#' +#################################################################################### +# Check if sql_low_priority_updates can be accessed with and without @@ sign # +#################################################################################### + +SET sql_low_priority_updates = 1; +SELECT @@sql_low_priority_updates; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_low_priority_updates; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_low_priority_updates; + +--Error ER_UNKNOWN_TABLE +SELECT global.sql_low_priority_updates; + +#using another syntax for accessing system variables +SET session sql_low_priority_updates = 0; +SELECT @@session.sql_low_priority_updates; + +SET global sql_low_priority_updates = 0; +SELECT @@global.sql_low_priority_updates; + + +--echo '#--------------------FN_DYNVARS_159_03------------------------#' +########################################################################## +# change the value of sql_low_priority_updates to a valid value # +########################################################################## +# for session +SET @@session.sql_low_priority_updates = 0; +SELECT @@session.sql_low_priority_updates; +SET @@session.sql_low_priority_updates = 1; +SELECT @@session.sql_low_priority_updates; + +# for global +SET @@global.sql_low_priority_updates = 0; +SELECT @@global.sql_low_priority_updates; +SET @@global.sql_low_priority_updates = 1; +SELECT @@global.sql_low_priority_updates; + + +--echo '#--------------------FN_DYNVARS_159_04-------------------------#' +########################################################################### +# Change the value of sql_low_priority_updates to invalid value # +########################################################################### + +# for session +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = 1.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = ÕN; + +SET @@session.sql_low_priority_updates = OF; +SELECT @@session.sql_low_priority_updates; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_low_priority_updates = ÓFF; + +# for global + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = ÕN; + +SET @@global.sql_low_priority_updates = OF; +SELECT @@global.sql_low_priority_updates; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_low_priority_updates = ÓFF; + + +--echo '#-------------------FN_DYNVARS_159_05----------------------------#' +########################################################################### +# Test if changing global variable effects session and vice versa # +########################################################################### + +SET @@global.sql_low_priority_updates = 0; +SET @@session.sql_low_priority_updates = 1; +SELECT @@global.sql_low_priority_updates AS res_is_0; + +SET @@global.sql_low_priority_updates = 0; +SELECT @@session.sql_low_priority_updates AS res_is_1; + +--echo '#----------------------FN_DYNVARS_159_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.sql_low_priority_updates = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_low_priority_updates'; +SELECT @@global.sql_low_priority_updates; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_low_priority_updates'; + +--echo '#----------------------FN_DYNVARS_159_07------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@session.sql_low_priority_updates = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_low_priority_updates'; +SELECT @@session.sql_low_priority_updates; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_low_priority_updates'; + +--echo '#---------------------FN_DYNVARS_159_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_low_priority_updates = OFF; +SELECT @@session.sql_low_priority_updates; +SET @@session.sql_low_priority_updates = ON; +SELECT @@session.sql_low_priority_updates; + +SET @@global.sql_low_priority_updates = OFF; +SELECT @@global.sql_low_priority_updates; +SET @@global.sql_low_priority_updates = ON; +SELECT @@global.sql_low_priority_updates; + +--echo '#---------------------FN_DYNVARS_159_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_low_priority_updates = TRUE; +SELECT @@session.sql_low_priority_updates; +SET @@session.sql_low_priority_updates = FALSE; +SELECT @@session.sql_low_priority_updates; + +SET @@global.sql_low_priority_updates = TRUE; +SELECT @@global.sql_low_priority_updates; +SET @@global.sql_low_priority_updates = FALSE; +SELECT @@global.sql_low_priority_updates; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_low_priority_updates = @session_start_value; +SELECT @@session.sql_low_priority_updates; + +SET @@global.sql_low_priority_updates = @global_start_value; +SELECT @@global.sql_low_priority_updates; + +########################################################### +# END OF sql_low_priority_updates TESTS # +########################################################### + diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test new file mode 100644 index 00000000000..6ff684af6cd --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test @@ -0,0 +1,240 @@ +############# mysql-test\t\sql_low_priority_updates_func.test ################# +# # +# Variable Name: sql_low_priority_updates # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable sql_low_priority_updates# +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################### + +--source include/not_embedded.inc + +################################################################ +# sql_low_priority_updates was renamed to low_priority_updates # +################################################################ + +--echo ** Setup ** +--echo +# +# Setup +# +--echo ** Connecting con0 using root ** +connect (con0,localhost,root,,); +--echo ** Connecting con1 using root ** +connect (con1,localhost,root,,); + +--echo ** Connection default ** +connection default; + +SET @global_low_priority_updates = @@GLOBAL.low_priority_updates; +SET @session_low_priority_updates = @@SESSION.low_priority_updates; + +# +# Create Table +# + +CREATE TABLE t1 (a varchar(100)); + +--echo '#--------------------FN_DYNVARS_160_01-------------------------#' +# +# Value ON +# + +--echo ** Connection con0 ** +connection con0; +SET SESSION low_priority_updates = ON; +--echo ** Connection con1 ** +connection con1; +SET SESSION low_priority_updates = ON; +--echo ** Connection default ** +connection default; +SET SESSION low_priority_updates = ON; + +INSERT INTO t1 VALUES('1'); +INSERT INTO t1 VALUES('2'); +INSERT INTO t1 VALUES('3'); +INSERT INTO t1 VALUES('4'); +INSERT INTO t1 VALUES('5'); +INSERT INTO t1 VALUES('6'); + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +--echo ** Asynchronous Execution ** +delimiter |; + +send +UPDATE t1 SET a = CONCAT(a,"-updated");| + +delimiter ;| + +--echo ** Connection con0 ** +connection con0; + +--echo ** Asynchronous Execution ** +delimiter |; + +send +LOCK TABLE t1 READ; +SELECT * FROM t1; +UNLOCK TABLES;| + +delimiter ;| + +--echo ** Connection default ** +connection default; + +--echo Sleeping for 1 secs +--sleep 1 + +UNLOCK TABLES; + +--echo ** Connection con0 ** +connection con0; +--echo ** Asynchronous Result ** +reap; + +--echo Expected values of a without -updated; + +--echo ** Connection default ** +connection default; + +DELETE FROM t1; + +--echo '#--------------------FN_DYNVARS_160_02-------------------------#' +# +# Value ON +# + +--echo ** Connection con0 ** +connection con0; +SET SESSION low_priority_updates = OFF; +--echo ** Connection con1 ** +connection con1; +SET SESSION low_priority_updates = OFF; +--echo ** Connection default** +connection default; +SET SESSION low_priority_updates = OFF; + +INSERT INTO t1 VALUES('1'); +INSERT INTO t1 VALUES('2'); +INSERT INTO t1 VALUES('3'); +INSERT INTO t1 VALUES('4'); +INSERT INTO t1 VALUES('5'); +INSERT INTO t1 VALUES('6'); + +LOCK TABLE t1 WRITE; + +--echo ** Connection con1 ** +connection con1; + +--echo ** Asynchronous Execution ** +delimiter |; + +send +UPDATE t1 SET a = CONCAT(a,"-updated");| + +delimiter ;| + +--echo ** Connection con0 ** +connection con0; + +--echo ** Asynchronous Execution ** +delimiter |; + +send +LOCK TABLE t1 READ; +SELECT * FROM t1; +UNLOCK TABLES;| + +delimiter ;| + +--echo ** Connection default ** +connection default; + +--echo Sleeping for 1 secs +--sleep 1 + +UNLOCK TABLES; + +--echo ** Connection con0 ** +connection con0; +--echo ** Asynchronous Result ** +reap; +--echo Expected values of a with -updated; + +--echo ** Connection default** +connection default; + +DELETE FROM t1; + +--echo '#--------------------FN_DYNVARS_160_03-------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.low_priority_updates; +--echo 1 / TRUE Expected + +SET SESSION low_priority_updates = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.low_priority_updates; +--echo 1 / TRUE Expected + +SET SESSION low_priority_updates = TRUE; + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.low_priority_updates; +--echo 0 / FALSE Expected + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.low_priority_updates; +--echo 1 / TRUE Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con0, con1 +disconnect con0; +disconnect con1; + +DROP TABLE t1; + +SET @@GLOBAL.low_priority_updates = @global_low_priority_updates; +SET @@SESSION.low_priority_updates = @session_low_priority_updates; diff --git a/mysql-test/suite/sys_vars/t/sql_max_join_size_func.test b/mysql-test/suite/sys_vars/t/sql_max_join_size_func.test new file mode 100644 index 00000000000..17b7d911b94 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_max_join_size_func.test @@ -0,0 +1,133 @@ +############# mysql-test\t\sql_max_join_size_func.test #################### +# # +# Variable Name: sql_max_join_size # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 4294967295 # +# Values: 1-4294967295 # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_max_join_size" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system # +# -variables.html#option_mysqld_max_join_size # +# # +########################################################################### + +--echo ** Setup ** +# +# Setup +# + +SET @session_max_join_size = @@SESSION.sql_max_join_size; +SET @global_max_join_size = @@GLOBAL.sql_max_join_size; +SET @session_sql_big_selects = @@SESSION.sql_big_selects; + +# +# Create tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20) not null, b varchar(20)); +CREATE TEMPORARY TABLE t2(a varchar(20) null, b varchar(20)); + +INSERT INTO t1 VALUES('aa','bb'); +INSERT INTO t1 VALUES('aa1','bb'); +INSERT INTO t1 VALUES('aa2','bb'); +INSERT INTO t1 VALUES('aa3','bb'); +INSERT INTO t1 VALUES('aa4','bb'); + +INSERT INTO t2 VALUES('aa','bb'); +INSERT INTO t2 VALUES('aa1','bb'); +INSERT INTO t2 VALUES('aa2','bb'); +INSERT INTO t2 VALUES('aa3','bb'); +INSERT INTO t2 VALUES('aa4','bb'); + +--echo '#--------------------FN_DYNVARS_161_01-------------------------#' +# +# Testing fail condition +# + +SET SESSION sql_max_join_size=9; +--error ER_TOO_BIG_SELECT +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo Expected error The SELECT would examine more than MAX_JOIN_SIZE rows. + +--echo '#--------------------FN_DYNVARS_161_02-------------------------#' +# +# Testing pass conditions +# + +SET SESSION SQL_BIG_SELECTS = 1; + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo This should work + +SET SESSION sql_max_join_size=DEFAULT; + +DELETE FROM t2 WHERE a = 'aa4'; +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo This should work + +--echo '#----------------------------FN_DYNVARS_136_05-------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL sql_max_join_size = 4; +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_max_join_size; +--echo 4 Expected + +SET SESSION sql_max_join_size = 2; +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_max_join_size; +--echo 4 Expected + +SET SESSION sql_max_join_size = 10; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_max_join_size; +--echo 10 Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_max_join_size; +--echo 2 Expected + + +SELECT @@GLOBAL.sql_max_join_size; +--echo 4 Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +SET @@SESSION.sql_max_join_size = @session_max_join_size; +SET @@GLOBAL.sql_max_join_size = @global_max_join_size ; +SET @@SESSION.sql_big_selects = @session_sql_big_selects; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/sys_vars/t/sql_mode_basic.test b/mysql-test/suite/sys_vars/t/sql_mode_basic.test new file mode 100644 index 00000000000..24f1e8aefcb --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_mode_basic.test @@ -0,0 +1,413 @@ +#################### mysql-test\t\sql_mode_basic.test ######################### +# # +# Variable Name: sql_mode # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: YES # +# Valid Values : ANSI, STRICT_TRANS_TABLES, TRADITIONAL, # +# ERROR_FOR_DIVISION_BY_ZERO, ANSI_QUOTES, HIGH_NOT_PRECEDENCE,# +# IGNORE_SPACE, NO_AUTO_CREATE_USER, ONLY_FULL_GROUP_BY, # +# NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES, # +# NO_UNSIGNED_SUBTRACTION, OFF # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_mode # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +################################################################ +# START OF sql_mode TESTS # +################################################################ + + +################################################################### +# Saving initial value of sql_mode in a temporary variable # +################################################################### + +SET @global_start_value = @@global.sql_mode; +SELECT @global_start_value; + +SET @session_start_value = @@session.sql_mode; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_152_01------------------------#' +################################################################ +# Display the DEFAULT value of sql_mode # +################################################################ + +SET @@global.sql_mode = ANSI; +SET @@global.sql_mode = DEFAULT; +SELECT @@global.sql_mode; + +SET @@session.sql_mode = ANSI; +SET @@session.sql_mode = DEFAULT; +SELECT @@session.sql_mode; + +--echo 'Bug# 34876: Default values for both session and global sql_mode is ""'; +--echo 'and not OFF.'; + +--echo '#---------------------FN_DYNVARS_152_02-------------------------#' +######################################################### +# Check if NULL or empty value is accepeted # +######################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = NULL; + +# resets sql mode to nothing +SET @@global.sql_mode = ''; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = ' '; +SELECT @@global.sql_mode; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = NULL; + +SET @@session.sql_mode = ''; +SELECT @@session.sql_mode; + +SET @@session.sql_mode = ' '; +SELECT @@session.sql_mode; + + +--echo '#--------------------FN_DYNVARS_152_03------------------------#' +######################################################################## +# Change the value of sql_mode to a valid value # +######################################################################## + +# sql modes ref: http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html + +--echo 'Bug: Incomplete sql modes valid values at:'; +--echo 'http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html'; + +# check valid values for global + +SET @@global.sql_mode = ANSI; +SELECT @@global.sql_mode; +SET @@global.sql_mode = STRICT_TRANS_TABLES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = TRADITIONAL; +SELECT @@global.sql_mode; +SET @@global.sql_mode = ALLOW_INVALID_DATES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = ANSI_QUOTES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = ERROR_FOR_DIVISION_BY_ZERO; +SELECT @@global.sql_mode; +SET @@global.sql_mode = HIGH_NOT_PRECEDENCE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = IGNORE_SPACE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_AUTO_CREATE_USER; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_AUTO_VALUE_ON_ZERO; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_BACKSLASH_ESCAPES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_DIR_IN_CREATE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_FIELD_OPTIONS; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_KEY_OPTIONS; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_TABLE_OPTIONS; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_UNSIGNED_SUBTRACTION; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_ZERO_DATE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = NO_ZERO_IN_DATE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = ONLY_FULL_GROUP_BY; +SELECT @@global.sql_mode; +SET @@global.sql_mode = PIPES_AS_CONCAT; +SELECT @@global.sql_mode; +SET @@global.sql_mode = REAL_AS_FLOAT; +SELECT @@global.sql_mode; +SET @@global.sql_mode = STRICT_ALL_TABLES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = STRICT_TRANS_TABLES; +SELECT @@global.sql_mode; +SET @@global.sql_mode = DB2; +SELECT @@global.sql_mode; +SET @@global.sql_mode = MAXDB; +SELECT @@global.sql_mode; +SET @@global.sql_mode = MSSQL; +SELECT @@global.sql_mode; +SET @@global.sql_mode = MYSQL323; +SELECT @@global.sql_mode; +SET @@global.sql_mode = MYSQL40; +SELECT @@global.sql_mode; +SET @@global.sql_mode = ORACLE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = POSTGRESQL; +SELECT @@global.sql_mode; +SET @@global.sql_mode = TRADITIONAL; +SELECT @@global.sql_mode; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = OFF; +--echo 'Bug: OFF is documented as an sql mode but infact it is not'; + +#check valid values for session +SET @@session.sql_mode = ANSI; +SELECT @@session.sql_mode; +SET @@session.sql_mode = STRICT_TRANS_TABLES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = TRADITIONAL; +SELECT @@session.sql_mode; +SET @@session.sql_mode = ALLOW_INVALID_DATES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = ANSI_QUOTES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = ERROR_FOR_DIVISION_BY_ZERO; +SELECT @@session.sql_mode; +SET @@session.sql_mode = HIGH_NOT_PRECEDENCE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = IGNORE_SPACE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_AUTO_CREATE_USER; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_AUTO_VALUE_ON_ZERO; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_BACKSLASH_ESCAPES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_DIR_IN_CREATE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_ENGINE_SUBSTITUTION; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_FIELD_OPTIONS; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_KEY_OPTIONS; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_TABLE_OPTIONS; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_UNSIGNED_SUBTRACTION; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_ZERO_DATE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = NO_ZERO_IN_DATE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = ONLY_FULL_GROUP_BY; +SELECT @@session.sql_mode; +SET @@session.sql_mode = PIPES_AS_CONCAT; +SELECT @@session.sql_mode; +SET @@session.sql_mode = REAL_AS_FLOAT; +SELECT @@session.sql_mode; +SET @@session.sql_mode = STRICT_ALL_TABLES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = STRICT_TRANS_TABLES; +SELECT @@session.sql_mode; +SET @@session.sql_mode = DB2; +SELECT @@session.sql_mode; +SET @@session.sql_mode = MAXDB; +SELECT @@session.sql_mode; +SET @@session.sql_mode = MSSQL; +SELECT @@session.sql_mode; +SET @@session.sql_mode = MYSQL323; +SELECT @@session.sql_mode; +SET @@session.sql_mode = MYSQL40; +SELECT @@session.sql_mode; +SET @@session.sql_mode = ORACLE; +SELECT @@session.sql_mode; +SET @@session.sql_mode = POSTGRESQL; +SELECT @@session.sql_mode; +SET @@session.sql_mode = TRADITIONAL; +SELECT @@session.sql_mode; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = OFF; + +SET @@global.sql_mode = '?'; +SELECT @@global.sql_mode; + +SET @@session.sql_mode = '?'; +SELECT @@session.sql_mode; + +--echo 'Bug# 34834: ? is acceptable as a valid sql mode.' + + +--echo '#--------------------FN_DYNVARS_152_04-------------------------#' +########################################################################### +# Change the value of sql_mode to invalid value # +########################################################################### + +# invalid values for global +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = ASCII; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = NON_TRADITIONAL; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = 'OF'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = NONE; +--Error ER_WRONG_VALUE_FOR_VAR + +#invalid values for session + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = ANSI_SINGLE_QUOTES; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = 'ON'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = 'OF'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = DISABLE; + + +--echo '#-------------------FN_DYNVARS_152_05----------------------------#' +######################################################################### +# Check if the value in session Table matches value in variable # +######################################################################### + +SELECT @@session.sql_mode = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_mode'; + +--echo '#----------------------FN_DYNVARS_152_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.sql_mode = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_mode'; + + +--echo '#---------------------FN_DYNVARS_152_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +# test if variable accepts 0,1,2 +SET @@global.sql_mode = 0; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 1; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 2; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 3; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 50000; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 500000; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 4294967295; +SELECT @@global.sql_mode; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sql_mode = 4294967296; + +# use of decimal values + +SET @@global.sql_mode = 0.4; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 1.0; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 40000.1; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 1.5; +SELECT @@global.sql_mode; + +SET @@global.sql_mode = 124567.49; +SELECT @@global.sql_mode; + +SET @@session.sql_mode = 50000000.5; +SELECT @@session.sql_mode; + +SET @@session.sql_mode = 4294967295.4; +SELECT @@session.sql_mode; + +--echo 'Bug: Decimal values can be used within the range [0.0-4294967295.5).'; +--echo 'Values are rounded to numeric values as evident from outcome.'; + + +--echo '#---------------------FN_DYNVARS_152_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.sql_mode = TRUE; +SELECT @@global.sql_mode; +SET @@global.sql_mode = FALSE; +SELECT @@global.sql_mode; + +--echo '#---------------------FN_DYNVARS_152_09----------------------#' +######################################################################### +# Check if sql_mode can be accessed with and without @@ sign # +######################################################################### + + +SET sql_mode = 'ANSI'; + +--Error ER_PARSE_ERROR +SET session.sql_mode = 'ANSI'; +--Error ER_PARSE_ERROR +SET global.sql_mode = 'ANSI'; + +SET session sql_mode = 1; +SELECT @@sql_mode; + +SET global sql_mode = 0; +SELECT @@global.sql_mode; + +--echo '#---------------------FN_DYNVARS_152_10----------------------#' +####################################################################### +# Check if sql_mode values can be combined as specified # +####################################################################### + +SET @@session.sql_mode = 'TRADITIONAL,ALLOW_INVALID_DATES,ANSI_QUOTES'; +SELECT @@session.sql_mode; + +SET @@global.sql_mode = 'ONLY_FULL_GROUP_BY,PIPES_AS_CONCAT,REAL_AS_FLOAT,ORACLE,POSTGRESQL'; +SELECT @@global.sql_mode; + +#try combining invalid mode with correct mode +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,HIGH_OR_PRECEDENCE, +IGNORE_SPACE'; + +############################## +# Restore initial value # +############################## + +SET @@global.sql_mode = @global_start_value; +SELECT @@global.sql_mode; + +SET @@session.sql_mode = @session_start_value; +SELECT @@session.sql_mode; + +################################################################ +# END OF sql_mode TESTS # +################################################################ + diff --git a/mysql-test/suite/sys_vars/t/sql_mode_func.test b/mysql-test/suite/sys_vars/t/sql_mode_func.test new file mode 100644 index 00000000000..5bb804c26da --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_mode_func.test @@ -0,0 +1,200 @@ +############# mysql-test\t\sql_mode_func.test ###################################### +# # +# Variable Name: sql_mode # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Values: ALLOW_INVALID_DATES, ANSI_QUOTES, ERROR_FOR_DIVISION_BY_ZERO, # +# HIGH_NOT_PRECEDENCE, IGNORE_SPACE, NO_AUTO_CREATE_USER, # +# NO_AUTO_VALUE_ON_ZERO, NO_BACKSLASH_ESCAPES, NO_DIR_IN_CREATE, # +# NO_ENGINE_SUBSTITUTION, NO_FIELD_OPTIONS, NO_KEY_OPTIONS, # +# NO_TABLE_OPTIONS, NO_UNSIGNED_SUBTRACTION, NO_ZERO_DATE, # +# NO_ZERO_IN_DATE, ONLY_FULL_GROUP_BY, PIPES_AS_CONCAT, REAL_AS_FLOAT# +# STRICT_ALL_TABLES, STRICT_TRANS_TABLES, OFF # +# # +# # +# Creation Date: 2008-02-22 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_mode" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_sql_mode # +# # +#################################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +# +# Save initial value +# + +SET @sql_mode_session = @@SESSION.sql_mode; +SET @sql_mode_global = @@GLOBAL.sql_mode; + +# +# Create tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20) not null, b varchar(20)); +CREATE TEMPORARY TABLE t2(a varchar(20) null, b varchar(20)); + +--echo '#--------------------FN_DYNVARS_153_01-------------------------#' +# +#ANSI mode +# +--echo ANSI mode + + +SET SESSION sql_mode = ANSI; + +SELECT @@SESSION.sql_mode; + +INSERT INTO t1 VALUES('t1a1','t1b1'); +INSERT INTO t1 VALUES('t1a2','t1b2'); +INSERT INTO t1 VALUES('t1a3','t1b3'); +INSERT INTO t1 VALUES('t1a4','t1b4'); + +INSERT INTO t2 VALUES('t2a1','t2b1'); +INSERT INTO t2 VALUES('t2a2','t2b2'); +INSERT INTO t2 VALUES('t2a3','t2b3'); +INSERT INTO t2 VALUES('t2a4','t2b4'); + +--error ER_INVALID_GROUP_FUNC_USE +SELECT * FROM t1 WHERE t1.a IN (SELECT MAX(t1.b) FROM t2); +--echo Expected error for invalid group function + +# +# Reset +# + +SET SESSION sql_mode = @sql_mode_session; +SET GLOBAL sql_mode = @sql_mode_global; + +--echo '#--------------------FN_DYNVARS_153_02-------------------------#' +# +#STRICT_TRANS_TABLES mode +# +--echo STRICT_TRANS_TABLES mode + +DELETE FROM t1; +DELETE FROM t2; + +SET SESSION sql_mode = STRICT_TRANS_TABLES; + +SELECT @@SESSION.sql_mode; + +INSERT INTO t1 VALUES('t1a1','t1b1'); +INSERT INTO t1 VALUES('t1a2','t1b2'); +INSERT INTO t1 VALUES('t1a3','t1b3'); +INSERT INTO t1 VALUES('t1a4','t1b4'); + +INSERT INTO t2 VALUES(NULL,'t2b1'); +INSERT INTO t2 VALUES('t2a2','t2b2'); +INSERT INTO t2 VALUES('t2a3','t2b3'); +INSERT INTO t2 VALUES('t2a4','t2b4'); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 SELECT * FROM t2; +--echo Expected error Bad NULL value + +SELECT * FROM t1 WHERE a = 't2a2'; +--echo Should return no rows in columns a,b; + +# +# Reset +# + +SET SESSION sql_mode = @sql_mode_session; +SET GLOBAL sql_mode = @sql_mode_global; + +--echo '#--------------------FN_DYNVARS_153_03-------------------------#' +# +#TRADITIONAL mode +# +--echo TRADITIONAL mode + +SET SESSION sql_mode = TRADITIONAL; + +SELECT @@SESSION.sql_mode; + +INSERT INTO t1 VALUES('t1a1','t1b1'); +INSERT INTO t1 VALUES('t1a2','t1b2'); +INSERT INTO t1 VALUES('t1a3','t1b3'); +INSERT INTO t1 VALUES('t1a4','t1b4'); + +INSERT INTO t2 VALUES(NULL,'t2b1'); +INSERT INTO t2 VALUES('t2a2','t2b2'); +INSERT INTO t2 VALUES('t2a3','t2b3'); +INSERT INTO t2 VALUES('t2a4','t2b4'); + +--error ER_BAD_NULL_ERROR +INSERT INTO t1 SELECT * FROM t2; +--echo Expected error Bad NULL value + +SELECT * FROM t1 WHERE a = 't2a2'; +--echo Should return no rows in columns a,b; + + +--echo '#-------------------FN_DYNVARS_153_04-------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL sql_mode = ''; +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_mode; +--echo '' Expected + +SET SESSION sql_mode = 'TRADITIONAL'; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_mode; +--echo '' Expected + +SET SESSION sql_mode = 'ANSI'; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_mode; +--echo 'REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, ANSI' Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_mode; +--echo 'STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, TRADITIONAL' Expected + + +SELECT @@GLOBAL.sql_mode; +--echo '' Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# + +SET SESSION sql_mode = @sql_mode_session; +SET GLOBAL sql_mode = @sql_mode_global; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/sys_vars/t/sql_notes_basic.test b/mysql-test/suite/sys_vars/t/sql_notes_basic.test new file mode 100644 index 00000000000..984dca34e46 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_notes_basic.test @@ -0,0 +1,176 @@ +################### mysql-test\t\sql_notes_basic.test ######################### +# # +# Variable Name: sql_notes # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_notes # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF sql_notes TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of sql_notes in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.sql_notes; +SELECT @session_start_value; + + +--echo '#--------------------FN_DYNVARS_161_01------------------------#' +###################################################################### +# Display the DEFAULT value of sql_notes # +###################################################################### + +SET @@session.sql_notes = 0; +SET @@session.sql_notes = DEFAULT; +SELECT @@session.sql_notes; + +SET @@session.sql_notes = 1; +SET @@session.sql_notes = DEFAULT; +SELECT @@session.sql_notes; + + +--echo '#---------------------FN_DYNVARS_161_02-------------------------#' +########################################################################### +# Check if sql_notes can be accessed with and without @@ sign # +########################################################################### + +SET sql_notes = 1; +SELECT @@sql_notes; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_notes; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_notes; + +SET session sql_notes = 0; +SELECT @@session.sql_notes; + + +--echo '#--------------------FN_DYNVARS_161_03------------------------#' +###################################################################### +# change the value of sql_notes to a valid value # +###################################################################### + +SET @@session.sql_notes = 0; +SELECT @@session.sql_notes; +SET @@session.sql_notes = 1; +SELECT @@session.sql_notes; + + +--echo '#--------------------FN_DYNVARS_161_04-------------------------#' +######################################################################### +# Change the value of sql_notes to invalid value # +######################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = ÕN; + +SET @@session.sql_notes = OF; +SELECT @@session.sql_notes; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_notes = NO; + + +--echo '#-------------------FN_DYNVARS_161_05----------------------------#' +######################################################################### +# Test if accessing global sql_notes gives error # +######################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_notes = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_notes; + +--echo '#----------------------FN_DYNVARS_161_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_notes'; + +--echo '#----------------------FN_DYNVARS_161_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_notes = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_notes'; +SELECT @@session.sql_notes; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_notes'; + +--echo '#---------------------FN_DYNVARS_161_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_notes = OFF; +SELECT @@session.sql_notes; +SET @@session.sql_notes = ON; +SELECT @@session.sql_notes; + +--echo '#---------------------FN_DYNVARS_161_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_notes = TRUE; +SELECT @@session.sql_notes; +SET @@session.sql_notes = FALSE; +SELECT @@session.sql_notes; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_notes = @session_start_value; +SELECT @@session.sql_notes; + +############################################################# +# END OF sql_notes TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/sql_notes_func.test b/mysql-test/suite/sys_vars/t/sql_notes_func.test new file mode 100644 index 00000000000..f7c521d3736 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_notes_func.test @@ -0,0 +1,134 @@ +############# mysql-test\t\sql_notes_func.test ############################ +# # +# Variable Name: sql_notes # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_notes" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +# Due to suppressed warnings the pc-protocol is disabled +--disable_ps_protocol + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @default_sql_notes = @@sql_notes; + +--echo '#--------------------FN_DYNVARS_162_01-------------------------#' +# +# Value ON +# + +SET SESSION sql_notes = ON; + +--echo creating a temporary table +CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); +--echo conditionally dropping the table twice so that a note generates + +DROP TABLE IF EXISTS t1; + +SELECT @@warning_count; +--echo 0 Expected + +# +#This line generates A Note warning +# +DROP TABLE IF EXISTS t1; + +SELECT @@warning_count; +--echo 1 Expected + +--echo '#--------------------FN_DYNVARS_162_02-------------------------#' +# +# Value OFF +# + +SET SESSION sql_notes = OFF; + +--echo creating a temporary table +CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); +--echo conditionally dropping the table twice so that a note generates + +DROP TABLE IF EXISTS t1; + +SELECT @@warning_count; +--echo 0 Expected + +# +#This line generates A Note warning +# +DROP TABLE IF EXISTS t1; + +SELECT @@warning_count; +--echo 0 Expected + +--echo '#------------------FN_DYNVARS_162_03---------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_notes; +--echo 1 / TRUE Expected + +SET SESSION sql_notes = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_notes; +--echo 1 / TRUE Expected + +SET SESSION sql_notes = TRUE; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_notes; +--echo 1 / TRUE Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_notes; +--echo 0 / FALSE Expected + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +SET SESSION sql_notes = @default_sql_notes; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--enable_ps_protocol + diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test new file mode 100644 index 00000000000..1919b3ee642 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test @@ -0,0 +1,176 @@ +############## mysql-test\t\sql_quote_show_create_basic.test ################## +# # +# Variable Name: sql_quote_show_create # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_quote_show_create # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +####################################################################### +# START OF sql_quote_show_create TESTS # +####################################################################### + + +############################################################################## +# Saving initial value of sql_quote_show_create in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.sql_quote_show_create; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_162_01------------------------#' +###################################################################### +# Display the DEFAULT value of sql_quote_show_create # +###################################################################### + +SET @@session.sql_quote_show_create = 0; +SET @@session.sql_quote_show_create = DEFAULT; +SELECT @@session.sql_quote_show_create; + +SET @@session.sql_quote_show_create = 1; +SET @@session.sql_quote_show_create = DEFAULT; +SELECT @@session.sql_quote_show_create; + + +--echo '#---------------------FN_DYNVARS_162_02-------------------------#' +############################################################################# +# Check if sql_quote_show_create can be accessed with and without @@ sign # +############################################################################# + +SET sql_quote_show_create = 1; +SELECT @@sql_quote_show_create; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_quote_show_create; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_quote_show_create; + +SET session sql_quote_show_create = 0; +SELECT @@session.sql_quote_show_create; + + +--echo '#--------------------FN_DYNVARS_162_03------------------------#' +######################################################################## +# change the value of sql_quote_show_create to a valid value # +######################################################################## + +SET @@session.sql_quote_show_create = 0; +SELECT @@session.sql_quote_show_create; +SET @@session.sql_quote_show_create = 1; +SELECT @@session.sql_quote_show_create; + + +--echo '#--------------------FN_DYNVARS_162_04-------------------------#' +########################################################################## +# Change the value of sql_quote_show_create to invalid value # +########################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = ÕN; + +SET @@session.sql_quote_show_create = OF; +SELECT @@session.sql_quote_show_create; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_quote_show_create = NO; + + +--echo '#-------------------FN_DYNVARS_162_05----------------------------#' +########################################################################## +# Test if accessing global sql_quote_show_create gives error # +########################################################################## + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_quote_show_create = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_quote_show_create; + +--echo '#----------------------FN_DYNVARS_162_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_quote_show_create'; + +--echo '#----------------------FN_DYNVARS_162_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_quote_show_create = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_quote_show_create'; +SELECT @@session.sql_quote_show_create; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_quote_show_create'; + +--echo '#---------------------FN_DYNVARS_162_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_quote_show_create = OFF; +SELECT @@session.sql_quote_show_create; +SET @@session.sql_quote_show_create = ON; +SELECT @@session.sql_quote_show_create; + +--echo '#---------------------FN_DYNVARS_162_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_quote_show_create = TRUE; +SELECT @@session.sql_quote_show_create; +SET @@session.sql_quote_show_create = FALSE; +SELECT @@session.sql_quote_show_create; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_quote_show_create = @session_start_value; +SELECT @@session.sql_quote_show_create; + +############################################################### +# END OF sql_quote_show_create TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test new file mode 100644 index 00000000000..6350771a0da --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_func.test @@ -0,0 +1,114 @@ +############# mysql-test\t\sql_quote_show_create_func.test ################# +# # +# Variable Name: sql_quote_show_create # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable sql_quote_show_create# +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @default_sql_quote_show_create = @@sql_quote_show_create; + +# +# Creating tables +# + +CREATE TEMPORARY TABLE t1(a varchar(20), b varchar(20)); + +--echo '#-----------------------------FN_DYNVARS_163_01------------------------------------#' +# +# Value TRUE +# + +SET SESSION sql_quote_show_create = TRUE; + +SHOW CREATE DATABASE test; +--echo EXPECTING identifiers test TO BE quoted like 'test' + +SHOW CREATE TABLE t1; +--echo EXPECTING identifiers a, b, t1 TO BE quoted like 'a','b','t1' + + +--echo '#-----------------------------FN_DYNVARS_163_02------------------------------------#' +# +# Value FALSE +# + +SET SESSION sql_quote_show_create = FALSE; + +SHOW CREATE DATABASE test; +--echo EXPECTING identifiers test NOT TO BE quoted like 'test' + +SHOW CREATE TABLE t1; +--echo EXPECTING identifiers a, b, t1 NOT TO BE quoted like 'a','b','t1' + +--echo '#----------------------------FN_DYNVARS_163_03--------------------------------------#' +# +# Session data integrity check +# + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_quote_show_create; +--echo 1 / TRUE Expected + +SET SESSION sql_quote_show_create = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_quote_show_create; +--echo 1 / TRUE Expected + +SET SESSION sql_quote_show_create = TRUE; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_quote_show_create; +--echo 1 / TRUE Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_quote_show_create; +--echo 0 / FALSE Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# +--echo +--echo Cleanup + +SET @@sql_quote_show_create = @default_sql_quote_show_create; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test new file mode 100644 index 00000000000..489b42949a0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test @@ -0,0 +1,175 @@ +############## mysql-test\t\sql_safe_updates_basic.test ####################### +# # +# Variable Name: sql_safe_updates # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Range: 0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_safe_updates # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF sql_safe_updates TESTS # +######################################################################## + + +################################################################################ +# Saving initial value of sql_safe_updates in a temporary variable # +################################################################################ + +SET @session_start_value = @@session.sql_safe_updates; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_163_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_safe_updates # +######################################################################## + +SET @@session.sql_safe_updates = 0; +SET @@session.sql_safe_updates = DEFAULT; +SELECT @@session.sql_safe_updates; + +SET @@session.sql_safe_updates = 1; +SET @@session.sql_safe_updates = DEFAULT; +SELECT @@session.sql_safe_updates; + + +--echo '#---------------------FN_DYNVARS_163_02-------------------------#' +############################################################################# +# Check if sql_safe_updates can be accessed with and without @@ sign # +############################################################################# + +SET sql_safe_updates = 1; +SELECT @@sql_safe_updates; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_safe_updates; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_safe_updates; + +SET session sql_safe_updates = 0; +SELECT @@session.sql_safe_updates; + + +--echo '#--------------------FN_DYNVARS_163_03------------------------#' +######################################################################## +# change the value of sql_safe_updates to a valid value # +######################################################################## + +SET @@session.sql_safe_updates = 0; +SELECT @@session.sql_safe_updates; +SET @@session.sql_safe_updates = 1; +SELECT @@session.sql_safe_updates; + + +--echo '#--------------------FN_DYNVARS_163_04-------------------------#' +########################################################################### +# Change the value of sql_safe_updates to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = ÕN; + +SET @@session.sql_safe_updates = OF; +SELECT @@session.sql_safe_updates; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_safe_updates = NO; + + +--echo '#-------------------FN_DYNVARS_163_05----------------------------#' +########################################################################### +# Test if accessing global sql_safe_updates gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_safe_updates = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_safe_updates; + +--echo '#----------------------FN_DYNVARS_163_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_safe_updates'; + +--echo '#----------------------FN_DYNVARS_163_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_safe_updates = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_safe_updates'; +SELECT @@session.sql_safe_updates; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_safe_updates'; + +--echo '#---------------------FN_DYNVARS_163_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_safe_updates = OFF; +SELECT @@session.sql_safe_updates; +SET @@session.sql_safe_updates = ON; +SELECT @@session.sql_safe_updates; + +--echo '#---------------------FN_DYNVARS_163_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_safe_updates = TRUE; +SELECT @@session.sql_safe_updates; +SET @@session.sql_safe_updates = FALSE; +SELECT @@session.sql_safe_updates; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_safe_updates = @session_start_value; +SELECT @@session.sql_safe_updates; + +############################################################### +# END OF sql_safe_updates TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test new file mode 100644 index 00000000000..a8ce3a8d0f7 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_func.test @@ -0,0 +1,202 @@ +############# mysql-test\t\sql_safe_updates_func.test ##################### +# # +# Variable Name: sql_safe_updates # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_safe_updates" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @default_sql_safe_updates = @@sql_safe_updates; + +# +# Creating tables +# + +CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20)); + +INSERT INTO t1 VALUES(1, 'val1'); +INSERT INTO t1 VALUES(2, 'val2'); +INSERT INTO t1 VALUES(3, 'val3'); +INSERT INTO t1 VALUES(4, 'val4'); +INSERT INTO t1 VALUES(5, 'val5'); +INSERT INTO t1 VALUES(6, 'val6'); +INSERT INTO t1 VALUES(7, 'val7'); +INSERT INTO t1 VALUES(8, 'val8'); +INSERT INTO t1 VALUES(9, 'val9'); + + + +--echo '#-----------------------------FN_DYNVARS_164_01------------------------------------#' +--echo +--echo Value ON +--echo +# +# Value ON +# + +SET SESSION sql_safe_updates = ON; + +--echo '#-----------------------------FN_DYNVARS_164_02------------------------------------#' +# +# Without WHERE Clause +# +--echo Expected error : Update without key in safe mode +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +DELETE FROM t1; +SELECT * FROM t1; + +PREPARE stmt FROM 'DELETE FROM t1;'; +--echo Expected error : Update without key in safe mode +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo '#-----------------------------FN_DYNVARS_164_03------------------------------------#' +# +# With a LIMIT Clause +# +--echo Expected error : Update without key in safe mode +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +DELETE FROM t1 LIMIT 2; +SELECT * FROM t1; + +--echo '#-----------------------------FN_DYNVARS_164_04------------------------------------#' +# +# With a no key WHERE Clause +# +--echo Expected error : Update without key in safe mode +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +DELETE FROM t1 WHERE b='val1'; +SELECT * FROM t1; + +--echo '#-----------------------------FN_DYNVARS_164_05------------------------------------#' +# +# With a key WHERE Clause +# +--echo This one should work +DELETE FROM t1 WHERE a=1; +SELECT * FROM t1; + +--echo +--echo Value OFF +--echo +# +# Value OFF +# + +SET SESSION sql_safe_updates = OFF; + +--echo '#-----------------------------FN_DYNVARS_164_06------------------------------------#' +# +# With a no key WHERE Clause +# +--echo This one should work +DELETE FROM t1 WHERE b='val1'; +SELECT * FROM t1; + +--echo '#-----------------------------FN_DYNVARS_164_07------------------------------------#' +# +# With a key WHERE Clause +# +--echo This one should work +DELETE FROM t1 WHERE a=1; +SELECT * FROM t1; + +--echo '#-----------------------------FN_DYNVARS_164_08------------------------------------#' +# +# With a LIMIT Clause +# +--echo This one should work +DELETE FROM t1 LIMIT 2; +SELECT * FROM t1; + +--echo '#-----------------------------FN_DYNVARS_164_09------------------------------------#' +# +# Without WHERE Clause +# +--echo This one should work +--echo DELETE FROM t1; +--error ER_MIXING_NOT_ALLOWED +#DELETE FROM t1; +--echo Bug#35392 Unexpected error occurs in this statement Can't change size of the file +--echo statement is remarked because the error is uncatchable by testing framework +SELECT * FROM t1; + +PREPARE stmt FROM 'DELETE FROM t1;'; +--echo Expected error : Update without key in safe mode +--error ER_MIXING_NOT_ALLOWED +#EXECUTE stmt; +--echo Bug#35392 Unexpected error occurs in this statement Can't change size of the file +--echo statement is remarked because the error is uncatchable by testing framework +DEALLOCATE PREPARE stmt; + + +--echo '#----------------------------FN_DYNVARS_164_10--------------------------------------#' +# +# Session data integrity check +# + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_safe_updates; +--echo 0 / FALSE Expected + +SET SESSION sql_safe_updates = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_safe_updates; +--echo 0 / FALSE Expected + +SET SESSION sql_safe_updates = TRUE; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_safe_updates; +--echo 1 / TRUE Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_safe_updates; +--echo 0 / FALSE Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +SET SESSION sql_safe_updates = @default_sql_safe_updates; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test new file mode 100644 index 00000000000..ed582949aa0 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test @@ -0,0 +1,209 @@ +############# mysql-test\t\sql_select_limit_func.test ##################### +# # +# Variable Name: sql_select_limit # +# Scope: GLOBAL, SESSION # +# Access Type: Dynamic # +# Data Type: NUMERIC # +# Default Value: 4294967295 # +# Values: 1-4294967295 # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_select_limit" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @session_sql_select_limit = @@SESSION.sql_select_limit; +SET @global_sql_select_limit = @@GLOBAL.sql_select_limit; + +# +# Creating tables +# + +CREATE TEMPORARY TABLE t1(a int PRIMARY KEY, b varchar(20)); +CREATE TEMPORARY TABLE t2(a int PRIMARY KEY, b varchar(20)); +CREATE TEMPORARY TABLE t3(a int PRIMARY KEY, b varchar(20)); + +INSERT INTO t1 VALUES(1, 'val1'); +INSERT INTO t1 VALUES(2, 'val2'); +INSERT INTO t1 VALUES(3, 'val3'); +INSERT INTO t1 VALUES(4, 'val4'); +INSERT INTO t1 VALUES(5, 'val5'); +INSERT INTO t1 VALUES(6, 'val6'); +INSERT INTO t1 VALUES(7, 'val7'); +INSERT INTO t1 VALUES(8, 'val8'); +INSERT INTO t1 VALUES(9, 'val9'); + +INSERT INTO t2 VALUES(5, 'val5'); +INSERT INTO t2 VALUES(6, 'val6'); +INSERT INTO t2 VALUES(7, 'val7'); +INSERT INTO t2 VALUES(8, 'val8'); +INSERT INTO t2 VALUES(9, 'val9'); + + + +--echo '#-----------------------------FN_DYNVARS_165_01-----------------#' +--echo +--echo Value DEFAULT +--echo +# +# Value DEFAULT +# + +--enable_info + +SET SESSION sql_select_limit = DEFAULT; + +SELECT * FROM t1; +--echo Expecting affected rows: 9 + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo Expecting affected rows: 5 + + +--echo '#-----------------------------FN_DYNVARS_165_02---------------#' +# +# Small value +# + +SET SESSION sql_select_limit = 2; + +SELECT * FROM t1; +--echo Expecting affected rows: 2 + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +--echo Expecting affected rows: 2 + +--echo '#-----------------------------FN_DYNVARS_165_03---------------#' +# +# Small value with LIMIT Clause +# + +SET SESSION sql_select_limit = 2; + +SELECT * FROM t1 LIMIT 4; +--echo Expecting affected rows: 4 + +SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a LIMIT 3; +--echo Expecting affected rows: 3 + +--echo '#-----------------------------FN_DYNVARS_165_04----------------#' +# +# Small value with Store procedure +# + +SET SESSION sql_select_limit = 2; + +delimiter |; + +CREATE PROCEDURE TestProc() +BEGIN + SELECT * FROM t1; +END| +delimiter ;| + +call TestProc(); +--echo Expecting affected rows: 9 + +DROP PROCEDURE TestProc; + +delimiter |; + +CREATE PROCEDURE TestProc() +BEGIN + SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a; +END| +delimiter ;| + +call TestProc(); +--echo Expecting affected rows: 5 + +DROP PROCEDURE TestProc; + +--echo '#-----------------------------FN_DYNVARS_165_05-----------------#' +# +# Small value with Non result producing SELECT statements +# + +SET SESSION sql_select_limit = 2; + +CREATE TEMPORARY TABLE t4(a int PRIMARY KEY, b varchar(20)) SELECT * FROM t2; +--echo Expecting Records: 5 + +INSERT INTO t3 SELECT * FROM t1; +--echo Expecting Records: 9 + +--echo '#-----------------------------FN_DYNVARS_165_06---------------------#' +# +# Session data integrity check & GLOBAL Value check +# +--disable_info + +SET GLOBAL sql_select_limit = 2; + +--echo ** Connecting con_int2 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_select_limit; +--echo 2 Expected + +SET SESSION sql_select_limit = 10; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_select_limit; +--echo 2 Expected + +SET SESSION sql_select_limit = 12; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_select_limit; +--echo 12 Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_select_limit; +--echo 10 Expected + +SELECT @@GLOBAL.sql_select_limit; +--echo 2 Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +--disable_info + +SET @@SESSION.sql_select_limit = @session_sql_select_limit; +SET @@GLOBAL.sql_select_limit = @global_sql_select_limit; + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; diff --git a/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test new file mode 100644 index 00000000000..e7d9098aee9 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_slave_skip_counter_basic.test @@ -0,0 +1,109 @@ +############## mysql-test\t\sql_slave_skip_counter_basic.test ################# +# # +# Variable Name: sql_slave_skip_counter # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_slave_skip_counter # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc +--source include/load_sysvars.inc + +################################################################ +# START OF sql_slave_skip_counter TESTS # +################################################################ + +--echo '#--------------------FN_DYNVARS_165_01-------------------------#' +############################################################# +# Try accessing initial value # +############################################################# + +--Error ER_VAR_CANT_BE_READ +SET @start_global_value = @@global.sql_slave_skip_counter; +--Error ER_VAR_CANT_BE_READ +SELECT @@global.sql_slave_skip_counter; + +--echo 'Info:This value is write only. Value can not be read' + +--echo '#--------------------FN_DYNVARS_165_02-------------------------#' +################################################################### +# Try setting DEFAULT value to variable # +################################################################### + +--Error ER_NO_DEFAULT +SET @@global.sql_slave_skip_counter = DEFAULT; + + +--echo '#--------------------FN_DYNVARS_165_03-------------------------#' +################################################################### +# Try setting any valid value to variable # +################################################################### + +SET @@global.sql_slave_skip_counter = 0; +SET @@global.sql_slave_skip_counter = 5; +SET @@global.sql_slave_skip_counter = 1024; +SET @@global.sql_slave_skip_counter = 2147483648; +SET @@global.sql_slave_skip_counter = 2147483648*2; +SET @@global.sql_slave_skip_counter = 2147483648*2-1; +SET @@global.sql_slave_skip_counter = 4294967295*4294967295; + + +--echo '#--------------------FN_DYNVARS_165_03-------------------------#' +################################################################### +# Checking invalid value for variable # +################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.sql_slave_skip_counter = '5'; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.sql_slave_skip_counter = 5.5; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.sql_slave_skip_counter = -.5; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.sql_slave_skip_counter = -.0; + + +--echo '#--------------------FN_DYNVARS_165_03-------------------------#' +################################################################### +# Try retrieving value from Information Schema # +################################################################### + +SET @@global.sql_slave_skip_counter = 1024; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_slave_skip_counter'; + + +--echo '#--------------------FN_DYNVARS_165_03-------------------------#' +################################################################### +# Checking if variable is accessible with session scope # +################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@sql_slave_skip_counter = 10; +--Error ER_GLOBAL_VARIABLE +SET @@session.sql_slave_skip_counter = 12; +--Error ER_GLOBAL_VARIABLE +SET @@local.sql_slave_skip_counter = 13; + +######################################################## +# END OF sql_slave_skip_counter TESTS # +######################################################## + diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test new file mode 100644 index 00000000000..f740403ceda --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test @@ -0,0 +1,182 @@ +################# mysql-test\t\sql_warnings_basic.test ######################## +# # +# Variable Name: sql_warnings # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: # +# Valid Values:0,1 # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable sql_warnings # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + + +######################################################################## +# START OF sql_warnings TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of sql_warnings in a temporary variable # +############################################################################## + +SET @session_start_value = @@session.sql_warnings; +SELECT @session_start_value; + + +--echo '#--------------------FN_DYNVARS_166_01------------------------#' +######################################################################## +# Display the DEFAULT value of sql_warnings # +######################################################################## + +SET @@session.sql_warnings = 0; +SET @@session.sql_warnings = DEFAULT; +SELECT @@session.sql_warnings; + +SET @@session.sql_warnings = 1; +SET @@session.sql_warnings = DEFAULT; +SELECT @@session.sql_warnings; + + +--echo '#---------------------FN_DYNVARS_166_02-------------------------#' +############################################################################# +# Check if sql_warnings can be accessed with and without @@ sign # +############################################################################# + +SET sql_warnings = 1; +SELECT @@sql_warnings; + +--Error ER_UNKNOWN_TABLE +SELECT session.sql_warnings; + +--Error ER_UNKNOWN_TABLE +SELECT local.sql_warnings; + +SET session sql_warnings = 0; +SELECT @@session.sql_warnings; + + +--echo '#--------------------FN_DYNVARS_166_03------------------------#' +######################################################################## +# change the value of sql_warnings to a valid value # +######################################################################## + +SET @@session.sql_warnings = 0; +SELECT @@session.sql_warnings; +SET @@session.sql_warnings = 1; +SELECT @@session.sql_warnings; + + +--echo '#--------------------FN_DYNVARS_166_04-------------------------#' +########################################################################### +# Change the value of sql_warnings to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = -0.6; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = 1.9; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = TRÜE; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = ÕN; + +SET @@session.sql_warnings = OF; +SELECT @@session.sql_warnings; + +--echo 'Bug# 34828: OF is taken as OFF and a value of 0 is set.' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = ÓFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = '¹'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.sql_warnings = NO; + + +--echo '#-------------------FN_DYNVARS_166_05----------------------------#' +########################################################################### +# Test if accessing global sql_warnings gives error # +########################################################################### + +--Error ER_LOCAL_VARIABLE +SET @@global.sql_warnings = 0; + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@global.sql_warnings; + + +--echo '#----------------------FN_DYNVARS_166_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sql_warnings'; + + +--echo '#----------------------FN_DYNVARS_166_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@session.sql_warnings = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_warnings'; +SELECT @@session.sql_warnings; +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='sql_warnings'; +--echo 'Bug: value in information schema does not match' + +--echo '#---------------------FN_DYNVARS_166_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@session.sql_warnings = OFF; +SELECT @@session.sql_warnings; +SET @@session.sql_warnings = ON; +SELECT @@session.sql_warnings; + +--echo '#---------------------FN_DYNVARS_166_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@session.sql_warnings = TRUE; +SELECT @@session.sql_warnings; +SET @@session.sql_warnings = FALSE; +SELECT @@session.sql_warnings; + +############################## +# Restore initial value # +############################## + +SET @@session.sql_warnings = @session_start_value; +SELECT @@session.sql_warnings; + + +############################################################### +# END OF sql_warnings TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_func.test b/mysql-test/suite/sys_vars/t/sql_warnings_func.test new file mode 100644 index 00000000000..e7705d1f146 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sql_warnings_func.test @@ -0,0 +1,120 @@ +############# mysql-test\t\sql_warnings_func.test ######################### +# # +# Variable Name: sql_warnings # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: FALSE 0 # +# Values: TRUE 1, FALSE 0 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "sql_warnings" # +# that checks behavior of this variable in the following ways# +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +########################################################################### + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @default_sql_warnings = @@sql_warnings; + +# +# Creating tables +# + +CREATE TEMPORARY TABLE t1(a varchar(5), b varchar(20)); + +--enable_info +--disable_warnings + +--echo '#-----------------------------FN_DYNVARS_167_01------------#' +# +# Value DEFAULT +# +SET @@sql_warnings = DEFAULT; + +INSERT INTO t1 VALUES('abcdef', 'val1'); + +--echo '#-----------------------------FN_DYNVARS_167_02------------------#' +# +# OFF value +# + +SET @@sql_warnings = 0; + +INSERT INTO t1 VALUES('abcdef', 'val1'); + +--echo '#-----------------------------FN_DYNVARS_167_03---------------#' +# +# ON value +# + +SET @@sql_warnings = 1; + +INSERT INTO t1 VALUES('abcdef', 'val1'); + + +--echo '#----------------------------FN_DYNVARS_167_04---------------#' +# +# Session data integrity check Value check +# + +--disable_info + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_warnings; +--echo 0 / FALSE Expected + +SET SESSION sql_warnings = FALSE; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_warnings; +--echo 0 / FALSE Expected + +SET SESSION sql_warnings = TRUE; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.sql_warnings; +--echo 1 / TRUE Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.sql_warnings; +--echo 0 / FALSE Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + +DROP TABLE t1; + +SET @@sql_warnings = @default_sql_warnings; + +--disable_info +--enable_warnings diff --git a/mysql-test/suite/sys_vars/t/ssl_ca_basic.test b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test new file mode 100644 index 00000000000..c369f1f0894 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ssl_ca_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\ssl_ca_basic.test ############################# +# # +# Variable Name: ssl_ca # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable ssl_ca # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +-- source include/have_ssl.inc + +--echo '#---------------------BS_STVARS_045_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.ssl_ca); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_045_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.ssl_ca=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.ssl_ca); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_045_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.ssl_ca = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_ca'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.ssl_ca); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_ca'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_045_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@ssl_ca = @@GLOBAL.ssl_ca; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_045_05----------------------#' +################################################################################ +# Check if ssl_ca can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@ssl_ca); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.ssl_ca); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.ssl_ca); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.ssl_ca); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT ssl_ca = @@SESSION.ssl_ca; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/ssl_capath_basic.test b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test new file mode 100644 index 00000000000..c32b572fb1b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ssl_capath_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\ssl_capath_basic.test ######################### +# # +# Variable Name: ssl_capath # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable ssl_capath # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_046_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.ssl_capath); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_046_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.ssl_capath=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.ssl_capath); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_046_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.ssl_capath = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_capath'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.ssl_capath); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_capath'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_046_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@ssl_capath = @@GLOBAL.ssl_capath; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_046_05----------------------#' +################################################################################ +# Check if ssl_capath can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@ssl_capath); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.ssl_capath); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.ssl_capath); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.ssl_capath); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT ssl_capath = @@SESSION.ssl_capath; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/ssl_cert_basic.test b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test new file mode 100644 index 00000000000..c3b69bd495f --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ssl_cert_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\ssl_cert_basic.test ########################### +# # +# Variable Name: ssl_cert # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable ssl_cert # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +-- source include/have_ssl.inc + +--echo '#---------------------BS_STVARS_047_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.ssl_cert); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_047_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.ssl_cert=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.ssl_cert); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_047_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.ssl_cert = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_cert'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.ssl_cert); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_cert'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_047_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@ssl_cert = @@GLOBAL.ssl_cert; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_047_05----------------------#' +################################################################################ +# Check if ssl_cert can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@ssl_cert); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.ssl_cert); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.ssl_cert); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.ssl_cert); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT ssl_cert = @@SESSION.ssl_cert; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test new file mode 100644 index 00000000000..425f7aae442 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ssl_cipher_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\ssl_cipher_basic.test ######################### +# # +# Variable Name: ssl_cipher # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable ssl_cipher # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_048_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.ssl_cipher); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_048_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.ssl_cipher=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.ssl_cipher); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_048_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.ssl_cipher = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_cipher'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.ssl_cipher); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_cipher'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_048_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@ssl_cipher = @@GLOBAL.ssl_cipher; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_048_05----------------------#' +################################################################################ +# Check if ssl_cipher can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@ssl_cipher); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.ssl_cipher); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.ssl_cipher); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.ssl_cipher); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT ssl_cipher = @@SESSION.ssl_cipher; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/ssl_key_basic.test b/mysql-test/suite/sys_vars/t/ssl_key_basic.test new file mode 100644 index 00000000000..4616f281c27 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/ssl_key_basic.test @@ -0,0 +1,102 @@ + + +################## mysql-test\t\ssl_key_basic.test ############################ +# # +# Variable Name: ssl_key # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable ssl_key # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +-- source include/have_ssl.inc + +--echo '#---------------------BS_STVARS_049_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.ssl_key); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_049_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.ssl_key=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.ssl_key); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_049_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.ssl_key = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_key'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.ssl_key); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='ssl_key'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_049_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@ssl_key = @@GLOBAL.ssl_key; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_049_05----------------------#' +################################################################################ +# Check if ssl_key can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@ssl_key); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.ssl_key); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.ssl_key); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.ssl_key); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT ssl_key = @@SESSION.ssl_key; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/sys_vars/t/storage_engine_basic.test b/mysql-test/suite/sys_vars/t/storage_engine_basic.test new file mode 100644 index 00000000000..689afcd1010 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/storage_engine_basic.test @@ -0,0 +1,180 @@ +############## mysql-test\t\storage_engine_basic.test ################## +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable # +# storage_engine that check behavior of this # +# variable with valid values, invalid values, accessing # +# variable with scope that is allowed and with scope that # +# is now allowed. # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_storage_engine # +# # +######################################################################## + +--source include/have_innodb.inc +--source include/load_sysvars.inc + +###################################################################### +# START OF storage_engine TESTS # +###################################################################### + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.storage_engine; +SELECT @start_global_value; +SET @start_session_value = @@session.storage_engine; +SELECT @start_session_value; + + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +###################################################################### +# Display the DEFAULT value of storage_engine # +###################################################################### + +SET @@global.storage_engine = MYISAM; + +--Error ER_NO_DEFAULT +SET @@global.storage_engine = DEFAULT; +SELECT @@global.storage_engine; + +SET @@session.storage_engine = INNODB; +SET @@session.storage_engine = DEFAULT; +SELECT @@session.storage_engine; + + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +######################################################################## +# Change the value of storage_engine to a valid value for GLOBAL Scope # +######################################################################## + +SET @@global.storage_engine = MYISAM; +SELECT @@global.storage_engine; +SET @@global.storage_engine = MERGE; +SELECT @@global.storage_engine; +SET @@global.storage_engine = MEMORY; +SELECT @@global.storage_engine; +SET @@global.storage_engine = INNODB; +SELECT @@global.storage_engine; + + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +######################################################################### +# Change the value of storage_engine to a valid value for SESSION Scope # +######################################################################### + +SET @@session.storage_engine = MYISAM; +SELECT @@session.storage_engine; +SET @@session.storage_engine = MERGE; +SELECT @@session.storage_engine; +SET @@session.storage_engine = MEMORY; +SELECT @@session.storage_engine; +SET @@session.storage_engine = INNODB; +SELECT @@session.storage_engine; + + +--echo '#------------------FN_DYNVARS_005_04-----------------------#' +################################################################## +# Change the value of storage_engine to an invalid value # +################################################################## + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.storage_engine = 8199; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.storage_engine = -1024; + +--Error ER_PARSE_ERROR +SET @@global.storage_engine = 65530.34.; + +--Error ER_UNKNOWN_STORAGE_ENGINE +SET @@global.storage_engine = FILE; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@session.storage_engine = 8199; + +--Error ER_PARSE_ERROR +SET @@session.storage_engine = 65530.34.; + +--Error ER_UNKNOWN_STORAGE_ENGINE +SET @@session.storage_engine = RECORD; + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.storage_engine = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES + WHERE VARIABLE_NAME='storage_engine'; + +--echo '#------------------FN_DYNVARS_005_06-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.storage_engine = + VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES + WHERE VARIABLE_NAME='storage_engine'; + + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if TRUE and FALSE values can be used on variable # +#################################################################### + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.storage_engine = TRUE; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.storage_engine = FALSE; + + +--echo '#---------------------FN_DYNVARS_001_8----------------------#' +############################################################### +# Check if accessing variable with SESSION,LOCAL and without # +# SCOPE points to same session variable # +############################################################### + +SET @@storage_engine = MYISAM; +SELECT @@storage_engine = @@local.storage_engine; +SELECT @@local.storage_engine = @@session.storage_engine; + + +--echo '#---------------------FN_DYNVARS_001_9----------------------#' +######################################################################### +# Check if storage_engine can be accessed with and without @@ sign # +######################################################################### + +SET storage_engine = MEMORY; +SELECT @@storage_engine; +--Error ER_UNKNOWN_TABLE +SELECT local.storage_engine; +--Error ER_UNKNOWN_TABLE +SELECT session.storage_engine; +--Error ER_BAD_FIELD_ERROR +SELECT storage_engine = @@session.storage_engine; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.storage_engine = @start_global_value; +SELECT @@global.storage_engine; +SET @@session.storage_engine = @start_session_value; +SELECT @@session.storage_engine; + + +############################################################# +# END OF storage_engine TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/sync_frm_basic.test b/mysql-test/suite/sys_vars/t/sync_frm_basic.test new file mode 100644 index 00000000000..6c00182a805 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/sync_frm_basic.test @@ -0,0 +1,163 @@ +############## mysql-test\t\sync_frm_basic.test ############################### +# # +# Variable Name: sync_frm # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: TRUE # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable sync_frm # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +############################################################## +# START OF sync_frm TESTS # +############################################################## + + +################################################################ +# Saving initial value of sync_frm in a temporary variable # +################################################################ + +SET @start_value = @@global.sync_frm; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_169_01------------------------#' +###################################################### +# Display the DEFAULT value of sync_frm # +###################################################### + +SET @@global.sync_frm = FALSE; +SET @@global.sync_frm = DEFAULT; +SELECT @@global.sync_frm; + + +--echo '#---------------------FN_DYNVARS_169_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.sync_frm = DEFAULT; +SELECT @@global.sync_frm = TRUE; + + +--echo '#--------------------FN_DYNVARS_169_03------------------------#' +###################################################### +# Change the value of sync_frm to a valid value # +###################################################### + +SET @@global.sync_frm = ON; +SELECT @@global.sync_frm; +SET @@global.sync_frm = OFF; +SELECT @@global.sync_frm; +SET @@global.sync_frm = 0; +SELECT @@global.sync_frm; +SET @@global.sync_frm = 1; +SELECT @@global.sync_frm; +SET @@global.sync_frm = TRUE; +SELECT @@global.sync_frm; +SET @@global.sync_frm = FALSE; +SELECT @@global.sync_frm; + +--echo '#--------------------FN_DYNVARS_169_04-------------------------#' +#################################################################### +# Change the value of sync_frm to invalid value # +#################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = TRUEF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = TRUE_F; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = FALSE0; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = OON; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = ONN; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = OOFF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = ' '; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = " "; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.sync_frm = ''; + + +--echo '#-------------------FN_DYNVARS_169_05----------------------------#' +#################################################################### +# Test if accessing session sync_frm gives error # +#################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.sync_frm = 1; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.sync_frm; + + +--echo '#----------------------FN_DYNVARS_169_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.sync_frm = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='sync_frm'; + +--echo '#---------------------FN_DYNVARS_169_07----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same session variable # +############################################################################### + +SET @@global.sync_frm = 1; +SELECT @@sync_frm = @@global.sync_frm; + + +--echo '#---------------------FN_DYNVARS_169_08----------------------#' +################################################################### +# Check if sync_frm can be accessed with and without @@ sign # +################################################################### + +--Error ER_GLOBAL_VARIABLE +SET sync_frm = 1; +SELECT @@sync_frm; +--Error ER_PARSE_ERROR +SET global.sync_frm = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.sync_frm; +--Error ER_BAD_FIELD_ERROR +SELECT sync_frm = @@session.sync_frm; + + +############################## +# Restore initial value # +############################## + +SET @@global.sync_frm = @start_value; +SELECT @@global.sync_frm; + + +###################################################### +# END OF sync_frm TESTS # +###################################################### diff --git a/mysql-test/suite/sys_vars/t/system_time_zone_basic.test b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test new file mode 100644 index 00000000000..0dfc850d227 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/system_time_zone_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\system_time_zone_basic.test ################### +# # +# Variable Name: system_time_zone # +# Scope: Global # +# Access Type: Static # +# Data Type: string # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable system_time_zone # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_050_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.system_time_zone); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_050_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.system_time_zone=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.system_time_zone); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_050_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.system_time_zone = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='system_time_zone'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.system_time_zone); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='system_time_zone'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_050_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@system_time_zone = @@GLOBAL.system_time_zone; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_050_05----------------------#' +################################################################################ +# Check if system_time_zone can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@system_time_zone); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.system_time_zone); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.system_time_zone); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.system_time_zone); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT system_time_zone = @@SESSION.system_time_zone; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test new file mode 100644 index 00000000000..63296590511 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test @@ -0,0 +1,159 @@ +############## mysql-test\t\table_definition_cache_basic.test ################## +# # +# Variable Name: table_definition_cache # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: Numeric # +# Default Value: 128 # +# Range: 1 - 524288 # +# # +# # +# Creation Date: 2008-03-16 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable "table_definition_cache" # +# that checks behavior of this variable in the following ways # +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity . # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_table_definition_cache # +# # +################################################################################ + +--source include/load_sysvars.inc + +############################################################### +# START OF table_definition_cache TESTS # +############################################################### + +############################################################################## +# Saving initial value of table_definition_cache in a temporary variable # +############################################################################## + +SET @start_value = @@global.table_definition_cache; +SELECT @start_value; + +--echo '#--------------------FN_DYNVARS_019_01------------------------#' +####################################################################### +# Display the DEFAULT value of table_definition_cache # +####################################################################### + +SET @@global.table_definition_cache = 100; +SET @@global.table_definition_cache = DEFAULT; +SELECT @@global.table_definition_cache; + + +--echo '#---------------------FN_DYNVARS_019_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.table_definition_cache = DEFAULT; +SELECT @@global.table_definition_cache = 128; + + +--echo '#--------------------FN_DYNVARS_019_03------------------------#' +############################################################################## +# Change the value of table_definition_cache to a valid value # +############################################################################## + +SET @@global.table_definition_cache = 1; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = 2; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = 524287; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = 524288; +SELECT @@global.table_definition_cache; + + +--echo '#--------------------FN_DYNVARS_019_04-------------------------#' +################################################################################# +# Change the value of table_definition_cache to invalid value # +################################################################################# + +SET @@global.table_definition_cache = 0; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = -1024; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = 524289; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = 42949672950; +SELECT @@global.table_definition_cache; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_definition_cache = 21221204.10; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_definition_cache = ON; + + +--echo '#-------------------FN_DYNVARS_019_05----------------------------#' +################################################################################# +# Test if accessing session table_definition_cache gives error # +################################################################################# + +--Error ER_GLOBAL_VARIABLE +SET @@session.table_definition_cache = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.table_definition_cache; + + +--echo '#----------------------FN_DYNVARS_019_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.table_definition_cache = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='table_definition_cache'; + + +--echo '#---------------------FN_DYNVARS_019_07----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.table_definition_cache = TRUE; +SELECT @@global.table_definition_cache; +SET @@global.table_definition_cache = FALSE; +SELECT @@global.table_definition_cache; + + +--echo '#---------------------FN_DYNVARS_019_08----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.table_definition_cache = 5; +SELECT @@table_definition_cache = @@global.table_definition_cache; + +--echo '#---------------------FN_DYNVARS_019_09----------------------#' +################################################################################ +# Check if table_definition_cache can be accessed with and without @@ sign # +################################################################################ + +--Error ER_GLOBAL_VARIABLE +SET table_definition_cache = 1; +--Error ER_PARSE_ERROR +SET global.table_definition_cache = 1; +--Error ER_UNKNOWN_TABLE +SELECT global.table_definition_cache; +--Error ER_BAD_FIELD_ERROR +SELECT table_definition_cache = @@session.table_definition_cache; + +############################## +# Restore initial value # +############################## + +SET @@global.table_definition_cache = @start_value; +SELECT @@global.table_definition_cache; + + +################################################################ +# END OF table_definition_cache TESTS # +################################################################ + diff --git a/mysql-test/suite/sys_vars/t/table_lock_wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/table_lock_wait_timeout_basic.test new file mode 100644 index 00000000000..43186c70874 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/table_lock_wait_timeout_basic.test @@ -0,0 +1,172 @@ +############## mysql-test\t\table_lock_wait_timeout_basic.test ################ +# # +# Variable Name: table_lock_wait _timeout # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 50 # +# Range: 1-1073741824 # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable table_lock_wait_timeout # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_table_lock_wait_timeout # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF table_lock_wait_timeout TESTS # +######################################################################## + + +########################################################################## +# Saving initial value of table_lock_wait_timeout in a temporary variable# +########################################################################## + +SET @start_value = @@global.table_lock_wait_timeout; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_001_01------------------------#' +######################################################################## +# Display the DEFAULT value of table_lock_wait_timeout # +######################################################################## + +SET @@global.table_lock_wait_timeout = 99; +SET @@global.table_lock_wait_timeout = DeFAULT; +SELECT @@global.table_lock_wait_timeout; + + +--echo '#---------------------FN_DYNVARS_001_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.table_lock_wait_timeout =Default; +SELECT @@global.table_lock_wait_timeout = 50; + +--echo '#--------------------FN_DYNVARS_001_03------------------------#' +######################################################################## +# Change the value of table_lock_wait_timeout to a valid value # +######################################################################## + + +SET @@global.table_lock_wait_timeout = 8; +SELECT @@global.table_lock_wait_timeout ; + +SET @@global.table_lock_wait_timeout = 1; +SELECT @@global.table_lock_wait_timeout ; +SET @@global.table_lock_wait_timeout = 1073741824; +SELECT @@global.table_lock_wait_timeout ; +SET @@global.table_lock_wait_timeout = 18000; +SELECT @@global.table_lock_wait_timeout ; +SET @@global.table_lock_wait_timeout = 65535; +SELECT @@global.table_lock_wait_timeout ; + + + +--echo '#--------------------FN_DYNVARS_001_04-------------------------#' +######################################################################### +# Change the value of table_lock_wait_timeout to invalid value # +######################################################################### + +SET @@global.table_lock_wait_timeout = -1; + +SET @@global.table_lock_wait_timeout= 100000000000; + +SET @@global.table_lock_wait_timeout= -1024; + +SET @@global.table_lock_wait_timeout= 0; +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_lock_wait_timeout= 10000.01; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_lock_wait_timeout= ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_lock_wait_timeout= 'test'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_lock_wait_timeout= ''; + + +--echo '#-------------------FN_DYNVARS_001_05----------------------------#' +########################################################################### +# Test if accessing session table_lock_wait_timeout gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.table_lock_wait_timeout= 0; +SELECT @@table_lock_wait_timeout; + + +--echo '#----------------------FN_DYNVARS_001_06------------------------#' +############################################################################## +# Check if the value in GLOBAL & SESSION Tables matches values in variable # +############################################################################## + +SELECT @@global.table_lock_wait_timeout= VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='table_lock_wait_timeout'; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.table_lock_wait_timeout= TRUE; +SELECT @@global.table_lock_wait_timeout; + +SET @@global.table_lock_wait_timeout= FALSE; +SELECT @@global.table_lock_wait_timeout; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################### +# Check if accessing variable without SCOPE points to same global variable # +############################################################################### + +SET @@global.table_lock_wait_timeout= 10; +SELECT @@table_lock_wait_timeout= @@global.table_lock_wait_timeout; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +############################################################################### +# Check if table_lock_wait_timeout can be accessed with and without @@ sign # +############################################################################### + +--Error ER_GLOBAL_VARIABLE +SET table_lock_wait_timeout= 8; +--Error ER_PARSE_ERROR +SET global.table_lock_wait_timeout= 10; +--Error ER_UNKNOWN_TABLE +SELECT global.table_lock_wait_timeout; +--Error ER_BAD_FIELD_ERROR +SELECT table_lock_wait_timeout= @@session.table_lock_wait_timeout; + + +############################## +# Restore initial value # +############################## + +SET @@global.table_lock_wait_timeout= @start_value; +SELECT @@global.table_lock_wait_timeout; + + +######################################################################## +# END OF table_lock_wait_timeout TESTS # +######################################################################## + + diff --git a/mysql-test/suite/sys_vars/t/table_open_cache_basic.test b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test new file mode 100644 index 00000000000..23f60bde00a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test @@ -0,0 +1,177 @@ +############## mysql-test\t\table_open_cache_basic.test ####################### +# # +# Variable Name: table_open_cache # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: 64 # +# Range: 1-524288 # +# # +# # +# Creation Date: 2008-02-13 # +# Author: Salman # +# # +# Description: Test Cases of Dynamic System Variable table_open_cache # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_table_open_cache # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF table_open_cache TESTS # +######################################################################## + + +########################################################################## +# Saving initial value of table_open_cache in a temporary variable # +########################################################################## + +SET @start_value = @@global.table_open_cache ; +SELECT @start_value; + + +--echo '#--------------------FN_DYNVARS_001_01------------------------#' +######################################################################## +# Display the DEFAULT value of table_open_cache # +######################################################################## + +SET @@global.table_open_cache = 99; +SET @@global.table_open_cache = DeFAULT; +SELECT @@global.table_open_cache; + + +--echo '#---------------------FN_DYNVARS_001_02-------------------------#' +############################################### +# Verify default value of variable # +############################################### + +SET @@global.table_open_cache = Default; +SELECT @@global.table_open_cache = 64; + +--echo '#--------------------FN_DYNVARS_001_03------------------------#' +######################################################################## +# Change the value of table_open_cache to a valid value # +######################################################################## + + +SET @@global.table_open_cache = 8; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = 1; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = 1073741824; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = 18000; +SELECT @@global.table_open_cache ; +SET @@global.table_open_cache = 65535; +SELECT @@global.table_open_cache ; + + + +--echo '#--------------------FN_DYNVARS_001_04-------------------------#' +####################################################################### +# Change the value of table_open_cache to invalid value # +####################################################################### + +SET @@global.table_open_cache = -1; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = 100000000000; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = -1024; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = 0; +SELECT @@global.table_open_cache ; + +--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; + + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_open_cache = 10000.01; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_open_cache = ON; +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_open_cache= 'test'; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.table_open_cache = ''; + + +--echo '#-------------------FN_DYNVARS_001_05----------------------------#' +########################################################################### +# Test if accessing session table_open_cache gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.table_open_cache = 0; + + +--echo '#----------------------FN_DYNVARS_001_06------------------------#' +#################################################################### +# Check if the value in GLOBAL Tables matches values in variable # +#################################################################### + +SELECT @@global.table_open_cache = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='table_open_cache '; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.table_open_cache = TRUE; +SELECT @@global.table_open_cache ; + +SET @@global.table_open_cache = FALSE; +SELECT @@global.table_open_cache ; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################## +# Check if accessing variable without SCOPE points to same session variable # +############################################################################## + +SET @@global.table_open_cache = 10; +SELECT @@table_open_cache = @@global.table_open_cache ; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +########################################################################## +# Check if table_open_cache can be accessed with and without @@ sign # +########################################################################## + +--Error ER_GLOBAL_VARIABLE +SET table_open_cache = 8; +--Error ER_PARSE_ERROR +SET global.table_open_cache = 10; +--Error ER_UNKNOWN_TABLE +SELECT global.table_open_cache ; +--Error ER_BAD_FIELD_ERROR +SELECT table_open_cache = @@session.table_open_cache ; + + +############################## +# Restore initial value # +############################## + +SET @@global.table_open_cache = @start_value; +SELECT @@global.table_open_cache ; + + +################################################################## +# END OF table_open_cache TESTS # +################################################################## + diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test new file mode 100644 index 00000000000..fe9f4242c0d --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test @@ -0,0 +1,118 @@ +############# mysql-test\t\thread_cache_size_func.test ########################## +# # +# Variable Name: thread_cache_size # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: Enumeration # +# Default Value: 0 # +# Values: 0-16384 # +# # +# # +# Creation Date: 2008-03-02 # +# Author: Sharique Abdullah # +# # +# Modified: HHunger 2008-08-27 Reduced test to needed function and inserted # +# wait-loops # +# # +# Description: Test Cases of Dynamic System Variable "thread_cache_size" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################# + +# +# Setup +# + +--source include/not_embedded.inc + +SET @global_thread_cache_size = @@GLOBAL.thread_cache_size; + +FLUSH STATUS; + +-- ECHO '# Test1#' +SET @@GLOBAL.thread_cache_size=3; +SHOW STATUS LIKE 'Threads_cached'; +--echo 0 Expected + +################################## +# Make 4 connections # +################################## + +--echo ** Connecting conn1 using username 'root' ** +CONNECT (conn1,localhost,root,,); +--echo ** Connecting conn2 using username 'root' ** +CONNECT (conn2,localhost,root,,); +--echo ** Connecting conn3 using username 'root' ** +CONNECT (conn3,localhost,root,,); +--echo ** Connecting conn4 using username 'root' ** +CONNECT (conn4,localhost,root,,); + +--echo ** Connection default ** +CONNECTION default; + +# Wait until all connections done +let $wait_condition= SELECT COUNT(*)= 5 FROM INFORMATION_SCHEMA.PROCESSLIST; +--source include/wait_condition.inc + +SHOW STATUS LIKE 'Threads_cached'; +--echo 0 Expected + +#################################### +#Disconnecting all the connections # +#################################### + +--echo ** Disconnecting conn1,conn2,conn3,conn4 ** +DISCONNECT conn1; +DISCONNECT conn2; +DISCONNECT conn3; +DISCONNECT conn4; + +# +# Checking the status +# + +# Wait until all disconnects ready +let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST; +--source include/wait_condition.inc + +SHOW STATUS LIKE 'Threads_cached'; +--echo 3 Expected + +# +# Decreasing cache size to 1 +# +SET @@GLOBAL.thread_cache_size= 1; + +--echo ** Connecting conn1 using username 'root' ** +CONNECT (conn1,localhost,root,,); +--echo ** Connecting conn2 using username 'root' ** +CONNECT (conn2,localhost,root,,); + +--echo connection default; +CONNECTION default; + +# Wait until all connects ready +let $wait_condition= SELECT COUNT(*)= 3 FROM INFORMATION_SCHEMA.PROCESSLIST; +--source include/wait_condition.inc + +--echo ** Disconnecting conn1,conn2 ** +DISCONNECT conn1; +DISCONNECT conn2; + +# Wait until all disconnects ready +let $wait_condition= SELECT COUNT(*)= 1 FROM INFORMATION_SCHEMA.PROCESSLIST; +--source include/wait_condition.inc + +SHOW STATUS LIKE 'Threads_cached'; +--echo 1 Expected + +# +# Cleanup +# + +SET @@GLOBAL.thread_cache_size = @global_thread_cache_size; + diff --git a/mysql-test/suite/sys_vars/t/thread_handling_basic.test b/mysql-test/suite/sys_vars/t/thread_handling_basic.test new file mode 100644 index 00000000000..bcad003ce93 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/thread_handling_basic.test @@ -0,0 +1,107 @@ + + +################## mysql-test\t\thread_handling_basic.test #################### +# # +# Variable Name: thread_handling # +# Scope: Global # +# Access Type: Static # +# Data Type: enumeration # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable thread_handling # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_051_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.thread_handling); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_051_02----------------------#' +# +# Test case for Bug #35433 +# +#################################################################### +# Check if Value can set # +#################################################################### + + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.thread_handling=1; + +--ECHO Expected error ER_INCORRECT_GLOBAL_LOCAL_VAR + +SELECT COUNT(@@GLOBAL.thread_handling); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_051_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.thread_handling = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='thread_handling'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.thread_handling); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='thread_handling'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_051_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@thread_handling = @@GLOBAL.thread_handling; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_051_05----------------------#' +################################################################################ +# Check if thread_handling can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@thread_handling); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.thread_handling); +--echo Bug:Variable is global so it can not be accessed by local there should be error ER_INCORRECT_GLOBAL_LOCAL_VAR +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.thread_handling); +--ECHO Bug:Variable is global so it can not be accessed by session there should be error ER_INCORRECT_GLOBAL_LOCAL_VAR +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.thread_handling); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT thread_handling = @@SESSION.thread_handling; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/time_zone_basic.test b/mysql-test/suite/sys_vars/t/time_zone_basic.test new file mode 100644 index 00000000000..32616e97534 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/time_zone_basic.test @@ -0,0 +1,325 @@ +################### mysql-test\t\time_zone_basic.test ######################### +# # +# Variable Name: time_zone # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: string # +# Default Value: SYSTEM # +# Range: # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable time_zone # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +####################################################################### +# START OF time_zone TESTS # +####################################################################### + + +####################################################################### +# Saving initial value of time_zone in a temporary variable # +####################################################################### + +SET @global_start_value = @@global.time_zone; +SELECT @global_start_value; + +SET @session_start_value = @@session.time_zone; +SELECT @session_start_value; + + +--echo '#--------------------FN_DYNVARS_001_01------------------------#' +######################################################################## +# Display the DEFAULT value of time_zone # +######################################################################## + +SET @@time_zone = "+02:00"; +SET @@time_zone = DEFAULT; +SELECT @@time_zone; + +SET @@global.time_zone = "-00:30"; +SET @@global.time_zone = DEFAULT; +SELECT @@global.time_zone; + + +--echo '#---------------------FN_DYNVARS_001_02-------------------------#' +############################################################################## +# see if setting global value changes session value and vice versa # +############################################################################## + +SET @@session.time_zone = "+02:00"; +SELECT @@session.time_zone; +SET @@global.time_zone = "+05:00"; +SELECT @@global.time_zone; +SELECT @@session.time_zone AS res_is_02_00; + +SET @@session.time_zone = "-02:00"; +SELECT @@session.time_zone; +SELECT @@global.time_zone AS res_is_05_00; +# composite check +SELECT @@global.time_zone=@@session.time_zone AS res_is_false; + + +--echo '#--------------------FN_DYNVARS_001_03------------------------#' +######################################################################## +# Change the value of time_zone to a valid value # +######################################################################## + +# for session scope + +SET @@time_zone = "+13:00"; +SELECT @@time_zone; +SET @@time_zone = "-12:00"; +SELECT @@time_zone; +SET @@time_zone = "+12:59"; +SELECT @@time_zone; +SET @@time_zone = "-11:30"; +SELECT @@time_zone; +SET @@time_zone = "+00:00"; +SELECT @@time_zone; +SET @@time_zone = "-12:59"; +SELECT @@time_zone; +SET @@time_zone = "-00:00"; +SELECT @@time_zone; +SET @@time_zone = "+10:00"; +SELECT @@time_zone; +SET @@time_zone = "+0:0"; +SELECT @@time_zone; +SET @@time_zone = "-10:00"; +SELECT @@time_zone; +SET @@time_zone = "+2:00"; +SELECT @@time_zone; + +# for global scope + +SET @@global.time_zone = "+13:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "-12:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "+12:59"; +SELECT @@global.time_zone; +SET @@global.time_zone = "-11:30"; +SELECT @@global.time_zone; +SET @@global.time_zone = "+00:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "-12:59"; +SELECT @@global.time_zone; +SET @@global.time_zone = "-00:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "+10:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "+0:0"; +SELECT @@global.time_zone; +SET @@global.time_zone = "-10:00"; +SELECT @@global.time_zone; +SET @@global.time_zone = "+2:00"; +SELECT @@global.time_zone; + + +# these test are dependant on values stored in mysql.time_zone_name + +#SET @@time_zone = "africa/cairo"; +#SELECT @@time_zone; +#SET @@time_zone = "America/Aruba"; +#SELECT @@time_zone; +# +#SET @@time_zone = "Etc/GMT-14"; +#SELECT @@time_zone; +# +#SET @@time_zone = "GMT-0"; +#SELECT @@time_zone; +# +#SET @@time_zone = "UTC"; +#SELECT @@time_zone; + +#--echo 'Bug: Region and zone values cant be set in time_zone. Although values are loaded in mysql.time_zone_name' + +--echo '#--------------------FN_DYNVARS_001_04-------------------------#' +########################################################################### +# Change the value of time_zone to invalid value # +########################################################################### + +# for session scope + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = "+24:00"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = "+23:59"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = "+13:01"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = "-13:01"; + +# for global scope + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = "+24:00"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = "+23:59"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = "+13:01"; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = "-13:01"; + + +#checking time zone names not in mysql.time_zone_name. These test may succeed +#depending on timezone stored + +#SET @@time_zone = "london"; +#SELECT @@time_zone; +# +#SET @@time_zone = "GMT+14"; +#SELECT @@time_zone; + + +--echo '#-------------------FN_DYNVARS_001_05----------------------------#' +########################################################################### +# Assign System time zone to variable for session and global # +########################################################################### + +SET @@global.time_zone = 'SYSTEM'; +SELECT @@global.time_zone; + +SET @@time_zone = 'SYSTEM'; +SELECT @@time_zone; + +--echo '#----------------------FN_DYNVARS_001_06------------------------#' +######################################################################### +# Check if the value in SESSION Table matches value in variable # +######################################################################### + +SELECT @@time_zone = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='time_zone'; + + +--echo '#----------------------FN_DYNVARS_001_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.time_zone = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='time_zone'; + + +--echo '#---------------------FN_DYNVARS_001_08-------------------------#' +############################################################################# +# Check if ON, OFF, TRUE and FALSE values can be used on variable # +############################################################################# +# for session scope +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = OFF; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@time_zone = TRUE; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@time_zone = FALSE; + +# for global scope +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = OFF; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = ON; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.time_zone = TRUE; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.time_zone = FALSE; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +##################################################################### +# Check if Numbers and empty values can be used on variable # +##################################################################### +# for session scope +--Error ER_WRONG_TYPE_FOR_VAR +SET @@time_zone = 1; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@time_zone = +0200; + +--Error ER_PARSE_ERROR +SET @@time_zone = GMT+; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = ""; + +# for global scope +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.time_zone = 1; + +--Error ER_WRONG_TYPE_FOR_VAR +SET @@global.time_zone = +0200; + +--Error ER_PARSE_ERROR +SET @@global.time_zone = GMT+; + +--Error ER_UNKNOWN_TIME_ZONE +SET @@global.time_zone = ""; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +############################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE points +# to same session variable +############################################################################## + +SET @@time_zone = '+02:30'; +SELECT @@time_zone = @@local.time_zone and @@time_zone = @@session.time_zone; +SET @@time_zone = '-01:30'; +SELECT @@time_zone = @@local.time_zone and @@time_zone = @@session.time_zone; + + +--echo '#---------------------FN_DYNVARS_001_11----------------------#' +#################################################################### +# Check if time_zone can be accessed with and without @@ sign # +#################################################################### + +SET time_zone = "+01:00"; +SELECT @@time_zone; +--Error ER_UNKNOWN_TABLE +SELECT local.time_zone; +--Error ER_UNKNOWN_TABLE +SELECT session.time_zone; +--Error ER_BAD_FIELD_ERROR +SELECT time_zone = @@session.time_zone; + +############################## +# Restore initial value # +############################## + +SET @@time_zone = @session_start_value; +SELECT @@time_zone; + +SET @@global.time_zone = @global_start_value; +SELECT @@global.time_zone; + +####################################################################### +# END OF time_zone TESTS # +####################################################################### diff --git a/mysql-test/suite/sys_vars/t/time_zone_func.test b/mysql-test/suite/sys_vars/t/time_zone_func.test new file mode 100644 index 00000000000..1d9bc954d8a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/time_zone_func.test @@ -0,0 +1,188 @@ +############# mysql-test\t\time_zone_func.test ############################# +# # +# Variable Name: time_zone # +# Scope: GLOBAL, SESSION # +# Access Type: Dynamic # +# Data Type: STRING # +# Default Value: TRUE 1, FALSE 0 # +# Values: FALSE 0 # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "time_zone" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +--echo ** Setup ** +--echo +# +# Setup +# + +SET @session_time_zone = @@SESSION.time_zone; +SET @global_time_zone = @@GLOBAL.time_zone; + +CREATE TABLE t1 (a datetime); +CREATE TABLE t2 (a timestamp); + +--echo '#-----------------------------FN_DYNVARS_177_01--------------------#' +# +# Value DEFAULT +# +SET @@time_zone = DEFAULT; + +SELECT @@time_zone; +--echo SYSTEM Expected + +--echo '#-----------------------------FN_DYNVARS_177_02-------------------#' +# +# Testing difference values +# + +SET @@time_zone = '+05:00'; + +SELECT @@time_zone; +--echo +05:00 Expected + +SET @@time_zone = '-01:00'; + +SELECT @@time_zone; +--echo -01:00 Expected + +SET @@time_zone = '+00:00'; + +SELECT @@time_zone; +--echo +00:00 Expected + +SET @@time_zone = '-00:00'; + +SELECT @@time_zone; +--echo -00:00 Expected + +--echo '#-----------------------------FN_DYNVARS_177_03----------------#' +# +# Setting possible values +# + +SET @@time_zone = '+00:00'; + +INSERT INTO t1 VALUES('2008-03-05 16:28:00'); +INSERT INTO t1 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00'); +INSERT INTO t2 VALUES(20080305162800); +INSERT INTO t2 VALUES(19730101235900); +INSERT INTO t2 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00'); +INSERT INTO t2 VALUES(19700101000500); + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = 'MET'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+05:00'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+06:00'; +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+01:00'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+02:00'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+00:00'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +SET @@time_zone = '+06:00'; + +SELECT a,UNIX_TIMESTAMP(a) FROM t1; +SELECT a,UNIX_TIMESTAMP(a) FROM t2; + +--echo Potential Feature: upon recovery of timezone, +--echo the original value of the timestamp should be recovered. + +--echo '#-----------------------------FN_DYNVARS_177_04--------------------#' +# +# Testing invalid values +# +--error ER_UNKNOWN_TIME_ZONE +SET @@time_zone = '6'; + + +--echo '#-----------------------------FN_DYNVARS_177_05---------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL time_zone = 'SYSTEM'; + +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.time_zone; +--echo SYSTEM Expected + +SET SESSION time_zone = '+05:00'; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.time_zone; +--echo SYSTEM Expected + +SET SESSION time_zone = '-10:00'; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.time_zone; +--echo -10:00 Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.time_zone; +--echo +05:00 Expected + + +SELECT @@GLOBAL.time_zone; +--echo SYSTEM Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + + +# +# Cleanup +# + + +SET @@SESSION.time_zone = @session_time_zone; +SET @@GLOBAL.time_zone = @global_time_zone; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test new file mode 100644 index 00000000000..b0eb41afb49 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test @@ -0,0 +1,169 @@ +################## mysql-test\t\timed_mutexes_basic.test ###################### +# # +# Variable Name: timed_mutexes # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: OFF # +# Valid Values: ON, OFF # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable timed_mutexes # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF timed_mutexes TESTS # +######################################################################## + + +############################################################################## +# Saving initial value of timed_mutexes in a temporary variable # +############################################################################## + +SET @global_start_value = @@global.timed_mutexes; +SELECT @global_start_value; + +--echo '#--------------------FN_DYNVARS_177_01------------------------#' +######################################################################## +# Display the DEFAULT value of timed_mutexes # +######################################################################## + +SET @@global.timed_mutexes = 1; +SET @@global.timed_mutexes = DEFAULT; +SELECT @@global.timed_mutexes; + +--echo '#---------------------FN_DYNVARS_177_02-------------------------#' +############################################################################# +# Check if timed_mutexes can be accessed with and without @@ sign # +############################################################################# + +--Error ER_GLOBAL_VARIABLE +SET timed_mutexes = 1; +SELECT @@timed_mutexes; +--Error ER_UNKNOWN_TABLE +SELECT global.timed_mutexes; + +SET global timed_mutexes = 1; +SELECT @@global.timed_mutexes; + + +--echo '#--------------------FN_DYNVARS_177_03------------------------#' +######################################################################## +# Change the value of timed_mutexes to a valid value # +######################################################################## + +SET @@global.timed_mutexes = 0; +SELECT @@global.timed_mutexes; +SET @@global.timed_mutexes = 1; +SELECT @@global.timed_mutexes; + + +--echo '#--------------------FN_DYNVARS_177_04-------------------------#' +########################################################################### +# Change the value of timed_mutexes to invalid value # +########################################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = 2; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = "T"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = "Y"; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = _true; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = 0N; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = 1+1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = 0FF; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = '0'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.timed_mutexes = N; + + +--echo '#-------------------FN_DYNVARS_177_05----------------------------#' +########################################################################### +# Test if accessing session timed_mutexes gives error # +########################################################################### + +--Error ER_GLOBAL_VARIABLE +SET @@session.timed_mutexes = 0; +--Error ER_GLOBAL_VARIABLE +SET @@timed_mutexes = 0; +--Error ER_GLOBAL_VARIABLE +SET @@local.timed_mutexes = 0; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.timed_mutexes; +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@local.timed_mutexes; + +--echo '#----------------------FN_DYNVARS_177_06------------------------#' +######################################################################### +# Check if the value in SESSION Table contains variable value # +######################################################################### + +SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='timed_mutexes'; + + +--echo '#----------------------FN_DYNVARS_177_07------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.timed_mutexes = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='timed_mutexes'; +SELECT @@global.timed_mutexes; + +SELECT VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='timed_mutexes'; + +--echo '#---------------------FN_DYNVARS_177_08-------------------------#' +################################################################### +# Check if ON and OFF values can be used on variable # +################################################################### + +SET @@global.timed_mutexes = OFF; +SELECT @@global.timed_mutexes; +SET @@global.timed_mutexes = ON; +SELECT @@global.timed_mutexes; + +--echo '#---------------------FN_DYNVARS_177_09----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.timed_mutexes = TRUE; +SELECT @@global.timed_mutexes; +SET @@global.timed_mutexes = FALSE; +SELECT @@global.timed_mutexes; + +############################## +# Restore initial value # +############################## + +SET @@global.timed_mutexes = @global_start_value; +SELECT @@global.timed_mutexes; + +############################################################### +# END OF timed_mutexes TESTS # +############################################################### diff --git a/mysql-test/suite/sys_vars/t/timestamp_func.test b/mysql-test/suite/sys_vars/t/timestamp_func.test new file mode 100644 index 00000000000..e119f1b6253 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/timestamp_func.test @@ -0,0 +1,50 @@ +############# mysql-test\t\timestamp_func.test ############################# +# # +# Variable Name: timestamp # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: INTEGER # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Modified: HHunger 2008-08-28 Reimplemented the test completely. # +# # +# Description: Test Cases of Dynamic System Variable "timestamp" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +# Change timestamp which must have an effect on now(), but not on sysdate(). +# Use Unix epoch timestamp +# All comparisons must deliver true(1) +# Exception: --sysdate-is-now switches off this behaviour and must not be set. + +--echo ** Connecting con1 using root ** +connect (con1,localhost,root,,); +SELECT date(now()) = date(sysdate()); +SET @@session.timestamp = 1100000000; +SELECT date(now()) != date(sysdate()); + +# Assure that setting of the variable has no effect on other session. +--echo ** Connecting con0 using root ** +connect (con0,localhost,root,,); +SELECT @@session.timestamp != 1100000000; +SET @@session.timestamp = 1000000000; +SELECT date(now()) != date(sysdate()); + +--echo ** Connection con1 ** +connection con1; +SELECT @@session.timestamp != 1000000000; +SELECT @@session.timestamp = 1100000000; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con0, con1 +disconnect con0; +disconnect con1; + diff --git a/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt new file mode 100644 index 00000000000..97a58d28032 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func-master.opt @@ -0,0 +1 @@ +--sysdate-is-now diff --git a/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test new file mode 100644 index 00000000000..7ca3b4cddac --- /dev/null +++ b/mysql-test/suite/sys_vars/t/timestamp_sysdate_is_now_func.test @@ -0,0 +1,47 @@ +############################################################################ +# # +# Variable Name: timestamp with sysdate-is-now # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: INTEGER # +# # +# # +# Creation Date: 2008-11-25 # +# Author: Horst Hunger # +# # +# Description: Test Cases of Dynamic System Variable "timestamp" # +# that checks behavior of this variable in the following ways # +# * Like timstamp_func, but with set "sysdate-is-now". # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +############################################################################ + +# Use Unix epoch timestamp +# Due to "--sysdate-is-now" timestamp must have an effect on both. +# See also timestamp_func.test. + +--echo ** Connecting con1 using root ** +connect (con1,localhost,root,,); +SELECT date(now()) = date(sysdate()); +SET @@session.timestamp = 1100000000; +SELECT date(now()) != date(sysdate()); + +# Assure that setting of the variable has no effect on other session. +--echo ** Connecting con0 using root ** +connect (con0,localhost,root,,); +SELECT @@session.timestamp != 1100000000; +SET @@session.timestamp = 1000000000; +SELECT date(now()) != date(sysdate()); + +--echo ** Connection con1 ** +connection con1; +SELECT @@session.timestamp != 1000000000; +SELECT @@session.timestamp = 1100000000; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con0, con1 +disconnect con0; +disconnect con1; + diff --git a/mysql-test/suite/sys_vars/t/tmpdir_basic.test b/mysql-test/suite/sys_vars/t/tmpdir_basic.test new file mode 100644 index 00000000000..5e9d08c4876 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tmpdir_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\tmpdir_basic.test ############################# +# # +# Variable Name: tmpdir # +# Scope: Global # +# Access Type: Static # +# Data Type: filename # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable tmpdir # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_052_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.tmpdir); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_052_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.tmpdir=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.tmpdir); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_052_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.tmpdir = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmpdir'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.tmpdir); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tmpdir'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_052_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@tmpdir = @@GLOBAL.tmpdir; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_052_05----------------------#' +################################################################################ +# Check if tmpdir can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@tmpdir); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.tmpdir); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.tmpdir); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.tmpdir); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT tmpdir = @@SESSION.tmpdir; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_basic.test b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test new file mode 100644 index 00000000000..136a9b4331e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tx_isolation_basic.test @@ -0,0 +1,251 @@ +################# mysql-test\t\tx_isolation_basic.test ######################## +# # +# Variable Name: tx_isolation # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: enumeration # +# Default Value: REPEATABLE-READ # +# Valid Values: READ-UNCOMMITTED, READCOMMITTED, REPEATABLE-READ,SERIALIZABLE # +# # +# # +# Creation Date: 2008-02-07 # +# Author: Rizwan # +# # +# Description: Test Cases of Dynamic System Variable tx_isolation # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF tx_isolation TESTS # +######################################################################## + + +######################################################################### +# Saving initial value of tx_isolation in a temporary variable # +######################################################################### + +SET @global_start_value = @@global.tx_isolation; +SELECT @global_start_value; + +SET @session_start_value = @@session.tx_isolation; +SELECT @session_start_value; + +--echo '#--------------------FN_DYNVARS_183_01------------------------#' +#################################################################### +# Display the DEFAULT value of tx_isolation # +#################################################################### + +SET @@global.tx_isolation = 'READ-UNCOMMITTED'; +--Error ER_NO_DEFAULT +SET @@global.tx_isolation = DEFAULT; +--echo 'Bug# 34878: Documentation specifies a DEFAULT value of REPEATABLE-READ'; +--echo 'where as DEFAULT is not supported here.'; + +SET @@session.tx_isolation = 'SERIALIZABLE'; +SET @@session.tx_isolation = DEFAULT; +SELECT @@session.tx_isolation; +--echo 'Bug# 34876: Documentation specifies a DEFAULT value of REPEATABLE-READ'; +--echo 'where as DEFAULT here as no effect.'; + +--echo '#---------------------FN_DYNVARS_183_02-------------------------#' +######################################################### +# Check if NULL or empty value is accepeted # +######################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = ''; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.tx_isolation = NULL; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.tx_isolation = ''; + +--echo '#--------------------FN_DYNVARS_183_03------------------------#' +##################################################################### +# Change the value of tx_isolation to a valid value # +##################################################################### + +SET @@global.tx_isolation = 'READ-UNCOMMITTED'; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 'read-COMMITTED'; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 'REPEATABLE-READ'; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 'SERIALIZable'; +SELECT @@global.tx_isolation; + + +SET @@session.tx_isolation = 'READ-UNCOMMITTED'; +SELECT @@session.tx_isolation; + +SET @@session.tx_isolation = 'READ-COMMITTED'; +SELECT @@session.tx_isolation; + +SET @@session.tx_isolation = 'REPEATABLE-READ'; +SELECT @@session.tx_isolation; + +SET @@session.tx_isolation = 'serializable'; +SELECT @@session.tx_isolation; + + +--echo '#--------------------FN_DYNVARS_183_04-------------------------#' +####################################################################### +# Change the value of tx_isolation to invalid value # +####################################################################### + +# for global scope +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = READUNCOMMITTED; + + +SET @@global.tx_isolation = 'REPEATABLE'; +SELECT @@global.tx_isolation; +--echo 'Bug# 34833: REPEATABLE is not documented as as valid tx_isolation level' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = OFF; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = ON; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.tx_isolation = 'NON-SERIALIZABLE'; + +# for session scope + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@tx_isolation = -1; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@tx_isolation = READUNCOMMITTED; + +SET @@tx_isolation = 'REPEATABLE'; +SELECT @@tx_isolation; +--echo 'Bug# 34833: REPEATABLE is not documented as as valid tx_isolation level' + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@tx_isolation = 'NONE'; +--Error ER_WRONG_VALUE_FOR_VAR +SET @@tx_isolation = 'ALL'; + +--echo '#-------------------FN_DYNVARS_183_05----------------------------#' +######################################################################### +# Check if the value in session Table matches value in variable # +######################################################################### + +SELECT @@session.tx_isolation = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='tx_isolation'; + +--echo '#----------------------FN_DYNVARS_183_06------------------------#' +######################################################################### +# Check if the value in GLOBAL Table matches value in variable # +######################################################################### + +SELECT @@global.tx_isolation = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='tx_isolation'; + + +--echo '#---------------------FN_DYNVARS_183_07-------------------------#' +################################################################### +# Check if numbers can be used on variable # +################################################################### + +# test if variable accepts 0,1,2 +SET @@global.tx_isolation = 0; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 1; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 2; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 3; +SELECT @@global.tx_isolation; + +# use of decimal values + +SET @@global.tx_isolation = 0.4; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 1.1; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 1.5; +SELECT @@global.tx_isolation; + +SET @@global.tx_isolation = 2.9; +SELECT @@global.tx_isolation; + +SET @@session.tx_isolation = 3.49; +SELECT @@session.tx_isolation; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.tx_isolation = 3.6; + +--echo 'Bug: Decimal values can be used within the range [0.0-3.5).'; +--echo 'Values are rounded to 0,1,2,3 as evident from outcome.'; + + +--echo '#---------------------FN_DYNVARS_183_08----------------------#' +################################################################### +# Check if TRUE and FALSE values can be used on variable # +################################################################### + +SET @@global.tx_isolation = TRUE; +SELECT @@global.tx_isolation; +SET @@global.tx_isolation = FALSE; +SELECT @@global.tx_isolation; + +--echo '#---------------------FN_DYNVARS_183_09----------------------#' +######################################################################## +# Check if tx_isolation can be accessed with and without @@ sign # +######################################################################## + +SET tx_isolation = 'REPEATABLE-READ'; + +--Error ER_PARSE_ERROR +SET session.tx_isolation = 'REPEATABLE-READ'; +--Error ER_PARSE_ERROR +SET global.tx_isolation = 'REPEATABLE-READ'; +#using SET SESSION|GLOBAL syntax +SET session tx_isolation = 'REPEATABLE-READ'; +SELECT @@tx_isolation; + +SET global tx_isolation = 'REPEATABLE-READ'; +SELECT @@global.tx_isolation; + +############################## +# Restore initial value # +############################## + +SET @@global.tx_isolation = @global_start_value; +SELECT @@global.tx_isolation; + +SET @@session.tx_isolation = @session_start_value; +SELECT @@session.tx_isolation; + +#################################################################### +# END OF tx_isolation TESTS # +#################################################################### + diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt new file mode 100644 index 00000000000..c15943a7544 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func-master.opt @@ -0,0 +1,3 @@ +--innodb +--innodb_lock_wait_timeout=2 +--binlog-format=row
\ No newline at end of file diff --git a/mysql-test/suite/sys_vars/t/tx_isolation_func.test b/mysql-test/suite/sys_vars/t/tx_isolation_func.test new file mode 100644 index 00000000000..1fd2e323db8 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test @@ -0,0 +1,416 @@ +############# mysql-test\t\tx_isolation_func.test ####################################### +# # +# Variable Name: tx_isolation # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: ENUMERATION # +# Default Value: REPEATABLE-READ # +# Values: READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable "tx_isolation" # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +######################################################################################### + +--source include/have_innodb.inc + +--echo ** Setup ** +# +# Setup +# + +SET @session_tx_isolation = @@SESSION.tx_isolation; +SET @global_tx_isolation = @@GLOBAL.tx_isolation; + +# +# Creating connections +# + +--echo ** Connecting con0 using root ** +connect (con0,localhost,root,,); + +--echo ** Connection con0 ** +connection con0; + +SET SESSION AUTOCOMMIT = OFF; + +--echo ** Connecting con1 using root ** +connect (con1, localhost, root,,); + +--echo ** Connection con1 ** +connection con1; + +SET SESSION AUTOCOMMIT = OFF; + +--echo ** Connection default ** +connection default; + +# +# Creating tables +# + +CREATE TABLE t1 (a int PRIMARY KEY, b int) ENGINE=INNODB; + +INSERT INTO t1 VALUES(2, 2); +INSERT INTO t1 VALUES(4, 4); +INSERT INTO t1 VALUES(6, 6); +INSERT INTO t1 VALUES(8, 8); +INSERT INTO t1 VALUES(16, 16); +INSERT INTO t1 VALUES(18, 18); +INSERT INTO t1 VALUES(20, 20); +INSERT INTO t1 VALUES(22, 22); +INSERT INTO t1 VALUES(24, 24); + +--echo '#----------------------------FN_DYNVARS_184_01--------------------------------------#' +# +# Testing for value READ-UNCOMMITTED +# +--echo ** Connection con0 ** +connection con0; +SET SESSION tx_isolation = 'READ-UNCOMMITTED'; +set binlog_format=mixed; + +--echo ** Connection con1 ** +connection con1; +SET SESSION tx_isolation = 'READ-UNCOMMITTED'; +set binlog_format=mixed; + +# +# Testing WHERE on keys using IN clause +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a IN (2,4,6,8) FOR UPDATE; +UPDATE t1 SET b = 10 WHERE a IN (2,4,6,8); + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t1 VALUES(3, 3); + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +DELETE FROM t1 WHERE a = 1 OR a = 3; + +COMMIT; + +--echo '#----------------------------FN_DYNVARS_184_02--------------------------------------#' +# +# Testing WHERE on keys using # on even rows +# + +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE; +UPDATE t1 SET b = 10 WHERE a % 2 = 0; + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(23, 23); + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(25, 25); +--echo Bug: Only even rows are being locked, error 1205 should'nt have occured + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + +--echo '#----------------------------FN_DYNVARS_184_03--------------------------------------#' +# +# Testing for value READ-COMMITTED +# +--echo ** Connection con0 ** +connection con0; +SET SESSION tx_isolation = 'READ-COMMITTED'; + +--echo ** Connection con1 ** +connection con1; +SET SESSION tx_isolation = 'READ-COMMITTED'; + +# +# Testing WHERE on keys using % on even rows +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE; +UPDATE t1 SET b = 11 WHERE a % 2 = 0; + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +INSERT INTO t1 VALUES(5, 5); +INSERT INTO t1 VALUES(7, 7); + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + + +--echo '#----------------------------FN_DYNVARS_184_04--------------------------------------#' +# +# Testing for value REPEATABLE-READ +# +--echo ** Connection con0 ** +connection con0; +SET SESSION tx_isolation = 'REPEATABLE-READ'; + +--echo ** Connection con1 ** +connection con1; +SET SESSION tx_isolation = 'REPEATABLE-READ'; + +# +# Testing WHERE on keys using % on even rows +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE; +UPDATE t1 SET b = 12 WHERE a % 2 = 0; + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(9, 9); +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(13, 13); +--echo Expected error "Lock wait timeout" + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + +--echo '#----------------------------FN_DYNVARS_184_05--------------------------------------#' +# +# Testing WHERE on keys using IN clause +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0 FOR UPDATE; +UPDATE t1 SET b = 13 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0; + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(9, 9); +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(13, 13); +--echo Expected error "Lock wait timeout" + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + +--echo '#----------------------------FN_DYNVARS_184_06--------------------------------------#' +# +# Testing WHERE on keys using IN clause +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a IN (2,4,6,8) = 0 FOR UPDATE; +UPDATE t1 SET b = 14 WHERE a IN (2,4,6,8) = 0; + +--echo ** Connection con1 ** +connection con1; + +START TRANSACTION; + +SELECT * FROM t1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(9, 9); +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(13, 13); +--echo Expected error "Lock wait timeout" + +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + +--echo '#----------------------------FN_DYNVARS_184_07--------------------------------------#' +# +# Testing for value SERIALIZABLE +# +--echo ** Connection con0 ** +connection con0; +SET SESSION tx_isolation = 'SERIALIZABLE'; + +--echo ** Connection con0 ** +connection con1; +SET SESSION tx_isolation = 'SERIALIZABLE'; + +# +# Testing WHERE on keys using # on even rows +# +--echo ** Connection con0 ** +connection con0; + +START TRANSACTION; + +SELECT * FROM t1 WHERE a % 2 = 0 FOR UPDATE; +UPDATE t1 SET b = 15 WHERE a % 2 = 0; + +--echo ** Connection con0 ** +connection con1; + +START TRANSACTION; + +--error ER_LOCK_WAIT_TIMEOUT +SELECT * FROM t1; + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(15, 15); +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES(17, 17); + +--error ER_LOCK_WAIT_TIMEOUT +SELECT * FROM t1; + +COMMIT; + +--echo ** Connection con0 ** +connection con0; + +COMMIT; + + +--echo '#----------------------------FN_DYNVARS_184_08--------------------------------------#' +# +# Session data integrity check & GLOBAL Value check +# + +SET GLOBAL tx_isolation = 'READ-UNCOMMITTED'; +--echo ** Connecting con_int1 using root ** +connect (con_int1,localhost,root,,); + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.tx_isolation; +--echo READ-UNCOMMITTED Expected + +SET SESSION tx_isolation = 'SERIALIZABLE'; + +--echo ** Connecting con_int2 using root ** +connect (con_int2,localhost,root,,); + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.tx_isolation; +--echo READ-UNCOMMITTED Expected + +SET SESSION tx_isolation = 'REPEATABLE-READ'; + +--echo ** Connection con_int2 ** +connection con_int2; +SELECT @@SESSION.tx_isolation; +--echo REPEATABLE-READ Expected + +--echo ** Connection con_int1 ** +connection con_int1; +SELECT @@SESSION.tx_isolation; +--echo SERIALIZABLE Expected + + +SELECT @@GLOBAL.tx_isolation; +--echo READ-UNCOMMITTED Expected + +--echo ** Connection default ** +connection default; + +--echo Disconnecting Connections con_int1, con_int2 +disconnect con_int1; +disconnect con_int2; + +# +# Cleanup +# + +SET @@SESSION.tx_isolation = @session_tx_isolation; +SET @@GLOBAL.tx_isolation = @global_tx_isolation; + +--echo ** Connection default ** +connection default; +--echo Disconnecting Connections con0, con1 +disconnect con0; +disconnect con1; + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/unique_checks_basic.test b/mysql-test/suite/sys_vars/t/unique_checks_basic.test new file mode 100644 index 00000000000..55308adcc82 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/unique_checks_basic.test @@ -0,0 +1,170 @@ +############## mysql-test\t\unique_checks_basic.test ########################## +# # +# Variable Name: unique_checks # +# Scope: SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable unique_checks # +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_UNIQUE_CHECKS # +# # +############################################################################### + +--source include/load_sysvars.inc +######################################################################## +# START OF transaction_allow_batching TESTS # +######################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_session_value = @@session.unique_checks; +SELECT @start_session_value; + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +############################################################ +# Display the DEFAULT value of unique_checks # +############################################################ + + +SET @@session.unique_checks= 1; +SET @@session.unique_checks= DEFAULT; +SELECT @@session.unique_checks; + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +############################################################# +# Check the DEFAULT value of unique_checks # +############################################################# + + +SET @@session.unique_checks = DEFAULT; +SELECT @@session.unique_checks =1; + + +--echo '#--------------------FN_DYNVARS_005_04-------------------------#' +######################################################################## +# Change the value of unique_checks to a valid value for SESSION Scope # +######################################################################## + +SET @@session.unique_checks =1; +SELECT @@session.unique_checks; + +SET @@session.unique_checks = 0; +SELECT @@session.unique_checks; + +SET @@session.unique_checks = True; +SELECT @@session.unique_checks; + +SET @@session.unique_checks = False; +SELECT @@session.unique_checks; + +SET @@session.unique_checks = "ON"; +SELECT @@session.unique_checks; + +SET @@session.unique_checks = "OFF"; +SELECT @@session.unique_checks; + + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +########################################################### +# Change the value of 'unique_checks' to an invalid value # +########################################################### + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = 'No'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = "yes"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = yes; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = NO; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = "True"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = "False"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = "Test"; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = 'test'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.unique_checks = 123456789031; + + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.unique_checks = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='unique_checks'; + + +--echo '#---------------------FN_DYNVARS_001_08----------------------#' +######################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE # +# points to same session variable # +######################################################################## +SET @@unique_checks = 1; +SELECT @@unique_checks = @@local.unique_checks; +SELECT @@local.unique_checks = @@session.unique_checks; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################## +# Check if unique_checks can be accessed with and without @@ sign # +######################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET unique_checks = 1027; +SELECT @@unique_checks; + +--Error ER_UNKNOWN_TABLE +SELECT local.unique_checks; + +--Error ER_UNKNOWN_TABLE +SELECT session.unique_checks; + +--Error ER_BAD_FIELD_ERROR +SELECT unique_checks = @@session.unique_checks; + + +#################################### +# Restore initial value # +#################################### + + +SET @@session.unique_checks = @start_session_value; +SELECT @@session.unique_checks; + + +################################################## +# END OF unique_checks TESTS # +################################################## + diff --git a/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test new file mode 100644 index 00000000000..61a45793d39 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_basic.test @@ -0,0 +1,275 @@ +############## mysql-test\t\updatable_views_with_limit_basic.test ############# +# # +# Variable Name: updatable_views_with_limit # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: boolean # +# Default Value: 1 # +# Range: # +# # +# # +# Creation Date: 2008-02-14 # +# Author: Sharique Abdullah # +# # +# Description: Test Case of Dynamic System Variable updatable_views_with_limit# +# that checks the behavior of this variable in the following ways# +# * Default Value # +# * Valid & Invalid values # +# * Scope & Access method # +# * Data Integrity # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html#option_mysqld_updatable_views_with_limit # +# # +############################################################################### + +--source include/load_sysvars.inc + +######################################################################## +# START OF updatable_views_with_limit TESTS # +######################################################################## + + +############################################################# +# Save initial value # +############################################################# + +SET @start_global_value = @@global.updatable_views_with_limit; +SELECT @start_global_value; +SET @start_session_value = @@session.updatable_views_with_limit; +SELECT @start_session_value; + + + +--echo '#--------------------FN_DYNVARS_005_01-------------------------#' +######################################################################## +# Display the DEFAULT value of updatable_views_with_limit # +######################################################################## + +SET @@global.updatable_views_with_limit = 'NO'; +SET @@global.updatable_views_with_limit = DEFAULT; +SELECT @@global.updatable_views_with_limit; + + +SET @@session.updatable_views_with_limit = 'NO'; +SET @@session.updatable_views_with_limit = DEFAULT; +SELECT @@session.updatable_views_with_limit; + + + +--echo '#--------------------FN_DYNVARS_005_02-------------------------#' +######################################################################## +# Check the DEFAULT value of updatable_views_with_limit # +######################################################################## + +SET @@global.updatable_views_with_limit = DEFAULT; +SELECT @@global.updatable_views_with_limit = 'Yes'; + +SET @@session.updatable_views_with_limit = DEFAULT; +SELECT @@session.updatable_views_with_limit ='Yes'; + + + +--echo '#--------------------FN_DYNVARS_005_03-------------------------#' +################################################################## +# Change the value of variable to a valid value for GLOBAL Scope # +################################################################## + +SET @@global.updatable_views_with_limit = NO; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = 'NO'; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = YES; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = 'YES'; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = "NO"; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = "YES"; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = 1; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = 0; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = TRUE; +SELECT @@global.updatable_views_with_limit; + +SET @@global.updatable_views_with_limit = False; +SELECT @@global.updatable_views_with_limit; + + +--echo '#--------------------FN_DYNVARS_005_04-------------------------#' +################################################################### +# Change the value of variable to a valid value for SESSION Scope # +################################################################### + +SET @@session.updatable_views_with_limit = NO; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = 'NO'; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = YES; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = 'YES'; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = "YES"; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = "NO"; +SELECT @@session.updatable_views_with_limit; + + + +SET @@session.updatable_views_with_limit =1; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = 0; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = True; +SELECT @@session.updatable_views_with_limit; + +SET @@session.updatable_views_with_limit = False; +SELECT @@session.updatable_views_with_limit; + + + +--echo '#------------------FN_DYNVARS_005_05-----------------------#' +######################################################################## +# Change the value of 'updatable_views_with_limit' to an invalid value # +######################################################################## + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit = "TRUE"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit = -1024; + + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit = 2345; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit = "FALSE"; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit = 65530.34; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@global.updatable_views_with_limit ="Testing"; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = "ON"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = "OFF"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = "True"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = "False"; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = "Test"; + + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = 'test'; + +--Error ER_WRONG_VALUE_FOR_VAR +SET @@session.updatable_views_with_limit = 123456789031; + + +--echo '#------------------FN_DYNVARS_005_06-----------------------#' +#################################################################### +# Check if the value in GLOBAL Table matches value in variable # +#################################################################### + + +SELECT @@global.updatable_views_with_limit = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='updatable_views_with_limit'; + +--echo '#------------------FN_DYNVARS_005_07-----------------------#' +#################################################################### +# Check if the value in SESSION Table matches value in variable # +#################################################################### + +SELECT @@session.updatable_views_with_limit = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='updatable_views_with_limit'; + + + + +--echo '#---------------------FN_DYNVARS_001_08----------------------#' +########################################################################### +# Check if global and session variable are independent of each other # +########################################################################### + +SET @@global.updatable_views_with_limit = NO; +SET @@session.updatable_views_with_limit = YES; +SELECT @@updatable_views_with_limit = @@global.updatable_views_with_limit; + + +--echo '#---------------------FN_DYNVARS_001_09----------------------#' +######################################################################## +# Check if accessing variable with SESSION,LOCAL and without SCOPE # +# points to same session variable # +######################################################################## + +SET @@updatable_views_with_limit = YES; +SELECT @@updatable_views_with_limit = @@local.updatable_views_with_limit; +SELECT @@local.updatable_views_with_limit = @@session.updatable_views_with_limit; + + +--echo '#---------------------FN_DYNVARS_001_10----------------------#' +################################################################ +# Check if variable can be accessed with and without @@ sign # +################################################################ + +--Error ER_WRONG_VALUE_FOR_VAR +SET updatable_views_with_limit = 1027; +SELECT @@updatable_views_with_limit; + + +--Error ER_UNKNOWN_TABLE +SELECT local.updatable_views_with_limit; + +--Error ER_UNKNOWN_TABLE +SELECT session.updatable_views_with_limit; + +--Error ER_BAD_FIELD_ERROR +SELECT updatable_views_with_limit = @@session.updatable_views_with_limit; + + +#################################### +# Restore initial value # +#################################### + +SET @@global.updatable_views_with_limit = @start_global_value; +SELECT @@global.updatable_views_with_limit; +SET @@session.updatable_views_with_limit = @start_session_value; +SELECT @@session.updatable_views_with_limit; + + +############################################################# +# END OF updatable_views_with_limit TESTS # +############################################################# + diff --git a/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test new file mode 100644 index 00000000000..2e1a3f97346 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/updatable_views_with_limit_func.test @@ -0,0 +1,143 @@ +############ mysql-test\t\updatable_views_with_limit_func.test ################# +# # +#Variable Name: updatable_views_with_limit # +#Scope: SESSION # +#Access Type: Dynamic # +#Data Type: Enumeration # +#Default Value: - # +#Values: - # +# # +# # +#Creation Date: 2008-03-02 # +#Author: Sharique Abdullah # +# # +#Description: Test Cases of Dynamic System Variable "updatable_views_with_limit# +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html# +#option_mysqld_updatable_views_with_limit # +# # +################################################################################ + +# +# Setup +# + +SET @session_updatable_views_with_limit = @@Session.UPDATABLE_VIEWS_WITH_LIMIT; + + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +################################ +# Creating table # +################################ + +CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b)); + +################################## +# Inserting values in the table # +################################## + + +INSERT INTO t1 VALUES (10,2,-1), (20,3,-2), + (30,4,-3), (40,5,-4); + + +#################################### +# Creating views # +#################################### +CREATE VIEW v1 (x,y) AS SELECT a, c FROM t1; + + +--echo ** Connecting test_con1 using username 'root' ** +CONNECT (test_con1,localhost,root,,); +--echo ** Connection test_con1 ** +CONNECTION test_con1; + +SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=YES; + +# +# Testing WITH a limit clause +# + +--echo Warning expected, 'View does not contain complete key of the table' +UPDATE v1 SET x=x+6 LIMIT 1; + +SELECT * FROM t1; + +# +# Testing WITHOUT a limit clause +# + +UPDATE v1 SET x=x+5; + +SELECT * FROM t1; + +--echo ** Connecting test_con2 using username 'root' ** +CONNECT (test_con2,localhost,root,,); +--echo ** Connection test_con2 ** +CONNECTION test_con2; + +SET @@Session.UPDATABLE_VIEWS_WITH_LIMIT=NO; + +SELECT @@SESSION.UPDATABLE_VIEWS_WITH_LIMIT; + +--ERROR ER_NON_UPDATABLE_TABLE +UPDATE v1 SET x=x+10 LIMIT 1; +--echo Expected error 'Non updatable table' + +SELECT * FROM t1; + + +--echo '#---------------------FN_DYNVARS_039_01----------------------#' +###################################### +# Setting value to NO # +###################################### + +SET UPDATABLE_VIEWS_WITH_LIMIT=NO; + +-- error ER_NON_UPDATABLE_TABLE +UPDATE v1 SET x=x+1 LIMIT 1; +--echo Expected error 'Non updatable table' + +SET UPDATABLE_VIEWS_WITH_LIMIT=0; + +-- error ER_NON_UPDATABLE_TABLE +UPDATE v1 SET x=x+1 LIMIT 1; +--echo Expected error 'Non updatable table' + +--echo '#---------------------FN_DYNVARS_039_02----------------------#' +###################################### +# Setting value to Default # +###################################### + +--echo Warning expected, 'View does not contain complete key of the table' +SET UPDATABLE_VIEWS_WITH_LIMIT=DEFAULT; +UPDATE v1 SET x=x+1 LIMIT 1; + + +--echo Warning expected, 'View does not contain complete key of the table' +SET UPDATABLE_VIEWS_WITH_LIMIT=YES; +UPDATE v1 SET x=x+2 LIMIT 1; + +# +# Cleanup +# + +--echo ** Connection default ** +connection default; + +--echo ** Disconnecting test_con1, test_con2 ** +disconnect test_con1; +disconnect test_con2; + +SET @@SESSION.updatable_views_with_limit = @session_updatable_views_with_limit; + +--disable_warnings +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; +--enable_warnings + diff --git a/mysql-test/suite/sys_vars/t/version_basic.test b/mysql-test/suite/sys_vars/t/version_basic.test new file mode 100644 index 00000000000..0a22713ca12 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/version_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\version_basic.test ############################ +# # +# Variable Name: version # +# Scope: Global # +# Access Type: Static # +# Data Type: String # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable version # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_053_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.version); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_053_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.version=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.version); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_053_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.version = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.version); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_053_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@version = @@GLOBAL.version; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_053_05----------------------#' +################################################################################ +# Check if version can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@version); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.version); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.version); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.version); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT version = @@SESSION.version; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/version_comment_basic.test b/mysql-test/suite/sys_vars/t/version_comment_basic.test new file mode 100644 index 00000000000..3ae6daa192a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/version_comment_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\version_comment_basic.test #################### +# # +# Variable Name: version_comment # +# Scope: Global # +# Access Type: Static # +# Data Type: String # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable version_comment # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_054_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.version_comment); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_054_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.version_comment=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.version_comment); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_054_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.version_comment = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_comment'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.version_comment); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_comment'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_054_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@version_comment = @@GLOBAL.version_comment; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_054_05----------------------#' +################################################################################ +# Check if version_comment can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@version_comment); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.version_comment); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.version_comment); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.version_comment); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT version_comment = @@SESSION.version_comment; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test new file mode 100644 index 00000000000..30742436068 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/version_compile_machine_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\version_compile_machine_basic.test ############ +# # +# Variable Name: version_compile_machine # +# Scope: Global # +# Access Type: Static # +# Data Type: String # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable version_compile_machine # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_055_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.version_compile_machine); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_055_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.version_compile_machine=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.version_compile_machine); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_055_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.version_compile_machine = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_compile_machine'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.version_compile_machine); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_compile_machine'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_055_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@version_compile_machine = @@GLOBAL.version_compile_machine; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_055_05----------------------#' +################################################################################ +# Check if version_compile_machine can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@version_compile_machine); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.version_compile_machine); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.version_compile_machine); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.version_compile_machine); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT version_compile_machine = @@SESSION.version_compile_machine; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/version_compile_os_basic.test b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test new file mode 100644 index 00000000000..8858f248249 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/version_compile_os_basic.test @@ -0,0 +1,100 @@ + + +################## mysql-test\t\version_compile_os_basic.test ################# +# # +# Variable Name: version_compile_os # +# Scope: Global # +# Access Type: Static # +# Data Type: String # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable version_compile_os # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_056_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### +SELECT COUNT(@@GLOBAL.version_compile_os); +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_056_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@GLOBAL.version_compile_os=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@GLOBAL.version_compile_os); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_056_03----------------------#' +################################################################# +# Check if the value in GLOBAL Table matches value in variable # +################################################################# + +SELECT @@GLOBAL.version_compile_os = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_compile_os'; +--echo 1 Expected + +SELECT COUNT(@@GLOBAL.version_compile_os); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +WHERE VARIABLE_NAME='version_compile_os'; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_056_04----------------------#' +################################################################################ +# Check if accessing variable with and without GLOBAL point to same variable # +################################################################################ +SELECT @@version_compile_os = @@GLOBAL.version_compile_os; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_056_05----------------------#' +################################################################################ +# Check if version_compile_os can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@version_compile_os); +--echo 1 Expected + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@local.version_compile_os); +--echo Expected error 'Variable is a GLOBAL variable' + +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@SESSION.version_compile_os); +--echo Expected error 'Variable is a GLOBAL variable' + +SELECT COUNT(@@GLOBAL.version_compile_os); +--echo 1 Expected + +--Error ER_BAD_FIELD_ERROR +SELECT version_compile_os = @@SESSION.version_compile_os; +--echo Expected error 'Readonly variable' + + diff --git a/mysql-test/suite/sys_vars/t/wait_timeout_func.test b/mysql-test/suite/sys_vars/t/wait_timeout_func.test new file mode 100644 index 00000000000..6b7c8d016d2 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/wait_timeout_func.test @@ -0,0 +1,97 @@ +############## mysql-test\t\wait_timeout_func.test ############################ +# # +# Variable Name: wait_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value: # +# Range: # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. # +# # +# Description: Test Cases of Dynamic System Variable wait_timeout # +# that checks the functionality of this variable # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +############################################################################### + +--source include/not_embedded.inc + +SET @start_value= @@global.wait_timeout; + + +--echo '#--------------------FN_DYNVARS_186_01-------------------------#' +####################################################################### +# 1. test of scope session +####################################################################### + +SET @start_time= UNIX_TIMESTAMP(); +--echo connect (test_con1, localhost, root,,); +connect (test_con1, localhost, root,,); +connection test_con1; + +# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout. +SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1'; + +# Find a small value <> @@global.wait_timeout. +let $session_value = +`SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`; +--replace_result $session_value <session_value> +eval SET @@session.wait_timeout = $session_value; + +--echo connect (test_con2, localhost, root,,); +connect (test_con2, localhost, root,,); +connection test_con2; + +--replace_result $session_value <session_value> +eval SET @@session.wait_timeout = $session_value - 1; + +--echo connection default; +connection default; + +--echo wait until connections ready +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist; +--source include/wait_condition.inc +SELECT info FROM information_schema.processlist; + +--echo '#--------------------FN_DYNVARS_186_03-------------------------#' +####################################################################### +# 2. test of scope global +####################################################################### + +# Find a small value <> @@global.wait_timeout. +let $global_value = $session_value + 1; +--replace_result $global_value <global_value> +eval SET @@global.wait_timeout= $global_value; + +# Changing the @@global.wait_timeout has no influence on the +# @@session.wait_timeout of already established sessions. +SELECT @@session.wait_timeout = @start_value AS 'Expect 1'; + +--echo connect (test_con3, localhost, root,,); +connect (test_con3, localhost, root,,); +connection test_con3; + +# If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout. +SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1'; + +--echo connection default; +connection default; +# We can be sure that the connections test_con1 and test_con2 must be +# established because both have already executed a SET @@session.wait_timeout. +# This means they are or at least were visible within the processlist. +# Therefore we can now simply wait till both disappear from the processlist. +let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist; +--source include/wait_condition.inc +SELECT info FROM information_schema.processlist; + +--replace_result $global_value <global_value> $session_value <session_value>; +eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value; +SET @@global.wait_timeout= @start_value; + diff --git a/mysql-test/suite/sys_vars/t/warning_count_basic.test b/mysql-test/suite/sys_vars/t/warning_count_basic.test new file mode 100644 index 00000000000..64539e28d5b --- /dev/null +++ b/mysql-test/suite/sys_vars/t/warning_count_basic.test @@ -0,0 +1,97 @@ + + +################## mysql-test\t\warning_count_basic.test ###################### +# # +# Variable Name: warning_count # +# Scope: Session # +# Access Type: Static # +# Data Type: numeric # +# # +# # +# Creation Date: 2008-02-07 # +# Author : Sharique Abdullah # +# # +# # +# Description:Test Cases of Dynamic System Variable warning_count # +# that checks the behavior of this variable in the following ways # +# * Value Check # +# * Scope Check # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # +# server-system-variables.html # +# # +############################################################################### + +--echo '#---------------------BS_STVARS_057_01----------------------#' +#################################################################### +# Displaying default value # +#################################################################### + +SELECT COUNT(@@SESSION.warning_count); +--echo 1 Expected + +--echo '#---------------------BS_STVARS_057_02----------------------#' +#################################################################### +# Check if Value can set # +#################################################################### + + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SET @@SESSION.warning_count=1; +--echo Expected error 'Read only variable' + +SELECT COUNT(@@SESSION.warning_count); +--echo 1 Expected + + + + +--echo '#---------------------BS_STVARS_057_03----------------------#' +################################################################# +# Check if the value in SESSION Table matches value in variable # +################################################################# + +SELECT @@SESSION.warning_count = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='warning_count'; +--echo 1 Expected + +SELECT COUNT(@@SESSION.warning_count); +--echo 1 Expected + +SELECT COUNT(VARIABLE_VALUE) +FROM INFORMATION_SCHEMA.SESSION_VARIABLES +WHERE VARIABLE_NAME='warning_count'; +--echo 1 Expected + + +--echo '#---------------------BS_STVARS_057_04----------------------#' +################################################################################ +# Check if accessing variable with and without SESSION point to same variable # +################################################################################ +SELECT @@warning_count = @@SESSION.warning_count; +--echo 1 Expected + + + +--echo '#---------------------BS_STVARS_057_05----------------------#' +################################################################################ +# Check if warning_count can be accessed with and without @@ sign # +################################################################################ + +SELECT COUNT(@@warning_count); +--echo 1 Expected +SELECT COUNT(@@local.warning_count); +--echo 1 Expected +SELECT COUNT(@@SESSION.warning_count); +--echo 1 Expected + +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT COUNT(@@GLOBAL.warning_count); +--echo Expected error 'Variable is a SESSION variable' + +--error ER_BAD_FIELD_ERROR +SELECT COUNT(warning_count = @@GLOBAL.warning_count); +--echo Expected error 'Readonly variable' + + |