summaryrefslogtreecommitdiff
path: root/client/mysql.cc
diff options
context:
space:
mode:
authorSachin Kumar <sachin.setiya@mariadb.com>2021-05-19 15:46:57 +0100
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2021-10-05 08:17:08 -0600
commit10cd281820cdcbef2fd9bc68c97325659f84de4a (patch)
tree0153a8ebff05798161e7595197510fe8d5709a6e /client/mysql.cc
parent1d57892949eeb317a0914da0ff2d03deed45505a (diff)
downloadmariadb-git-10cd281820cdcbef2fd9bc68c97325659f84de4a.tar.gz
MDEV-25444 mysql --binary-mode is not able to replay some mysqlbinlog outputs
Problem:- Some binary data is inserted into the table using Jconnector. When binlog dump of the data is applied using mysql cleint it gives syntax error. Reason:- After investigating it turns out to be a issue of mysql client not able to properly handle \\\0 <0 in binary>. In all binary files where mysql client fails to insert these 2 bytes are commom (0x5c00) Solution:- I have changed mysql.cc to include for the possibility that binary string can have \\\0 in it
Diffstat (limited to 'client/mysql.cc')
-rw-r--r--client/mysql.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 2a7c4eaf3e5..8530c105820 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2319,8 +2319,12 @@ static bool add_line(String &buffer, char *line, size_t line_length,
{
// Found possbile one character command like \c
- if (!(inchar = (uchar) *++pos))
- break; // readline adds one '\'
+ inchar = (uchar) *++pos;
+ // In Binary mode , when in_string is not null \0 should not be treated as
+ // end statement. This can happen when we are in middle of binary data which
+ // can contain \0 and its quoted with ' '.
+ if (!real_binary_mode && !*in_string && !inchar)
+ break; // readline adds one '\'
if (*in_string || inchar == 'N') // \N is short for NULL
{ // Don't allow commands in string
*out++='\\';