1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
############## mysql-test\t\collation_connection_func.test ###################
# #
# Variable Name: collation_connection #
# 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_connection #
# that checks the behavior of this variable #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
# server-system-variables.html #
# #
###############################################################################
--echo '#--------------------FN_DYNVARS_015_01-------------------------#'
######################################################################
# Check if setting collation_connection is changed in new connection #
######################################################################
SET @global_collation_connection = @@global.collation_connection;
SET @session_collation_connection = @@session.collation_connection;
SET @@global.collation_connection = latin1_danish_ci;
connect (con1,localhost,root,,,,);
connection con1;
SELECT @@global.collation_connection;
SELECT @@session.collation_connection;
disconnect con1;
--echo '#--------------------FN_DYNVARS_015_02-------------------------#'
###########################################################
# Begin the functionality Testing of collation_connection #
###########################################################
connection default;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#==============================================================================
--echo '----check if collation_connection update character_set_connection---'
#==============================================================================
SET @@session.collation_connection = utf8_spanish_ci;
SELECT @@collation_connection, @@character_set_database;
#==============================================================================
--echo '---check if collation_connection works for literal string comparision--'
#==============================================================================
SET @@session.collation_connection = latin1_swedish_ci;
SELECT 'mysql'='MySql';
SELECT _latin2'mysql' COLLATE latin2_general_ci='MySql';
SELECT _utf8'mysql'=_utf8'MySql' COLLATE utf8_unicode_ci;
SET @@session.collation_connection = latin1_general_cs;
SELECT 'mysql'='MySql';
SELECT _latin2'mysql'COLLATE latin2_general_ci='MySql';
--Error ER_CANT_AGGREGATE_2COLLATIONS
SELECT _utf8'mysql'COLLATE utf8_danish_ci=_utf8'MySql'COLLATE utf8_unicode_ci;
#==============================================================================
--echo '---collation_connection does not effect comparision with column---'
#==============================================================================
# fill table with some test data
CREATE TABLE t1(a CHAR(20)CHARACTER SET latin1 COLLATE latin1_german2_ci);
INSERT INTO t1 VALUES('Mller');
SET @@session.collation_connection = latin2_hungarian_ci;
SELECT * FROM t1 WHERE a='Mller';
SET @@session.collation_connection = latin1_general_cs;
SELECT * FROM t1 WHERE a='mller';
--echo 'check if string literal collation is used';
SELECT * FROM t1 WHERE a='mller' COLLATE latin1_general_cs;
SELECT * FROM t1 WHERE a='mller' COLLATE latin1_german1_ci;
# clean up
DROP TABLE t1;
SET @@global.collation_connection = @global_collation_connection;
SET @@session.collation_connection = @session_collation_connection;
#########################################################
# End of functionality Testing for collation_connection #
#########################################################
|