bug #1722502 DROP TABLE in export view structure

This commit is contained in:
Marc Delisle
2007-05-21 17:13:49 +00:00
parent b39c6ec5cf
commit e33c249de2
3 changed files with 12 additions and 8 deletions

View File

@@ -75,6 +75,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- bug #1721571 CREATE database privilege not always detected,
thanks to Gordon McNaughton
- bug #1715709 export in SQL format always includes procedures and functions
- bug #1722502 DROP TABLE in export view structure
2.10.1.0 (2007-04-23)
=====================

View File

@@ -439,7 +439,7 @@ if ($export_type == 'server') {
if (isset($GLOBALS[$what . '_structure'])) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table')) {
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table', $export_type)) {
break 3;
}
}
@@ -453,7 +453,7 @@ if ($export_type == 'server') {
foreach($views as $view) {
// no data export for a view
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($current_db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view')) {
if (!PMA_exportStructure($current_db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view', $export_type)) {
break 3;
}
}
@@ -480,7 +480,7 @@ if ($export_type == 'server') {
if (isset($GLOBALS[$what . '_structure'])) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table')) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'stand_in' : 'create_table', $export_type)) {
break 2;
}
}
@@ -494,7 +494,7 @@ if ($export_type == 'server') {
foreach ($views as $view) {
// no data export for a view
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view')) {
if (!PMA_exportStructure($db, $view, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, 'create_view', $export_type)) {
break 2;
}
}
@@ -519,7 +519,7 @@ if ($export_type == 'server') {
$is_view = PMA_Table::isView($db, $table);
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'create_view' : 'create_table')) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates, $is_view ? 'create_view' : 'create_table', $export_type)) {
break;
}
}

View File

@@ -663,12 +663,13 @@ function PMA_getTableComments($db, $table, $crlf, $do_relation = false, $do_comm
* @param boolean whether to include column comments
* @param boolean whether to include mime comments
* @param string 'stand_in', 'create_table', 'create_view'
* @param string 'server', 'database', 'table'
*
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE, $export_mode)
function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE, $comments = FALSE, $mime = FALSE, $dates = FALSE, $export_mode, $export_type)
{
$formatted_table_name = (isset($GLOBALS['sql_backquotes']))
? PMA_backquote($table)
@@ -698,8 +699,10 @@ function PMA_exportStructure($db, $table, $crlf, $error_url, $relation = FALSE,
case 'create_view':
$dump .= $GLOBALS['comment_marker'] . $GLOBALS['strStructureForView'] . ' ' . $formatted_table_name . $crlf
. $GLOBALS['comment_marker'] . $crlf;
// delete the stand-in table previously created
$dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
// delete the stand-in table previously created (if any)
if ($export_type != 'table') {
$dump .= 'DROP TABLE IF EXISTS ' . PMA_backquote($table) . ';' . $crlf;
}
$dump .= PMA_getTableDef($db, $table, $crlf, $error_url, $dates) . ';' . $crlf;
break;
case 'stand_in':