summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2009-02-24 15:06:28 +0200
committerGeorgi Kodinov <kgeorge@mysql.com>2009-02-24 15:06:28 +0200
commit85ea3740ffa44454d7d3cb03f90857bfa43d2aad (patch)
tree5deae5f5ce529703811f67d6e212ae96f2f48974 /client
parenta6ac350b3aacb277a15b8c2b03da4af049556bec (diff)
downloadmariadb-git-85ea3740ffa44454d7d3cb03f90857bfa43d2aad.tar.gz
Bug #31060: MySQL CLI parser bug 2
There was a problem when a DELIMITER COMMAND is not the first command on the line. I this case an extra line feed was added to the glob buffer and this was causing subsequent attempts to enter this delimiter to fail. Fixed by not adding a new line to the glob buffer if the command being added is a DELIMITER client/mysql.cc: Bug #31060: Don't add a new line if DELIMTER is added to the glob buffer mysql-test/r/mysql.result: Bug #31060: test case mysql-test/t/mysql.test: Bug #31060: test case
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index d1d36d79565..1a025345190 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2222,8 +2222,22 @@ static bool add_line(String &buffer,char *line,char *in_string,
}
if (out != line || !buffer.is_empty())
{
- *out++='\n';
uint length=(uint) (out-line);
+
+ if (length < 9 ||
+ my_strnncoll (charset_info,
+ (uchar *)line, 9, (const uchar *) "delimiter", 9))
+ {
+ /*
+ Don't add a new line in case there's a DELIMITER command to be
+ added to the glob buffer (e.g. on processing a line like
+ "<command>;DELIMITER <non-eof>") : similar to how a new line is
+ not added in the case when the DELIMITER is the first command
+ entered with an empty glob buffer.
+ */
+ *out++='\n';
+ length++;
+ }
if (buffer.length() + length >= buffer.alloced_length())
buffer.realloc(buffer.length()+length+IO_SIZE);
if ((!*ml_comment || preserve_comments) && buffer.append(line, length))