set names koi8r;

-------------------------------------------------------------------
Views
-------------------------------------------------------------------

DROP DATABASE IF EXISTS mysqltest1|
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
use mysqltest1|
CREATE TABLE t1(кол INT)|
INSERT INTO t1 VALUES(1)|

CREATE VIEW v1 AS
SELECT 'тест' AS c1, кол AS c2
FROM t1|

CREATE VIEW v2 AS SELECT _utf8'я┌п╣я│я┌' as c1|

CREATE VIEW v3 AS SELECT _utf8'я┌п╣я│я┌'|



SHOW CREATE VIEW v1|
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v2|
View	Create View	character_set_client	collation_connection
v2	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'я┌п╣я│я┌' AS `c1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v3|
View	Create View	character_set_client	collation_connection
v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'я┌п╣я│я┌' AS `тест`	koi8r	koi8r_general_ci


SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v1	select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1`	NONE	YES	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v2	select 'тест' AS `c1`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v3	select 'тест' AS `тест`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci


SELECT COLLATION(c1), COLLATION(c2) FROM v1|
COLLATION(c1)	COLLATION(c2)
koi8r_general_ci	binary

SELECT COLLATION(c1) FROM v2|
COLLATION(c1)
utf8_general_ci

SELECT * FROM v3|
тест
тест


ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|

---> connection: con2
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
SELECT * FROM mysqltest1.v1|
SELECT * FROM mysqltest1.v2|
SELECT * FROM mysqltest1.v3|
use mysqltest1|
set names koi8r|


SHOW CREATE VIEW v1|
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v2|
View	Create View	character_set_client	collation_connection
v2	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'я┌п╣я│я┌' AS `c1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v3|
View	Create View	character_set_client	collation_connection
v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'я┌п╣я│я┌' AS `тест`	koi8r	koi8r_general_ci


SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v1	select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1`	NONE	YES	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v2	select 'тест' AS `c1`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v3	select 'тест' AS `тест`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci


SELECT COLLATION(c1), COLLATION(c2) FROM v1|
COLLATION(c1)	COLLATION(c2)
koi8r_general_ci	binary

SELECT COLLATION(c1) FROM v2|
COLLATION(c1)
utf8_general_ci

SELECT * FROM v3|
тест
тест

---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql


DROP DATABASE mysqltest1|


---> Restoring mysqltest1...

---> connection: con3
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
SELECT * FROM mysqltest1.v1|
SELECT * FROM mysqltest1.v2|
SELECT * FROM mysqltest1.v3|
use mysqltest1|
set names koi8r|


SHOW CREATE VIEW v1|
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `c1`,`t1`.`кол` AS `c2` from `t1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v2|
View	Create View	character_set_client	collation_connection
v2	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'я┌п╣я│я┌' AS `c1`	koi8r	koi8r_general_ci

SHOW CREATE VIEW v3|
View	Create View	character_set_client	collation_connection
v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'я┌п╣я│я┌' AS `тест`	koi8r	koi8r_general_ci


SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v1	select 'тест' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1`	NONE	YES	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v2	select 'тест' AS `c1`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci

SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'|
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	VIEW_DEFINITION	CHECK_OPTION	IS_UPDATABLE	DEFINER	SECURITY_TYPE	CHARACTER_SET_CLIENT	COLLATION_CONNECTION
NULL	mysqltest1	v3	select 'тест' AS `тест`	NONE	NO	root@localhost	DEFINER	koi8r	koi8r_general_ci


SELECT COLLATION(c1), COLLATION(c2) FROM v1|
COLLATION(c1)	COLLATION(c2)
koi8r_general_ci	binary

SELECT COLLATION(c1) FROM v2|
COLLATION(c1)
utf8_general_ci

SELECT * FROM v3|
тест
тест

---> connection: default
use test|
DROP DATABASE mysqltest1|

-------------------------------------------------------------------
Stored procedures/functions
-------------------------------------------------------------------

DROP DATABASE IF EXISTS mysqltest1|
DROP DATABASE IF EXISTS mysqltest2|
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
use mysqltest1|

