Current Path : /usr/opt/mysql57/mysql-test/suite/sys_vars/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/sys_vars/t/character_set_database_func.test |
############## 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_server = @@global.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; 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 '--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 #============================================================================== SET GLOBAL character_set_server=latin5; connect (con2, localhost, root,,); connection con2; CREATE DATABASE csdb CHARACTER SET = utf8; USE csdb; DROP DATABASE csdb; SELECT @@character_set_database; connection default; disconnect con2; #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; SET @@global.character_set_server = @global_character_set_server; ############################################################ # End of functionality Testing for character_set_database # ############################################################