mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
9cba6c5aa3
This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while.
130 lines
5.7 KiB
Text
130 lines
5.7 KiB
Text
############## 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;
|
||
connect (con1,localhost,root,,,,);
|
||
connection con1;
|
||
SELECT @@global.collation_database;
|
||
SELECT @@session.collation_database;
|
||
disconnect con1;
|
||
|
||
--echo '#--------------------FN_DYNVARS_011_02-------------------------#'
|
||
#########################################################
|
||
# Begin the functionality Testing of collation_database #
|
||
#########################################################
|
||
|
||
connection default;
|
||
|
||
--disable_warnings
|
||
DROP TABLE IF EXISTS t1,t2;
|
||
--enable_warnings
|
||
|
||
#==============================================================================
|
||
--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;
|
||
|
||
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 #
|
||
#######################################################
|