'#--------------------FN_DYNVARS_014_01-------------------------#'
SET @global_collation_server = @@global.collation_server;
SET @session_collation_server = @@session.collation_server;
SET @@global.collation_server = latin1_danish_ci;
'connect (con1,localhost,root,,,,)'
'connection con1'
SELECT @@global.collation_server;
@@global.collation_server
latin1_danish_ci
SELECT @@session.collation_server;
@@session.collation_server
latin1_danish_ci
'#--------------------FN_DYNVARS_014_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1,t2;
'---check if setting collation_server update character_set_server---'
SET @@session.collation_server = utf8_spanish_ci;
SELECT @@collation_server, @@character_set_server;
@@collation_server	@@character_set_server
utf8_spanish_ci	utf8
'--check if collation_server effects database/table charset/collation--'
SET @@session.collation_server = latin1_german1_ci;
CREATE DATABASE db1;
USE db1;
SHOW CREATE DATABASE db1;
Database	Create Database
db1	CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci */
CREATE TABLE t1(a CHAR(20));
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` char(20) COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
'---check if updating collation_server effects new table/column---'
SET @@session.collation_server = latin1_swedish_ci;
CREATE TABLE t2(a CHAR(10));
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` char(10) COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems');
'---check if collation_server effects results sort order---'
SET @@session.collation_server = latin1_swedish_ci;
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
SET @@session.collation_server = latin1_german1_ci;
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci;
a
Muffler
MX Systems
Müller
SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci;
a
Muffler
Müller
MX Systems
'---check if indexing is effected by collation_server---'
SET @@session.collation_server = latin1_swedish_ci;
ALTER TABLE t1 ADD PRIMARY KEY (a);
REPAIR TABLE t1;
Table	Op	Msg_type	Msg_text
db1.t1	repair	status	OK
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
ALTER TABLE t1 DROP PRIMARY KEY;
SET @@session.collation_server = latin1_german1_ci;
ALTER TABLE t1 ADD PRIMARY KEY (a);
REPAIR TABLE t1;
Table	Op	Msg_type	Msg_text
db1.t1	repair	status	OK
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
DROP TABLE t1,t2;
DROP DATABASE db1;
SET @@global.collation_server = @global_collation_server;
SET @@session.collation_server = @session_collation_server;
