mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#23619 Incorrectly escaped multibyte characters in binary log break replication
Problem: when embedding a character string with introducer with charset X into a SQL query which is generally in character set Y, the string constants were escaped according to their own character set (i.e.X), then after reading such a "mixed" query from binlog, the string constants were unescaped using character set of the query (i.e. Y), instead of X, which gave wrong results or even syntax errors with tricky charsets (e.g. sjis) Fix: when embedding a string constant of charset X into a query of charset Y, the string constant is now escaped according to character Y, instead of its own character set X. mysql-test/r/ctype_cp932_binlog.result: Fixing test results. sql/log_event.cc: Using character set "csinfo" instead of the string character set. sql/sp_head.cc: - adding "thd" argument to sp_get_item_value() to have access to thd->variables.character_set_client - using character_set_client for escaping, instead of the string character set mysql-test/r/rpl_charset_sjis.result: Adding test case mysql-test/t/rpl_charset_sjis.test: Adding test case
This commit is contained in:
@ -41,6 +41,6 @@ IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 801 Query 1 1006 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1'Foo\'s a Bar'), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 1006 Query 1 1092 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1092 Query 1 1168 use `test`; DROP TABLE t4
|
||||
master-bin.000001 801 Query 1 1017 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 1017 Query 1 1103 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1103 Query 1 1179 use `test`; DROP TABLE t4
|
||||
|
26
mysql-test/r/rpl_charset_sjis.result
Normal file
26
mysql-test/r/rpl_charset_sjis.result
Normal file
@ -0,0 +1,26 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
create table t1 (a varchar(255) character set sjis);
|
||||
create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
|
||||
SET NAMES binary;
|
||||
CALL p1 ('<27>\\');
|
||||
select "--- on master ---";
|
||||
--- on master ---
|
||||
--- on master ---
|
||||
select hex(a) from t1 ;
|
||||
hex(a)
|
||||
965C
|
||||
select "--- on slave ---";
|
||||
--- on slave ---
|
||||
--- on slave ---
|
||||
select hex(a) from t1;
|
||||
hex(a)
|
||||
965C
|
||||
drop table t1;
|
||||
drop procedure p1;
|
25
mysql-test/t/rpl_charset_sjis.test
Normal file
25
mysql-test/t/rpl_charset_sjis.test
Normal file
@ -0,0 +1,25 @@
|
||||
source include/have_sjis.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
create table t1 (a varchar(255) character set sjis);
|
||||
create procedure p1 (in a varchar(255) character set sjis) insert into t1 values (a);
|
||||
|
||||
SET NAMES binary;
|
||||
CALL p1 ('<27>\\');
|
||||
select "--- on master ---";
|
||||
select hex(a) from t1 ;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select "--- on slave ---";
|
||||
select hex(a) from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop procedure p1;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# End of 5.0 tests
|
Reference in New Issue
Block a user