List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:February 23 2009 3:28pm
Subject:bzr commit into mysql-5.0-bugteam branch (kgeorge:2755) Bug#31060
View as plain text  
#At file:///Users/kgeorge/mysql/work/B31060-5.0-bugteam/ based on revid:patrick.crews@stripped

 2755 Georgi Kodinov	2009-02-23
      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 new line for DELIMITER 
        (when added to the glob buffer)
     @ mysql-test/r/mysqltest.result
        Bug #31060: test case
     @ mysql-test/t/mysqltest.test
        Bug #31060: test case

    modified:
      client/mysql.cc
      mysql-test/r/mysqltest.result
      mysql-test/t/mysqltest.test
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2009-02-18 10:18:38 +0000
+++ b/client/mysql.cc	2009-02-23 15:28:25 +0000
@@ -2222,8 +2222,22 @@ static bool add_line(String &buffer,char
   }
   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))

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2009-02-19 20:37:40 +0000
+++ b/mysql-test/r/mysqltest.result	2009-02-23 15:28:25 +0000
@@ -723,4 +723,5 @@ drop table t1;
 mysqltest: At line 1: change user failed: Unknown database 'inexistent'
 mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
 mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
+mysqltest: At line 1: query '' failed: 1065: Query was empty
 End of tests

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2009-02-19 20:37:40 +0000
+++ b/mysql-test/t/mysqltest.test	2009-02-23 15:28:25 +0000
@@ -2151,6 +2151,22 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
 remove_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
 rmdir $MYSQLTEST_VARDIR/tmp/testdir;
 
+#
+# Bug #31060: MySQL CLI parser bug 2
+#
+
+write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
+;DELIMITER DELIMITER
+;
+SELECT 1DELIMITER
+DELIMITER ;
+SELECT 1;
+EOF
+
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
+
+remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
 
 --echo End of tests
 


Attachment: [text/bzr-bundle] bzr/kgeorge@mysql.com-20090223152825-jtd8pr9xg0iu3cw3.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (kgeorge:2755) Bug#31060Georgi Kodinov23 Feb