Merge salvation.intern.azundris.com:/home/tnurnberg/mysql-5.0-release

into  salvation.intern.azundris.com:/home/tnurnberg/work/mysql-5.0-merge
parents b7a55b9b ad12809f
...@@ -2640,7 +2640,7 @@ static int init_dumping(char *database) ...@@ -2640,7 +2640,7 @@ static int init_dumping(char *database)
/* /*
length of table name * 2 (if name contains quotes), 2 quotes and 0 length of table name * 2 (if name contains quotes), 2 quotes and 0
*/ */
char quoted_database_buf[64*2+3]; char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted); char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments) if (opt_comments)
{ {
...@@ -2789,7 +2789,18 @@ static my_bool dump_all_views_in_db(char *database) ...@@ -2789,7 +2789,18 @@ static my_bool dump_all_views_in_db(char *database)
DB_error(sock, "when selecting the database"); DB_error(sock, "when selecting the database");
return 1; return 1;
} }
if (opt_databases || opt_alldbs)
{
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
fprintf(md_result_file,"\nUSE %s;\n", qdatabase);
check_io(md_result_file);
}
if (opt_xml) if (opt_xml)
print_xml_tag1(md_result_file, "", "database name=", database, "\n"); print_xml_tag1(md_result_file, "", "database name=", database, "\n");
if (lock_tables) if (lock_tables)
...@@ -3242,7 +3253,7 @@ static char *primary_key_fields(const char *table_name) ...@@ -3242,7 +3253,7 @@ static char *primary_key_fields(const char *table_name)
MYSQL_RES *res = NULL; MYSQL_RES *res = NULL;
MYSQL_ROW row; MYSQL_ROW row;
/* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */ /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
char show_keys_buff[15 + 64 * 2 + 3]; char show_keys_buff[15 + NAME_LEN * 2 + 3];
uint result_length = 0; uint result_length = 0;
char *result = 0; char *result = 0;
......
...@@ -2470,6 +2470,8 @@ DROP TABLE IF EXISTS `v2`; ...@@ -2470,6 +2470,8 @@ DROP TABLE IF EXISTS `v2`;
`b` varchar(32), `b` varchar(32),
`c` varchar(32) `c` varchar(32)
) */; ) */;
USE `test`;
/*!50001 DROP TABLE IF EXISTS `v0`*/; /*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2789,6 +2791,8 @@ DROP TABLE IF EXISTS `v1`; ...@@ -2789,6 +2791,8 @@ DROP TABLE IF EXISTS `v1`;
/*!50001 CREATE TABLE `v1` ( /*!50001 CREATE TABLE `v1` (
`id` int(11) `id` int(11)
) */; ) */;
USE `mysqldump_test_db`;
/*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
...@@ -2814,56 +2818,61 @@ create database mysqldump_views; ...@@ -2814,56 +2818,61 @@ create database mysqldump_views;
use mysqldump_views; use mysqldump_views;
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_tables`; USE `mysqldump_tables`;
DROP TABLE IF EXISTS `basetable`;
CREATE TABLE `basetable` ( CREATE TABLE `basetable` (
`id` bigint(20) unsigned NOT NULL auto_increment, `id` bigint(20) unsigned NOT NULL auto_increment,
`tag` varchar(64) default NULL, `tag` varchar(64) default NULL,
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `basetable` WRITE;
/*!40000 ALTER TABLE `basetable` DISABLE KEYS */;
/*!40000 ALTER TABLE `basetable` ENABLE KEYS */;
UNLOCK TABLES;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `mysqldump_views`; USE `mysqldump_views`;
DROP TABLE IF EXISTS `nasishnasifu`;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
/*!50001 CREATE TABLE `nasishnasifu` ( /*!50001 CREATE TABLE `nasishnasifu` (
`id` bigint(20) unsigned `id` bigint(20) unsigned
) */; ) */;
/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/; USE `mysqldump_tables`;
USE `mysqldump_views`;
/*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; /*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!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 view nasishnasifu; drop view nasishnasifu;
drop database mysqldump_views; drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
insert into t1 values (1,1);
create view v1 as select f1, f2 from t1;
create database mysqldump_dbb;
use mysqldump_dbb;
create table t1 (f1 int, f2 int);
insert into t1 values (2,2);
create view v1 as select f1, f2 from t1;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
select * from mysqldump_dba.v1;
f1 f2
1 1
select * from mysqldump_dbb.v1;
f1 f2
2 2
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
...@@ -610,7 +610,7 @@ drop database db1; ...@@ -610,7 +610,7 @@ drop database db1;
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
# #
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump --exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
# #
...@@ -1222,9 +1222,47 @@ create database mysqldump_views; ...@@ -1222,9 +1222,47 @@ create database mysqldump_views;
use mysqldump_views; use mysqldump_views;
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_tables mysqldump_views; --exec $MYSQL_DUMP --skip-comments --compact --databases mysqldump_tables mysqldump_views;
drop view nasishnasifu; drop view nasishnasifu;
drop database mysqldump_views; drop database mysqldump_views;
drop table mysqldump_tables.basetable; drop table mysqldump_tables.basetable;
drop database mysqldump_tables; drop database mysqldump_tables;
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
insert into t1 values (1,1);
create view v1 as select f1, f2 from t1;
create database mysqldump_dbb;
use mysqldump_dbb;
create table t1 (f1 int, f2 int);
insert into t1 values (2,2);
create view v1 as select f1, f2 from t1;
--exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_dba mysqldump_dbb > $MYSQLTEST_VARDIR/tmp/bug20221_backup;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20221_backup;
select * from mysqldump_dba.v1;
select * from mysqldump_dbb.v1;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
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