mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
180 lines
6.8 KiB
Text
180 lines
6.8 KiB
Text
############## 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 #
|
|
#############################################################
|
|
|