summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Munch <bjorn.munch@oracle.com>2010-08-10 12:13:58 +0200
committerBjorn Munch <bjorn.munch@oracle.com>2010-08-10 12:13:58 +0200
commit788b4e404bbd97ff6b215ae55633e0971f8d19d6 (patch)
treeefc0dbd46d368ae0610e007610662df90b1c73c3
parentf3f5e04a366d970ab4b90860b83350fbed0951c6 (diff)
downloadmariadb-git-788b4e404bbd97ff6b215ae55633e0971f8d19d6.tar.gz
Bug #55413 mysqltest gives parse error for lines matching "^let.*\\.*;$"
Allow escaped quotes also in statements not starting with -- But will not support single unescaped ' or `
-rw-r--r--client/mysqltest.cc10
-rw-r--r--mysql-test/r/mysqltest.result3
-rw-r--r--mysql-test/t/mysqltest.test10
3 files changed, 21 insertions, 2 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index d7a302912b4..d8c921e8f18 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5507,6 +5507,8 @@ int read_line(char *buf, int size)
char c, UNINIT_VAR(last_quote);
char *p= buf, *buf_end= buf + size - 1;
int skip_char= 0;
+ my_bool have_slash= FALSE;
+
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line");
@@ -5578,9 +5580,13 @@ int read_line(char *buf, int size)
}
else if (c == '\'' || c == '"' || c == '`')
{
- last_quote= c;
- state= R_Q;
+ if (! have_slash)
+ {
+ last_quote= c;
+ state= R_Q;
+ }
}
+ have_slash= (c == '\\');
break;
case R_COMMENT:
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index e4f68d68c3f..1044127b06e 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -262,6 +262,9 @@ a long \$where variable content
banana = banana
Not a banana: ba\$cat\$cat
+with\`some"escaped\'quotes
+with\`some"escaped\'quotes
+single'tick`backtick
mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing assignment operator in let
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 031c51a0720..9da19ec00e0 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -701,6 +701,16 @@ echo banana = $cat;
let $cat=ba\\\$cat\\\$cat;
echo Not a banana: $cat;
+# Bug #55413 would cause this to fail
+let $escape= with\`some\"escaped\'quotes;
+echo $escape;
+
+--let $escape= with\`some\"escaped\'quotes
+echo $escape;
+
+# This only works with "--let" syntax
+--let $tick= single'tick`backtick
+echo $tick;
# Test illegal uses of let