CREATE PROCEDURE p1(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END|

CREATE PROCEDURE p2(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END|

CREATE PROCEDURE mysqltest2.p3(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END|

CREATE PROCEDURE mysqltest2.p4(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END|


SHOW CREATE PROCEDURE p1|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE p2|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p2		CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p3|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p3		CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p4|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p4		CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW PROCEDURE STATUS LIKE 'p1'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p1	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p2'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p2	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p3'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p3	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p4'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p4	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci


SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p1	NULL	mysqltest1	p1	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p2	NULL	mysqltest1	p2	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p3	NULL	mysqltest2	p3	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p4	NULL	mysqltest2	p4	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a = '1'|
SET @b = '2'|


CALL p1(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL p2(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci

CALL mysqltest2.p3(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL mysqltest2.p4(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci


ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|

---> connection: con2
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
CALL p1(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL p2(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL mysqltest2.p3(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL mysqltest2.p4(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
set names koi8r|


SHOW CREATE PROCEDURE p1|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE p2|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p2		CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p3|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p3		CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p4|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p4		CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW PROCEDURE STATUS LIKE 'p1'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p1	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p2'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p2	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p3'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p3	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p4'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p4	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci


SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p1	NULL	mysqltest1	p1	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p2	NULL	mysqltest1	p2	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p3	NULL	mysqltest2	p3	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p4	NULL	mysqltest2	p4	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a = '1'|
SET @b = '2'|


CALL p1(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL p2(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci

CALL mysqltest2.p3(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL mysqltest2.p4(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci

---> Dump of mysqltest1

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest1`;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;

---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql

---> Dump of mysqltest2

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest2`;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;

---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql


DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|


---> Restoring mysqltest1...
---> Restoring mysqltest2...

---> connection: con3
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
CALL p1(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL p2(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL mysqltest2.p3(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
CALL mysqltest2.p4(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
set names koi8r|


SHOW CREATE PROCEDURE p1|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE p2|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p2		CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p3|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p3		CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE PROCEDURE mysqltest2.p4|
Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
p4		CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(_koi8r    'текст') AS c5,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW PROCEDURE STATUS LIKE 'p1'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p1	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p2'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest1	p2	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p3'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p3	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW PROCEDURE STATUS LIKE 'p4'|
Db	Name	Type	Definer	Modified	Created	Security_type	Comment	character_set_client	collation_connection	Database Collation
mysqltest2	p4	PROCEDURE	root@localhost	MODIFIED	CREATED	DEFINER		koi8r	koi8r_general_ci	utf8_unicode_ci


SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p1	NULL	mysqltest1	p1	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p2	NULL	mysqltest1	p2	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p3	NULL	mysqltest2	p3	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'|
SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
p4	NULL	mysqltest2	p4	PROCEDURE	NULL	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION(парам1) AS c2,
COLLATION(парам2) AS c3;
SELECT
COLLATION('текст') AS c4,
COLLATION(    'текст') AS c5,
COLLATION( 'текст') AS c6,
@@collation_connection AS c7,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	CREATED	ALTERED			root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a = '1'|
SET @b = '2'|


CALL p1(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL p2(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci

CALL mysqltest2.p3(@a, @b)|
c1	c2	c3
utf8_unicode_ci	utf8_unicode_ci	utf8_unicode_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_unicode_ci	utf8_unicode_ci

CALL mysqltest2.p4(@a, @b)|
c1	c2	c3
utf8_general_ci	utf8_general_ci	utf8_general_ci
c4	c5	c6	c7	c8
koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca	cb
utf8_general_ci	utf8_general_ci

---> connection: default
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|

-------------------------------------------------------------------
Triggers
-------------------------------------------------------------------

DROP DATABASE IF EXISTS mysqltest1|
DROP DATABASE IF EXISTS mysqltest2|
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
use mysqltest1|
CREATE TABLE t1(c INT)|
CREATE TABLE mysqltest2.t1(c INT)|
CREATE TABLE log(msg VARCHAR(255))|
CREATE TABLE mysqltest2.log(msg VARCHAR(255))|

CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END|

CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END|

CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END|

CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END|



SHOW CREATE TRIGGER trg1|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg1		CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER trg2|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg2		CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg3|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg3		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg4|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg4		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg1	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg2	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

use mysqltest2|

SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg3	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg4	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
use mysqltest1|


SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg1	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg2	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg3	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg4	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a1 = '1'|
SET @a2 = '1'|
SET @a3 = '1'|
SET @b1 = '2'|
SET @b2 = '2'|
SET @b3 = '2'|


INSERT INTO t1 VALUES(1)|

---> Log:
SELECT msg FROM log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM log|


INSERT INTO mysqltest2.t1 VALUES(1)|

---> Log:
SELECT msg FROM mysqltest2.log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM mysqltest2.log|


ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
ALTER TABLE t1 ADD COLUMN fake INT|
ALTER TABLE t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|

---> connection: con2
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
INSERT INTO mysqltest1.t1 VALUES(0)|
INSERT INTO mysqltest2.t1 VALUES(0)|
DELETE FROM mysqltest1.log|
DELETE FROM mysqltest2.log|
set names koi8r|
use mysqltest1|


SHOW CREATE TRIGGER trg1|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg1		CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER trg2|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg2		CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg3|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg3		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg4|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg4		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg1	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg2	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

use mysqltest2|

SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg3	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg4	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
use mysqltest1|


SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg1	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg2	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg3	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg4	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a1 = '1'|
SET @a2 = '1'|
SET @a3 = '1'|
SET @b1 = '2'|
SET @b2 = '2'|
SET @b3 = '2'|


INSERT INTO t1 VALUES(1)|

---> Log:
SELECT msg FROM log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM log|


INSERT INTO mysqltest2.t1 VALUES(1)|

---> Log:
SELECT msg FROM mysqltest2.log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM mysqltest2.log|

---> Dump of mysqltest1

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `log` (
  `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;

---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql

---> Dump of mysqltest2

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `log` (
  `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t1` (
  `c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `t1` VALUES (1),(0),(1);
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = koi8r */ ;
/*!50003 SET character_set_results = koi8r */ ;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;

---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql


DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|


---> Restoring mysqltest1...
---> Restoring mysqltest2...
ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|

---> connection: con3
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
INSERT INTO mysqltest1.t1 VALUES(0)|
INSERT INTO mysqltest2.t1 VALUES(0)|
DELETE FROM mysqltest1.log|
DELETE FROM mysqltest2.log|
set names koi8r|
use mysqltest1|


SHOW CREATE TRIGGER trg1|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg1		CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER trg2|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg2		CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg3|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg3		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 = _koi8r    'текст';
SET @a2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE TRIGGER mysqltest2.trg4|
Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
trg4		CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(_koi8r    'текст'));
INSERT INTO log VALUES(COLLATION(_utf8 'я┌п╣п╨я│я┌'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 = _koi8r    'текст';
SET @b2 = _utf8 'я┌п╣п╨я│я┌';
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg1	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg2	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

use mysqltest2|

SHOW TRIGGERS|
Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer	character_set_client	collation_connection	Database Collation
trg3	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	BEFORE	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
trg4	INSERT	t1	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	AFTER	NULL		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci
use mysqltest1|


SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg1	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	trg2	INSERT	NULL	mysqltest1	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg3	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10);
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @a1 = 'текст';
SET @a1 =     'текст';
SET @a2 =  'текст';
END	ROW	BEFORE	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'|
TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	trg4	INSERT	NULL	mysqltest2	t1	0	NULL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
INSERT INTO log VALUES(COLLATION(перем1));
INSERT INTO log VALUES(COLLATION('текст'));
INSERT INTO log VALUES(COLLATION(    'текст'));
INSERT INTO log VALUES(COLLATION( 'текст'));
INSERT INTO log VALUES(@@collation_connection);
INSERT INTO log VALUES(@@character_set_client);
SET @b1 = 'текст';
SET @b1 =     'текст';
SET @b2 =  'текст';
END	ROW	AFTER	NULL	NULL	OLD	NEW	CREATED		root@localhost	koi8r	koi8r_general_ci	utf8_unicode_ci


SET @a1 = '1'|
SET @a2 = '1'|
SET @a3 = '1'|
SET @b1 = '2'|
SET @b2 = '2'|
SET @b3 = '2'|


INSERT INTO t1 VALUES(1)|

---> Log:
SELECT msg FROM log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM log|


INSERT INTO mysqltest2.t1 VALUES(1)|

---> Log:
SELECT msg FROM mysqltest2.log|
msg
utf8_unicode_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r
utf8_general_ci
koi8r_general_ci
koi8r_general_ci
utf8_general_ci
koi8r_general_ci
koi8r

SELECT
COLLATION(@a1) AS ca1,
COLLATION(@a2) AS ca2,
COLLATION(@a3) AS ca3,
COLLATION(@b1) AS cb1,
COLLATION(@b2) AS cb2,
COLLATION(@b3) AS cb3|
ca1	ca2	ca3	cb1	cb2	cb3
koi8r_general_ci	utf8_general_ci	koi8r_general_ci	koi8r_general_ci	utf8_general_ci	koi8r_general_ci

DELETE FROM mysqltest2.log|

---> connection: default
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|

-------------------------------------------------------------------
Events
-------------------------------------------------------------------

DROP DATABASE IF EXISTS mysqltest1|
DROP DATABASE IF EXISTS mysqltest2|
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
use mysqltest1|

CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO
BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|

CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|

CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|

CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO
BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END|



SHOW CREATE EVENT ev1|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev1		SYSTEM	CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT ev2|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev2		SYSTEM	CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW EVENTS LIKE 'ev1'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev1	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev2'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev2	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev3'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation

SHOW EVENTS LIKE 'ev4'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation


SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev1	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev2	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev3	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev4	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci


ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|

---> connection: con2
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
SHOW CREATE EVENT ev1|
SHOW CREATE EVENT ev2|
SHOW CREATE EVENT mysqltest2.ev3|
SHOW CREATE EVENT mysqltest2.ev4|
set names koi8r|


SHOW CREATE EVENT ev1|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev1		SYSTEM	CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT ev2|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev2		SYSTEM	CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW EVENTS LIKE 'ev1'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev1	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev2'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev2	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev3'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation

SHOW EVENTS LIKE 'ev4'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation


SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev1	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev2	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev3	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev4	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

---> Dump of mysqltest1

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest1`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client  = koi8r */ ;;
/*!50003 SET character_set_results = koi8r */ ;;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;
/*!50003 SET sql_mode              = '' */ ;;
/*!50003 SET @saved_time_zone      = @@time_zone */ ;;
/*!50003 SET time_zone             = 'SYSTEM' */ ;;
/*!50106 CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
/*!50003 SET time_zone             = @saved_time_zone */ ;;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;;
/*!50003 SET character_set_client  = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection  = @saved_col_connection */ ;;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client  = koi8r */ ;;
/*!50003 SET character_set_results = koi8r */ ;;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;
/*!50003 SET sql_mode              = '' */ ;;
/*!50003 SET @saved_time_zone      = @@time_zone */ ;;
/*!50003 SET time_zone             = 'SYSTEM' */ ;;
/*!50106 CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
/*!50003 SET time_zone             = @saved_time_zone */ ;;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;;
/*!50003 SET character_set_client  = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection  = @saved_col_connection */ ;;
ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;

---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql

---> Dump of mysqltest2

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */;

USE `mysqltest2`;
/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
DELIMITER ;;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client  = koi8r */ ;;
/*!50003 SET character_set_results = koi8r */ ;;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;
/*!50003 SET sql_mode              = '' */ ;;
/*!50003 SET @saved_time_zone      = @@time_zone */ ;;
/*!50003 SET time_zone             = 'SYSTEM' */ ;;
/*!50106 CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
/*!50003 SET time_zone             = @saved_time_zone */ ;;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;;
/*!50003 SET character_set_client  = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection  = @saved_col_connection */ ;;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;;
ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
/*!50003 SET character_set_client  = koi8r */ ;;
/*!50003 SET character_set_results = koi8r */ ;;
/*!50003 SET collation_connection  = koi8r_general_ci */ ;;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;;
/*!50003 SET sql_mode              = '' */ ;;
/*!50003 SET @saved_time_zone      = @@time_zone */ ;;
/*!50003 SET time_zone             = 'SYSTEM' */ ;;
/*!50106 CREATE EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END */ ;;
/*!50003 SET time_zone             = @saved_time_zone */ ;;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;;
/*!50003 SET character_set_client  = @saved_cs_client */ ;;
/*!50003 SET character_set_results = @saved_cs_results */ ;;
/*!50003 SET collation_connection  = @saved_col_connection */ ;;
ALTER DATABASE `mysqltest2` CHARACTER SET cp866 COLLATE cp866_general_ci ;;
DELIMITER ;
/*!50106 SET TIME_ZONE= @save_time_zone */ ;

---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql


DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|


---> Restoring mysqltest1...
---> Restoring mysqltest2...

---> connection: con3
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
SHOW CREATE EVENT ev1|
SHOW CREATE EVENT ev2|
SHOW CREATE EVENT mysqltest2.ev3|
SHOW CREATE EVENT mysqltest2.ev4|
set names koi8r|


SHOW CREATE EVENT ev1|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev1		SYSTEM	CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT ev2|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev2		SYSTEM	CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW CREATE EVENT mysqltest2.ev3|
Event	sql_mode	time_zone	Create Event	character_set_client	collation_connection	Database Collation
ev3		SYSTEM	CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(_koi8r    'текст') AS c3,
COLLATION(_utf8 'я┌п╣п╨я│я┌') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	koi8r	koi8r_general_ci	utf8_unicode_ci


SHOW EVENTS LIKE 'ev1'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev1	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev2'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
mysqltest1	ev2	root@localhost	SYSTEM	ONE TIME	2030-01-01 00:00:00	NULL	NULL	NULL	NULL	ENABLED	1	koi8r	koi8r_general_ci	utf8_unicode_ci

SHOW EVENTS LIKE 'ev3'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation

SHOW EVENTS LIKE 'ev4'|
Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation


SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev1	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10);
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest1	ev2	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev3	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'|
EVENT_CATALOG	EVENT_SCHEMA	EVENT_NAME	DEFINER	TIME_ZONE	EVENT_BODY	EVENT_DEFINITION	EVENT_TYPE	EXECUTE_AT	INTERVAL_VALUE	INTERVAL_FIELD	SQL_MODE	STARTS	ENDS	STATUS	ON_COMPLETION	CREATED	LAST_ALTERED	LAST_EXECUTED	EVENT_COMMENT	ORIGINATOR	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
NULL	mysqltest2	ev4	root@localhost	SYSTEM	SQL	BEGIN
DECLARE перем1 CHAR(10) CHARACTER SET utf8;
SELECT
COLLATION(перем1) AS c1,
COLLATION('текст') AS c2,
COLLATION(    'текст') AS c3,
COLLATION( 'текст') AS c4,
@@collation_connection AS c5,
@@character_set_client AS c6;
END	ONE TIME	2030-01-01 00:00:00	NULL	NULL		NULL	NULL	ENABLED	NOT PRESERVE	CREATED	LAST_ALTERED	NULL		1	koi8r	koi8r_general_ci	utf8_unicode_ci

-------------------------------------------------------------------
DDL statements within stored routine.
-------------------------------------------------------------------

DROP DATABASE IF EXISTS mysqltest1|
DROP DATABASE IF EXISTS mysqltest2|
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
use mysqltest1|

CREATE PROCEDURE p1()
BEGIN
CREATE TABLE t1(col1 VARCHAR(10));
SHOW CREATE TABLE t1;
END|

CREATE PROCEDURE mysqltest2.p2()
BEGIN
CREATE TABLE t2(col1 VARCHAR(10));
SHOW CREATE TABLE t2;
END|

CALL p1()|
Table	Create Table
t1	CREATE TABLE `t1` (
  `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

SHOW CREATE TABLE t1|
Table	Create Table
t1	CREATE TABLE `t1` (
  `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci


CALL mysqltest2.p2()|
Table	Create Table
t2	CREATE TABLE `t2` (
  `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

SHOW CREATE TABLE mysqltest2.t2|
Table	Create Table
t2	CREATE TABLE `t2` (
  `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs|
ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs|
DROP TABLE t1|
DROP TABLE mysqltest2.t2|

CALL p1()|
Table	Create Table
t1	CREATE TABLE `t1` (
  `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs

SHOW CREATE TABLE t1|
Table	Create Table
t1	CREATE TABLE `t1` (
  `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs


CALL mysqltest2.p2()|
Table	Create Table
t2	CREATE TABLE `t2` (
  `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs

SHOW CREATE TABLE mysqltest2.t2|
Table	Create Table
t2	CREATE TABLE `t2` (
  `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs

---> connection: con2

---> connection: con3

---> connection: default
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
