List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:March 14 2006 10:04am
Subject:bk commit into 5.1 tree (cmiller:1.2163) BUG#18078
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2163 06/03/14 10:03:53 cmiller@stripped +3 -0
  Added code to remove closing comment code from event text, as would be
  supplied inside a  /*!VERSION event-text */  segment.  (Fixes Bug#18078)

  sql/event_timed.cc
    1.48 06/03/14 10:03:40 cmiller@stripped +46 -3
    Remove  */  close-comment characters at the end, just as sp_head does.
    
    The parser should be smarter about not giving us text that jumps semantic 
    levels, but that's an issue for another day.

  mysql-test/t/mysqldump.test
    1.94 06/03/14 10:03:39 cmiller@stripped +5 -5
    Add spaces and tabs to the end of statements, to prove trimming of 
    whitespace.

  mysql-test/t/disabled.def
    1.98 06/03/14 10:03:38 cmiller@stripped +0 -1
    Enabling 'mysqldump' test because events should load normally now.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cmiller
# Host:	calliope.local
# Root:	/Users/cmiller/work/src/mysql-5.1-new__bug18078

--- 1.47/sql/event_timed.cc	2006-03-10 04:23:15 +01:00
+++ 1.48/sql/event_timed.cc	2006-03-14 10:03:40 +01:00
@@ -106,6 +106,9 @@
   NOTE
     The body is extracted by copying all data between the
     start of the body set by another method and the current pointer in Lex.
+
+    Some questionable removal of characters is done in here, and that part
+    should be refactored when the parser is smarter.
 */
 
 void
@@ -116,9 +119,49 @@
              body_begin, thd->lex->ptr));
 
   body.length= thd->lex->ptr - body_begin;
-  /* Trim nuls at the end */
-  while (body.length && body_begin[body.length-1] == '\0')
-    body.length--;
+
+  /* Trim nuls or close-comments ('*'+'/') or spaces at the end */
+  while (TRUE)
+  {
+    if ((body.length >= 1) && (body_begin[body.length-1] == '\0'))
+    { /* consume any NUL characters */
+      body.length--;
+      continue;
+    }
+
+    if ((body.length >= 1) && 
+        (my_isspace(thd->variables.character_set_client, body_begin[body.length-1])))
+    { /* consume meaningless whitespace */
+      body.length--;
+      continue;
+    }
+
+    /*  
+       consume closing comments
+
+       This is arguably wrong, but it's the best we have until the parser is
+       changed to be smarter.   FIXME PARSER 
+
+       See also the sp_head code, where something like this is done also.
+
+       One idea is to keep in the lexer structure the count of the number of
+       open-comments we've entered, and scan left-to-right looking for a
+       closing comment IFF the count is greater than zero.
+
+       Another idea is to remove the closing comment-characters wholly in the
+       parser, since that's where it "removes" the opening characters.
+    */
+    if ((body.length >= 2) && (body_begin[body.length-2] == '*') &&
+        (body_begin[body.length-1] == '/'))
+    {
+      DBUG_PRINT("info", ("consumend one '*" "/' comment in the query '%s'", 
+          body_begin));
+      body.length-= 2;
+      continue;
+    }
+
+    break;  /* none were found, so we have excised all we can. */
+  }
 
   /* the first is always whitespace which I cannot skip in the parser */
   while (my_isspace(thd->variables.character_set_client, *body_begin))

--- 1.97/mysql-test/t/disabled.def	2006-03-10 15:47:48 +01:00
+++ 1.98/mysql-test/t/disabled.def	2006-03-14 10:03:38 +01:00
@@ -43,4 +43,3 @@
 rpl_until               : Unstable test case, bug#15886
 sp-goto                 : GOTO is currently is disabled - will be fixed in the future
 rpl_rbr_to_sbr          : BUG#18108
-mysqldump               : BUG#18078

--- 1.93/mysql-test/t/mysqldump.test	2006-03-10 04:23:15 +01:00
+++ 1.94/mysql-test/t/mysqldump.test	2006-03-14 10:03:39 +01:00
@@ -1174,8 +1174,8 @@
 use first;
 set time_zone = 'UTC';
 
-## prove one works
-create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
+## prove one works (with spaces and tabs on the end)
+create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;              
 show events;
 show create event ee1;
 --exec $MYSQL_DUMP --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
@@ -1187,10 +1187,10 @@
 show events;
 show create event ee1;
 
-## prove three works
+## prove three works (with spaces and tabs on the end)
 # start with one from the previous restore
-create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
-create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
+create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;  
+create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;              
 show events;
 --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
 drop database second;
Thread
bk commit into 5.1 tree (cmiller:1.2163) BUG#18078Chad MILLER14 Mar