# This is a wrapper for binlog.test so that the same test case can be used 
# For both statement and row based bin logs 11/07/2005 [jbm]

-- source include/have_binlog_format_mixed_or_statement.inc
-- source extra/binlog_tests/ctype_cp932_binlog.test

#
# Bug#18293: Values in stored procedure written to binlog unescaped
#
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);

delimiter |;
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
                 s2 CHAR(50) CHARACTER SET cp932,
                 d DECIMAL(10,2))|
CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
                           IN ins2 CHAR(50) CHARACTER SET cp932,
                           IN ind DECIMAL(10,2))
  BEGIN
    INSERT INTO t4 VALUES (ins1, ins2, ind);
  END|
CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
SELECT HEX(s1),HEX(s2),d FROM t4|
DROP PROCEDURE bug18293|
DROP TABLE t4|
source include/show_binlog_events.inc|
delimiter ;|

--echo End of 5.0 tests

#
# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump 
# Note: 364 is a magic position (found experimentally, depends on 
# the log's contents) that caused the server crash.

call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");

--error 1220
SHOW BINLOG EVENTS FROM 365;

--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
DROP TABLE t1;

--echo End of 5.1 tests
