Below is the list of changes that have just been committed into a local
5.0 repository of patg. When patg 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.1953 05/09/08 19:45:25 patg@stripped +3 -0
BUG #9056 Changes to patch #2 per Serg's review
mysql-test/t/mysqldump.test
1.57 05/09/08 19:45:01 patg@stripped +2 -36
BUG #9056 Removed redirect, simplified, dump in results, per Serg
mysql-test/r/mysqldump.result
1.63 05/09/08 19:45:00 patg@stripped +56 -28
BUG #9056 New results
client/mysqldump.c
1.197 05/09/08 19:44:59 patg@stripped +21 -24
BUG #9056 Fixes per serg
* if opt_lock for locking mysql.proc
* calling mysql_query_with_error_report where needed
* print functions same way as procs, file bug about commented functions
# 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: patg
# Host: radha.local
# Root: /Users/patg/mysql-build/mysql-5.0.bug9056
--- 1.196/client/mysqldump.c 2005-09-04 01:34:43 +02:00
+++ 1.197/client/mysqldump.c 2005-09-08 19:44:59 +02:00
@@ -603,9 +603,6 @@
MYF(MY_WME))))
exit(1);
break;
- case 'R':
- opt_routines= 1;
- break;
case 'W':
#ifdef __WIN__
opt_protocol = MYSQL_PROTOCOL_PIPE;
@@ -1196,15 +1193,13 @@
static uint dump_routines_for_db (char *db)
{
- MYSQL_RES *routine_res= NULL;
- MYSQL_RES *routine_list_res= NULL;
- MYSQL_ROW row, routine_list_row;
char query_buff[512], routine_type[10];
char db_name_buff[NAME_LEN+3], name_buff[NAME_LEN+3];
- char *routine_name;
- char **routine_list;
int i;
FILE *sql_file = md_result_file;
+ MYSQL_RES *routine_res= NULL;
+ MYSQL_RES *routine_list_res= NULL;
+ MYSQL_ROW row, routine_list_row;
DBUG_ENTER("dump_routines_for_db");
@@ -1214,7 +1209,15 @@
/* nice comments */
if (opt_comments)
fprintf(sql_file, "\n--\n-- Dumping routines for database '%s'\n--\n", db);
- mysql_query(sock, "LOCK TABLES mysql.proc READ");
+
+ /*
+ not using "mysql_query_with_error_report" because of privileges
+ */
+ if (opt_lock)
+ mysql_query(sock, "LOCK TABLES mysql.proc READ");
+
+ fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+ fprintf(sql_file, "DELIMITER //\n");
/* 0, retrieve and dump functions, 1, procedures */
for (i=0; i <= 1; i++)
@@ -1225,15 +1228,12 @@
my_snprintf(query_buff, sizeof(query_buff),
"SHOW %s STATUS WHERE Db = '%s'",
routine_type, db_name_buff);
- mysql_query(sock, query_buff);
- if (!(routine_list_res= mysql_store_result(sock)))
+ if (mysql_query_with_error_report(sock, &routine_list_res, query_buff))
DBUG_RETURN(1);
if (mysql_num_rows(routine_list_res))
{
- fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
- fprintf(sql_file, "DELIMITER //\n");
while((routine_list_row= mysql_fetch_row(routine_list_res)))
{
@@ -1244,12 +1244,7 @@
routine_type, name_buff);
if (mysql_query_with_error_report(sock, &routine_res, query_buff))
- {
- if (path)
- my_fclose(sql_file, MYF(MY_WME));
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
- }
while ((row=mysql_fetch_row(routine_res)))
{
@@ -1272,21 +1267,23 @@
can't be in comments
*/
/* create proc/func body */;
- fprintf(sql_file, i == 0 ? "%s //\n" : "/*!50003 %s */ //\n", row[2]);
+ fprintf(sql_file, "/*!50003 %s */ //\n", row[2]);
}
} /* end of routine printing */
} /* end of list of routines */
- /* set the delimiter back to ';' */
- fprintf(sql_file, "DELIMITER ;\n");
- fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;\n");
mysql_free_result(routine_res);
routine_res=NULL;
}
mysql_free_result(routine_list_res);
routine_list_res=NULL;
} /* end of for i (0 .. 1) */
-
- mysql_query(sock, "UNLOCK TABLES");
+ /* set the delimiter back to ';' */
+ fprintf(sql_file, "DELIMITER ;\n");
+ fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;\n");
+
+ /* again, no error report due to permissions */
+ if (opt_lock)
+ mysql_query(sock, "UNLOCK TABLES");
DBUG_RETURN(0);
}
--- 1.62/mysql-test/r/mysqldump.result 2005-09-04 01:34:43 +02:00
+++ 1.63/mysql-test/r/mysqldump.result 2005-09-08 19:45:00 +02:00
@@ -1897,37 +1897,65 @@
BEGIN
select sum(id) from t1 into a;
END //
-SELECT db, name, type, definer, param_list, body
-FROM mysql.proc
-WHERE db = 'test';
-db name type definer param_list body
-test bug9056_func1 FUNCTION root@localhost a INT, b INT RETURN a+b
-test bug9056_func2 FUNCTION root@localhost f1 char binary begin
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `id` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (1),(2),(3),(4),(5);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
+DELIMITER //
+/*!50003 SET SESSION SQL_MODE=""*/ //
+/*!50003 DROP FUNCTION IF EXISTS bug9056_func1 */ //
+/*!50003 CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
+RETURN a+b */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
+/*!50003 DROP FUNCTION IF EXISTS bug9056_func2 */ //
+/*!50003 CREATE FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
+begin
set f1= concat( 'hello', f1 );
return f1;
-end
-test bug9056_proc1 PROCEDURE root@localhost IN a INT, IN b INT, OUT c INT BEGIN SELECT
a+b INTO c; end
-test bug9056_proc2 PROCEDURE root@localhost OUT a INT BEGIN
+end */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
+/*!50003 DROP PROCEDURE IF EXISTS bug9056_proc1 */ //
+/*!50003 CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
+BEGIN SELECT a+b INTO c; end */ //
+/*!50003 SET SESSION SQL_MODE=""*/ //
+/*!50003 DROP PROCEDURE IF EXISTS bug9056_proc2 */ //
+/*!50003 CREATE PROCEDURE `bug9056_proc2`(OUT a INT)
+BEGIN
select sum(id) from t1 into a;
-END
-DROP PROCEDURE IF EXISTS bug9056_func1;
-DROP PROCEDURE IF EXISTS bug9056_func2;
-DROP PROCEDURE IF EXISTS bug9056_proc1;
-DROP PROCEDURE IF EXISTS bug9056_proc2;
-drop table t1;
-SELECT db, name, type, definer, param_list, body
-FROM mysql.proc
-WHERE db = 'test';
-db name type definer param_list body
-test bug9056_func1 FUNCTION root@localhost a INT, b INT RETURN a+b
-test bug9056_func2 FUNCTION root@localhost f1 char binary begin
-set f1= concat( 'hello', f1 );
-return f1;
-end
-test bug9056_proc1 PROCEDURE root@localhost IN a INT, IN b INT, OUT c INT BEGIN SELECT
a+b INTO c; end
-test bug9056_proc2 PROCEDURE root@localhost OUT a INT BEGIN
-select sum(id) from t1 into a;
-END
+END */ //
+DELIMITER ;
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
DROP PROCEDURE IF EXISTS bug9056_func1;
DROP PROCEDURE IF EXISTS bug9056_func2;
DROP PROCEDURE IF EXISTS bug9056_proc1;
--- 1.56/mysql-test/t/mysqldump.test 2005-09-04 01:34:44 +02:00
+++ 1.57/mysql-test/t/mysqldump.test 2005-09-08 19:45:01 +02:00
@@ -798,44 +798,10 @@
DELIMITER ;//
-# just to see what you've created
-# this will not work because of the timestamps!
-# show procedure status;
-#show create procedure bug9056_proc1;
-#show create procedure bug9056_proc2;
-#show function status;
-#show create function bug9056_func1;
-#show create function bug9056_func2;
-SELECT db, name, type, definer, param_list, body
-FROM mysql.proc
-WHERE db = 'test';
-
# Dump the DB and ROUTINES
---exec $MYSQL_DUMP --skip-comments --routines --databases test > var/tmp/mysqldump.sql
-# ok, now blow it all away
---disable_warnings
-DROP PROCEDURE IF EXISTS bug9056_func1;
-DROP PROCEDURE IF EXISTS bug9056_func2;
-DROP PROCEDURE IF EXISTS bug9056_proc1;
-DROP PROCEDURE IF EXISTS bug9056_proc2;
-drop table t1;
---enable-warnings
-
-# Now, restore
---exec $MYSQL test < var/tmp/mysqldump.sql
-
-# Check that the routines have been reloaded
-# this will not work because of the timestamps!
-#show procedure status;
-#show create procedure bug9056_proc1;
-#show create procedure bug9056_proc2;
-#show function status;
-#show create function bug9056_func1;
-#show create function bug9056_func2;
-SELECT db, name, type, definer, param_list, body
-FROM mysql.proc
-WHERE db = 'test';
+--exec $MYSQL_DUMP --skip-comments --routines --databases test
+# ok, now blow it all away
--disable_warnings
DROP PROCEDURE IF EXISTS bug9056_func1;
DROP PROCEDURE IF EXISTS bug9056_func2;
| Thread |
|---|
| • bk commit into 5.0 tree (patg:1.1953) BUG#9056 | Patrick Galbraith | 8 Sep |