Commit 2048ac02 authored by unknown's avatar unknown

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:
  Replaced 'gptr' with 'uchar *'.
mysql-test/r/mysql_comments.result:
  Fixed test cases to match the extended output format of SHOW CREATE ...
  Added trigger tests back.
mysql-test/t/mysql_comments.sql:
  Added trigger tests back.
parent 62f31fac
...@@ -776,7 +776,7 @@ static struct my_option my_long_options[] = ...@@ -776,7 +776,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"comments", 'c', "Preserve comments. Send comments to the server." {"comments", 'c', "Preserve comments. Send comments to the server."
" Comments are discarded by default, enable with --enable-comments", " 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, 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} { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
......
...@@ -12,20 +12,26 @@ drop trigger if exists t1_bi; ...@@ -12,20 +12,26 @@ drop trigger if exists t1_bi;
2 2
foofct("call 1") foofct("call 1")
call 1 call 1
Function sql_mode Create Function 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 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") foofct("call 2")
call 2 call 2
Function sql_mode Create Function 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 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 Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci
id data id data
foo 42 foo 42
Procedure sql_mode Create Procedure 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) 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 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 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" "Pass 2 : --enable-comments"
1 1
1 1
...@@ -33,18 +39,24 @@ nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n \n ...@@ -33,18 +39,24 @@ nicesp CREATE DEFINER=`root`@`localhost` PROCEDURE `nicesp`(a int)\nbegin\n \n
2 2
foofct("call 1") foofct("call 1")
call 1 call 1
Function sql_mode Create Function 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 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") foofct("call 2")
call 2 call 2
Function sql_mode Create Function 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 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 Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend empty CREATE DEFINER=`root`@`localhost` PROCEDURE `empty`()\nbegin\nend latin1 latin1_swedish_ci latin1_swedish_ci
id data id data
foo 42 foo 42
Procedure sql_mode Create Procedure 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 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 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 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 End of 5.0 tests
...@@ -167,8 +167,49 @@ delimiter ; ...@@ -167,8 +167,49 @@ delimiter ;
show create procedure nicesp; show create procedure nicesp;
drop 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 ## Cleanup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment