############## 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; connect (con1,localhost,root,,,,); 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 # ############################################################# 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'Mller' AS latin1_text; SET @@session.character_set_results = ascii; SELECT _latin1'Mller' 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 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 # ##########################################################