mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
fix xml with view
client/mysqldump.c: fixed XML output for view mysql-test/r/mysqldump.result: mysqldump test mysql-test/t/mysqldump.test: mysqldump test sql/sql_base.cc: fix of LOCK workaround
This commit is contained in:
parent
66b4c82eac
commit
808f42d528
4 changed files with 84 additions and 3 deletions
|
@ -1161,6 +1161,12 @@ static uint getTableStructure(char *table, char* db)
|
|||
sprintf(buff,"show keys from %s", result_table);
|
||||
if (mysql_query(sock, buff))
|
||||
{
|
||||
if (mysql_errno(sock) == ER_WRONG_OBJECT)
|
||||
{
|
||||
/* it is VIEW */
|
||||
fputs("\t\t<options Comment=\"view\" />\n", sql_file);
|
||||
goto continue_xml;
|
||||
}
|
||||
fprintf(stderr, "%s: Can't get keys for table %s (%s)\n",
|
||||
my_progname, result_table, mysql_error(sock));
|
||||
if (path)
|
||||
|
@ -1268,6 +1274,7 @@ static uint getTableStructure(char *table, char* db)
|
|||
}
|
||||
mysql_free_result(tableRes); /* Is always safe to free */
|
||||
}
|
||||
continue_xml:
|
||||
if (!opt_xml)
|
||||
fputs(";\n", sql_file);
|
||||
else
|
||||
|
@ -2134,9 +2141,14 @@ static const char *check_if_ignore_table(const char *table_name)
|
|||
mysql_free_result(res);
|
||||
return 0; /* assume table is ok */
|
||||
}
|
||||
if (strcmp(row[1], (result= "MRG_MyISAM")) &&
|
||||
strcmp(row[1], (result= "MRG_ISAM")))
|
||||
result= 0;
|
||||
if (!(row[1]))
|
||||
result= "VIEW";
|
||||
else
|
||||
{
|
||||
if (strcmp(row[1], (result= "MRG_MyISAM")) &&
|
||||
strcmp(row[1], (result= "MRG_ISAM")))
|
||||
result= 0;
|
||||
}
|
||||
mysql_free_result(res);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -332,3 +332,60 @@ CREATE TABLE `t1` (
|
|||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1(a int);
|
||||
create view v1 as select * from t1;
|
||||
-- MySQL dump 10.7
|
||||
--
|
||||
-- Host: localhost Database: test
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.0.2-alpha-valgrind-max-debug-log
|
||||
|
||||
/*!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" */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t1`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Dumping data for table `t1`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Table structure for table `v1`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `v1`;
|
||||
|
||||
--
|
||||
-- View structure for view `v1`
|
||||
--
|
||||
|
||||
DROP VIEW IF EXISTS `v1`;
|
||||
CREATE VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`;
|
||||
|
||||
/*!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 */;
|
||||
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -127,3 +127,12 @@ insert into t1 values (1),(2),(3);
|
|||
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.sql
|
||||
--exec rm $MYSQL_TEST_DIR/var/tmp/t1.txt
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# dump of view
|
||||
#
|
||||
create table t1(a int);
|
||||
create view v1 as select * from t1;
|
||||
--exec $MYSQL_DUMP test
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
|
|
@ -913,6 +913,9 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||
*/
|
||||
{
|
||||
char path[FN_REFLEN];
|
||||
TABLE tab;
|
||||
if (!table)
|
||||
table= &tab;
|
||||
strxnmov(path, FN_REFLEN, mysql_data_home, "/", table_list->db, "/",
|
||||
table_list->real_name, reg_ext, NullS);
|
||||
(void) unpack_filename(path, path);
|
||||
|
|
Loading…
Add table
Reference in a new issue