List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:December 11 2008 5:53pm
Subject:bzr commit into mysql-6.0-bugteam branch (chad:2803)
View as plain text  
#At file:///home/cmiller/work/mysqlbzr/mysql-6.0-bugteam/ based on revid:luis.soares@stripped

 2803 Chad MILLER	2008-12-11 [merge]
      Merge fix for Bug 33812 from 5.1-bugteam.
modified:
  client/mysql.cc
  mysql-test/r/mysql.result
  mysql-test/t/mysql.test

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2008-12-05 01:05:05 +0000
+++ b/client/mysql.cc	2008-12-11 17:52:45 +0000
@@ -2054,7 +2054,7 @@ static bool add_line(String &buffer,char
   {
     if (!preserve_comments)
     {
-      // Skip spaces at the beggining of a statement
+      // Skip spaces at the beginning of a statement
       if (my_isspace(charset_info,inchar) && (out == line) &&
           buffer.is_empty())
         continue;
@@ -2137,37 +2137,6 @@ static bool add_line(String &buffer,char
 	continue;
       }
     }
-    else if (!*ml_comment && !*in_string &&
-             (end_of_line - pos) >= 10 &&
-             !my_strnncoll(charset_info, (uchar*) pos, 10,
-                           (const uchar*) "delimiter ", 10))
-    {
-      // Flush previously accepted characters
-      if (out != line)
-      {
-        buffer.append(line, (uint32) (out - line));
-        out= line;
-      }
-
-      // Flush possible comments in the buffer
-      if (!buffer.is_empty())
-      {
-        if (com_go(&buffer, 0) > 0) // < 0 is not fatal
-          DBUG_RETURN(1);
-        buffer.length(0);
-      }
-
-      /*
-        Delimiter wants the get rest of the given line as argument to
-        allow one to change ';' to ';;' and back
-      */
-      buffer.append(pos);
-      if (com_delimiter(&buffer, pos) > 0)
-        DBUG_RETURN(1);
-
-      buffer.length(0);
-      break;
-    }
     else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
     {
       // Found a statement. Continue parsing after the delimiter
@@ -2230,8 +2199,24 @@ static bool add_line(String &buffer,char
 
       // comment to end of line
       if (preserve_comments)
+      {
+        bool started_with_nothing= !buffer.length();
+
         buffer.append(pos);
 
+        /*
+          A single-line comment by itself gets sent immediately so that
+          client commands (delimiter, status, etc) will be interpreted on
+          the next line.
+        */
+        if (started_with_nothing)
+        {
+          if (com_go(&buffer, 0) > 0)             // < 0 is not fatal
+            DBUG_RETURN(1);
+          buffer.length(0);
+        }
+      }
+
       break;
     }
     else if (!*in_string && inchar == '/' && *(pos+1) == '*' &&

=== modified file 'mysql-test/r/mysql.result'
--- a/mysql-test/r/mysql.result	2008-10-17 14:13:24 +0000
+++ b/mysql-test/r/mysql.result	2008-12-11 17:52:45 +0000
@@ -180,6 +180,12 @@ ERROR at line 1: DELIMITER cannot contai
 1
 This is a file starting with UTF8 BOM 0xEFBBBF
 This is a file starting with UTF8 BOM 0xEFBBBF
+delimiter
+1
+2
+2
+2
+2
 End of 5.0 tests
 WARNING: --server-arg option not supported in this configuration.
 *************************** 1. row ***************************

=== modified file 'mysql-test/t/mysql.test'
--- a/mysql-test/t/mysql.test	2007-11-26 18:56:21 +0000
+++ b/mysql-test/t/mysql.test	2008-12-11 17:52:45 +0000
@@ -291,6 +291,25 @@ EOF
 --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
 remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
 
+#
+# Bug #33812: mysql client incorrectly parsing DELIMITER
+#
+# The space and ; after delimiter are important
+--exec $MYSQL -e "select 1 delimiter ;"
+
+#
+# Bug #38158: mysql client regression, can't read dump files
+#
+--write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql
+-- Testing
+--
+delimiter ||
+select 2 ||
+EOF
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
+--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
+
 --echo End of 5.0 tests
 
 #

Thread
bzr commit into mysql-6.0-bugteam branch (chad:2803) Chad MILLER11 Dec