From 6eb2e76abdbf903d6b3848961f942c7d41d640a0 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Tue, 24 Jun 2008 19:32:06 +0500 Subject: Bug #36244: MySQL CLI doesn't recognize standalone -- as a commentary mysql client has been modified to interpret EOL after standalone -- commentary strings like whitespace character (according to http://dev.mysql.com/doc/refman/5.0/en/ansi-diff-comments.html) mysql-test/t/mysql_delimiter.sql: Added test case for bug #36244. --- client/mysql.cc | 9 ++++++++- mysql-test/t/mysql_delimiter.sql | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index a4706a1c580..5348941b92f 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2156,7 +2156,14 @@ static bool add_line(String &buffer,char *line,char *in_string, } else if (!*ml_comment && (!*in_string && (inchar == '#' || inchar == '-' && pos[1] == '-' && - my_isspace(charset_info,pos[2])))) + /* + The third byte is either whitespace or is the + end of the line -- which would occur only + because of the user sending newline -- which is + itself whitespace and should also match. + */ + (my_isspace(charset_info,pos[2]) || + !pos[2])))) { // Flush previously accepted characters if (out != line) diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql index db679c3b06b..533ac2ce093 100644 --- a/mysql-test/t/mysql_delimiter.sql +++ b/mysql-test/t/mysql_delimiter.sql @@ -59,3 +59,10 @@ source t/mysql_delimiter_19799.sql use test// show tables// delimiter ; # Reset delimiter + +# +# Bug #36244: MySQL CLI doesn't recognize standalone -- as comment +# before DELIMITER statement +# +-- +DELIMITER ; -- cgit v1.2.1