diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-06-28 10:10:31 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-06-28 10:10:31 +0200 |
commit | a02ba9c1c96f8245b2fd5c8b555c74204af421e3 (patch) | |
tree | 8d84e04d7ee6ec5713a120f2fb1ac436d0348508 /client | |
parent | 8baf9b0c469e2845d15cc1181bc6b101cdfba087 (diff) | |
parent | d5cd33450413816f8696125cd66c8393921e6267 (diff) | |
download | mariadb-git-a02ba9c1c96f8245b2fd5c8b555c74204af421e3.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 6 | ||||
-rw-r--r-- | client/mysqltest.cc | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 3461f8bbc75..faef4670b31 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2321,8 +2321,10 @@ static bool add_line(String &buffer, char *line, ulong line_length, continue; } #endif - if (!*ml_comment && inchar == '\\' && - !(*in_string && + if (!*ml_comment && inchar == '\\' && *in_string != '`' && + !(*in_string == '"' && + (mysql.server_status & SERVER_STATUS_ANSI_QUOTES)) && + !(*in_string && (mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))) { // Found possbile one character command like \c diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 2ed2a10e975..5c17f22acce 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6562,6 +6562,16 @@ my_bool end_of_query(int c) } +static inline bool is_escape_char(char c, char in_string) +{ + if (c != '\\' || in_string == '`') return false; + if (!cur_con) return true; + uint server_status= cur_con->mysql->server_status; + if (server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) return false; + return !(server_status & SERVER_STATUS_ANSI_QUOTES && in_string == '"'); +} + + /* Read one "line" from the file @@ -6670,7 +6680,7 @@ int read_line(char *buf, int size) state= R_Q; } } - have_slash= (c == '\\'); + have_slash= is_escape_char(c, last_quote); break; case R_COMMENT: @@ -6740,7 +6750,7 @@ int read_line(char *buf, int size) case R_Q: if (c == last_quote) state= R_NORMAL; - else if (c == '\\') + else if (is_escape_char(c, last_quote)) state= R_SLASH_IN_Q; break; |