summaryrefslogtreecommitdiff
path: root/mysql-test/main/mysql_binary_zero_insert.result
blob: 3e43c070f07a33743af01bb0f45fa3b4106f3cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Note: This test assumes NO_BACKSLASH_ESCAPES is not set in SQL_MODE.
##############################
#      Setup
##############################
#
# Saving old state
#
set @old_sql_mode= @@global.SQL_MODE;
set @@global.SQL_MODE= "";
#
# Create table for data entry
#
CREATE TABLE tb (`id` int(11) NOT NULL AUTO_INCREMENT,`cb` longblob DEFAULT NULL, PRIMARY KEY (`id`)) AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
RESET MASTER;
##############################
#      Test Case
##############################
#
# \0 (0x5c00 in binary) should be allowed in data strings if
# --binary-mode is enabled.
#
FOUND 10 /\x5c\x00/ in binary_zero_inserts.sql
# MYSQL --binary-mode test < MYSQL_TMP_DIR/binary_zero_inserts.sql
#
# Ensure a row exists from each insert statement with a \0
#
SELECT COUNT(*)=8 from tb;
COUNT(*)=8
1
#
# Ensure that the binary zero was parsed and exists in the row data
# Note: We only look for 00 because the 5c only served as an escape
#       in parsing.
#
# MYSQL_DUMP test tb --hex-blob > MYSQL_TMP_DIR/dump.sql
FOUND 8 /\([0-9]+,0x([1-9][0-9])*00([1-9][0-9])*\)/ in dump.sql
#
# Ensure data consistency on mysqlbinlog replay
#
FLUSH LOGS;
# MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/binlog_zeros.sql
FOUND 10 /\x5c\x00/ in binlog_zeros.sql
# MYSQL --binary-mode test < MYSQL_TMP_DIR/binlog_zeros.sql
# Table checksum is equivalent before and after binlog replay
#
# A \0 should still be treated as end-of-query in binary mode.
#
# MYSQL --binary-mode -B test < MYSQL_TMP_DIR/binary_zero_eoq.sql
##############################
#      Cleanup
##############################
SET @@global.sql_mode= @old_sql_mode;
drop table tb;
RESET MASTER;