diff options
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r-- | client/mysqltest.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index d8eb43aeeb2..504eadcf2a8 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6520,6 +6520,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 @@ -6546,7 +6556,7 @@ my_bool end_of_query(int c) int read_line(char *buf, int size) { - char c, UNINIT_VAR(last_quote), last_char= 0; + char c, last_quote=0, last_char= 0; char *p= buf, *buf_end= buf + size - 1; int skip_char= 0; my_bool have_slash= FALSE; @@ -6628,7 +6638,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: @@ -6698,7 +6708,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; |