List:Commits« Previous MessageNext Message »
From:msvensson Date:February 9 2006 11:05am
Subject:bk commit into 5.0 tree (msvensson:1.2020) BUG#16878
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson 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.2020 06/02/09 11:05:28 msvensson@neptunus.(none) +3 -0
  Bug#16878 dump of trigger
   - Pass "in_comment" variable on to new lex in sp_head::reset_lex
   - Add testcases for dumping and reloading trigger without BEGIN/END

  sql/sp_head.cc
    1.208 06/02/09 11:05:19 msvensson@neptunus.(none) +2 -0
    If already in a comment before parsing a substatement, set in_comment in the new lex
as well.
    This will handle cases where the comment starts before the substatement, which is
common in 
    output from mysqldump to mask away syntax not supported by earlier versions of MySQL.
    Ex:
    /*!50003 CREATE TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW
    set new.created=now() */;
    ^=== sp_head::reset_lex is called when already in comment

  mysql-test/t/mysqldump.test
    1.78 06/02/09 11:05:19 msvensson@neptunus.(none) +30 -0
    Add test for dumping trigger without begin/end, and test that the output from
mysqldump can be reloaded.

  mysql-test/r/mysqldump.result
    1.88 06/02/09 11:05:19 msvensson@neptunus.(none) +22 -0
    Update test result

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug16878/my50-bug16878

--- 1.207/sql/sp_head.cc	2006-01-12 23:56:47 +01:00
+++ 1.208/sql/sp_head.cc	2006-02-09 11:05:19 +01:00
@@ -1584,6 +1584,8 @@
   sublex->trg_table_fields.empty();
   sublex->sp_lex_in_use= FALSE;
 
+  sublex->in_comment= oldlex->in_comment;
+
   /* Reset type info. */
 
   sublex->charset= NULL;

--- 1.87/mysql-test/r/mysqldump.result	2006-01-12 01:02:48 +01:00
+++ 1.88/mysql-test/r/mysqldump.result	2006-02-09 11:05:19 +01:00
@@ -2611,3 +2611,25 @@
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 drop table t1;
+create table t1 (a int, created datetime);
+create table t2 (b int, created datetime);
+create trigger tr1 before insert on t1 for each row set
+new.created=now();
+create trigger tr2 after insert on t1
+for each row
+begin
+insert into t2 set b=new.a and created=new.created;
+end|
+drop trigger tr1;
+drop trigger tr2;
+drop table t1, t2;
+show triggers;
+Trigger	Event	Table	Statement	Timing	Created	sql_mode	Definer
+tr1	INSERT	t1	set
+new.created=now()	BEFORE	#		root@localhost
+tr2	INSERT	t1	begin
+insert into t2 set b=new.a and created=new.created;
+end	AFTER	#		root@localhost
+drop trigger tr1;
+drop trigger tr2;
+drop table t1, t2;

--- 1.77/mysql-test/t/mysqldump.test	2005-12-01 21:21:26 +01:00
+++ 1.78/mysql-test/t/mysqldump.test	2006-02-09 11:05:19 +01:00
@@ -1036,3 +1036,33 @@
 drop table t1;
 
 # End of 4.1 tests
+
+#
+# Bug #16878 dump of trigger
+#
+
+create table t1 (a int, created datetime);
+create table t2 (b int, created datetime);
+create trigger tr1 before insert on t1 for each row set
+new.created=now();
+delimiter |;
+create trigger tr2 after insert on t1
+for each row
+begin
+  insert into t2 set b=new.a and created=new.created;
+end|
+delimiter ;|
+
+# dump table and trigger
+--exec $MYSQL_DUMP test > var/tmp/bug16878.sql
+drop trigger tr1;
+drop trigger tr2;
+drop table t1, t2;
+
+# reload dump
+--exec $MYSQL test < var/tmp/bug16878.sql
+--replace_column 6 #
+show triggers;
+drop trigger tr1;
+drop trigger tr2;
+drop table t1, t2;
Thread
bk commit into 5.0 tree (msvensson:1.2020) BUG#16878msvensson9 Feb