MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:November 2 2007 1:40pm
Subject:bk commit into 5.1 tree (kaa:1.2589) BUG#26215
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kaa. When kaa 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@stripped, 2007-11-02 16:40:08+03:00, kaa@polly.(none) +3 -0
  5.1-specific changes for bug #26215 after merging the patch from 5.0:
  
  - Added trigger tests back.
  - Fixed test cases to match the extended output format of SHOW CREATE ...
  - Replaced 'gptr' with 'uchar *'.

  client/mysql.cc@stripped, 2007-11-02 16:40:01+03:00, kaa@polly.(none) +1 -1
    Replaced 'gptr' with 'uchar *'.

  mysql-test/r/mysql_comments.result@stripped, 2007-11-02 16:40:01+03:00, kaa@polly.(none) +32 -20
    Fixed test cases to match the extended output format of SHOW CREATE ...
    Added trigger tests back.

  mysql-test/t/mysql_comments.sql@stripped, 2007-11-02 16:40:01+03:00, kaa@polly.(none) +43 -2
    Added trigger tests back.

diff -Nrup a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc	2007-11-02 13:44:19 +03:00
+++ b/client/mysql.cc	2007-11-02 16:40:01 +03:00
@@ -776,7 +776,7 @@ static struct my_option my_long_options[
     0, 0, 0, 0, 0, 0},
   {"comments", 'c', "Preserve comments. Send comments to the server."
    " Comments are discarded by default, enable with --enable-comments",
-   (gptr*) &preserve_comments, (gptr*) &preserve_comments,
+   (uchar**) &preserve_comments, (uchar**) &preserve_comments,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff -Nrup a/mysql-test/r/mysql_comments.result b/mysql-test/r/mysql_comments.result
--- a/mysql-test/r/mysql_comments.result	2007-11-02 13:40:31 +03:00
+++ b/mysql-test/r/mysql_comments.result	2007-11-02 16:40:01 +03:00
@@ -12,20 +12,26 @@ drop trigger if exists t1_bi;
 2
 foofct("call 1")
 call 1
-Function	sql_mode	Create Function
-foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n\n\n\nx
+Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
+foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n\n\n\nx	latin1	latin1_swedish_ci	latin1_swedish_ci
 foofct("call 2")
 call 2
-Function	sql_mode	Create Function
-foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n  \n  \n  \n\n  \n\n  \n  return x;\nend
-Procedure	sql_mode	Create Procedure
-empty		CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend
+Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
+foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n  \n  \n  \n\n  \n\n  \n  return x;\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+empty		CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
 id	data
 foo	42
-Procedure	sql_mode	Create Procedure
-foosp		CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n\n\n\n\n  \n\n  \n  values ("foo", 42)
-Procedure	sql_mode	Create Procedure
-nicesp		CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n  \n  declare b int;\n  declare c float;\n\n  \n  \n\n  \nend
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+foosp		CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n\n\n\n\n  \n\n  \n  values ("foo", 42)	latin1	latin1_swedish_ci	latin1_swedish_ci
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+nicesp		CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n  \n  declare b int;\n  declare c float;\n\n  \n  \n\n  \nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_empty		CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_bi		CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n\n\n\n  \n  declare b int;\n  declare c float;\n\n  \n  \n\n  \n  set NEW.data := 12;\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+id	data
+trig	12
 "Pass 2 : --enable-comments"
 1
 1
@@ -33,18 +39,24 @@ nicesp		CREATE DEFINER=`root`@`localhost
 2
 foofct("call 1")
 call 1
-Function	sql_mode	Create Function
-foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n-- comment 1a\n# comment 1b\n/* comment 1c */\nx # after body, on same line
+Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
+foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nreturn\n-- comment 1a\n# comment 1b\n/* comment 1c */\nx # after body, on same line	latin1	latin1_swedish_ci	latin1_swedish_ci
 foofct("call 2")
 call 2
-Function	sql_mode	Create Function
-foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n  -- comment 1a\n  # comment 1b\n  /*\n     comment 1c\n  */\n\n  -- empty line below\n\n  -- empty line above\n  return x;\nend
-Procedure	sql_mode	Create Procedure
-empty		CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend
+Function	sql_mode	Create Function	character_set_client	collation_connection	Database Collation
+foofct		CREATE DEFINER=`root`@`localhost` FUNCTION `foofct`(x char(20)) RETURNS char(20) CHARSET latin1\nbegin\n  -- comment 1a\n  # comment 1b\n  /*\n     comment 1c\n  */\n\n  -- empty line below\n\n  -- empty line above\n  return x;\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+empty		CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
 id	data
 foo	42
-Procedure	sql_mode	Create Procedure
-foosp		CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n## These comments are part of the procedure body, and should be kept.\n# Comment 2a\n-- Comment 2b\n/* Comment 2c */\n  -- empty line below\n\n  -- empty line above\n  values ("foo", 42) # comment 3, still part of the body
-Procedure	sql_mode	Create Procedure
-nicesp		CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n  -- declare some variables here\n  declare b int;\n  declare c float;\n\n  -- do more stuff here\n  -- commented nicely and so on\n\n  -- famous last words ...\nend
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+foosp		CREATE DEFINER=`root`@`localhost` PROCEDURE `foosp`()\ninsert into test.t1\n## These comments are part of the procedure body, and should be kept.\n# Comment 2a\n-- Comment 2b\n/* Comment 2c */\n  -- empty line below\n\n  -- empty line above\n  values ("foo", 42) # comment 3, still part of the body	latin1	latin1_swedish_ci	latin1_swedish_ci
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+nicesp		CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n  -- declare some variables here\n  declare b int;\n  declare c float;\n\n  -- do more stuff here\n  -- commented nicely and so on\n\n  -- famous last words ...\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_empty		CREATE DEFINER=`root`@`localhost` trigger t1_empty after delete on t1\nfor each row\nbegin\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation
+t1_bi		CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1\nfor each row\nbegin\n# comment 1a\n-- comment 1b\n/*\n   comment 1c\n*/\n  -- declare some variables here\n  declare b int;\n  declare c float;\n\n  -- do more stuff here\n  -- commented nicely and so on\n\n  -- famous last words ...\n  set NEW.data := 12;\nend	latin1	latin1_swedish_ci	latin1_swedish_ci
+id	data
+trig	12
 End of 5.0 tests
diff -Nrup a/mysql-test/t/mysql_comments.sql b/mysql-test/t/mysql_comments.sql
--- a/mysql-test/t/mysql_comments.sql	2007-11-02 13:40:31 +03:00
+++ b/mysql-test/t/mysql_comments.sql	2007-11-02 16:40:01 +03:00
@@ -167,8 +167,49 @@ delimiter ;
 show create procedure nicesp;
 drop procedure nicesp;
 
-# Triggers can be tested only in 5.1, since 5.0 does not have 
-# SHOW CREATE TRIGGER
+##============================================================================
+## Comments inside triggers
+##============================================================================
+
+drop trigger if exists t1_empty;
+
+create trigger t1_empty after delete on t1
+for each row
+begin
+end;
+
+show create trigger t1_empty;
+
+drop trigger if exists t1_bi;
+
+delimiter |
+
+create trigger t1_bi before insert on t1
+for each row
+begin
+# comment 1a
+-- comment 1b
+/*
+   comment 1c
+*/
+  -- declare some variables here
+  declare b int;
+  declare c float;
+
+  -- do more stuff here
+  -- commented nicely and so on
+
+  -- famous last words ...
+  set NEW.data := 12;
+end|
+
+delimiter ;
+
+show create trigger t1_bi;
+
+# also make sure the trigger still works
+insert into t1(id) value ("trig");
+select * from t1;
 
 ##============================================================================
 ## Cleanup
Thread
bk commit into 5.1 tree (kaa:1.2589) BUG#26215Alexey Kopytov2 Nov