mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
115 lines
5.1 KiB
Text
115 lines
5.1 KiB
Text
############## 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_ln/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_ln/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 #
|
|
############################################################
|