bug #1443004, VIEW and export
This commit is contained in:
@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2006-04-13 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* export.php: bug #1443004 part 2: export views after the tables
|
||||||
|
|
||||||
2006-04-12 Marc Delisle <lem9@users.sourceforge.net>
|
2006-04-12 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* export.php: bug #1443004 part 1: do not generate INSERT statements
|
* export.php: bug #1443004 part 1: do not generate INSERT statements
|
||||||
for an exported VIEW
|
for an exported VIEW
|
||||||
|
42
export.php
42
export.php
@@ -429,19 +429,34 @@ if ($export_type == 'server') {
|
|||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
$tables = PMA_DBI_get_tables($current_db);
|
$tables = PMA_DBI_get_tables($current_db);
|
||||||
|
$views = array();
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
|
// if this is a view, collect it for later; views must be exported
|
||||||
|
// after the tables
|
||||||
|
if (PMA_Table::isView($current_db, $table)) {
|
||||||
|
$views[] = $table;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
|
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
|
||||||
if (isset($GLOBALS[$what . '_structure'])) {
|
if (isset($GLOBALS[$what . '_structure'])) {
|
||||||
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
|
if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
|
||||||
break 3;
|
break 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($GLOBALS[$what . '_data']) && ! PMA_table::isView($current_db, $table)) {
|
if (isset($GLOBALS[$what . '_data'])) {
|
||||||
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query)) {
|
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query)) {
|
||||||
break 3;
|
break 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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)) {
|
||||||
|
break 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!PMA_exportDBFooter($current_db)) {
|
if (!PMA_exportDBFooter($current_db)) {
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
@@ -457,14 +472,14 @@ if ($export_type == 'server') {
|
|||||||
$tmp_select = '|' . $tmp_select . '|';
|
$tmp_select = '|' . $tmp_select . '|';
|
||||||
}
|
}
|
||||||
$i = 0;
|
$i = 0;
|
||||||
//$view = array();
|
$views = array();
|
||||||
foreach ($tables as $table) {
|
foreach ($tables as $table) {
|
||||||
// if this is a view, collect it for later; views must be exported after
|
// if this is a view, collect it for later; views must be exported after
|
||||||
// the tables
|
// the tables
|
||||||
//if (PMA_Table::isView($db, $table)) {
|
if (PMA_Table::isView($db, $table)) {
|
||||||
// $views[] = $table;
|
$views[] = $table;
|
||||||
// continue;
|
continue;
|
||||||
//}
|
}
|
||||||
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||||
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))
|
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))
|
||||||
|| !isset($tmp_select)) {
|
|| !isset($tmp_select)) {
|
||||||
@@ -474,13 +489,22 @@ if ($export_type == 'server') {
|
|||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($GLOBALS[$what . '_data']) && ! PMA_table::isView($db, $table)) {
|
if (isset($GLOBALS[$what . '_data'])) {
|
||||||
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
|
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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)) {
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!PMA_exportDBFooter($db)) {
|
if (!PMA_exportDBFooter($db)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -515,7 +539,9 @@ if ($export_type == 'server') {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($GLOBALS[$what . '_data']) && ! PMA_table::isView($db, $table)) {
|
// I think we have to export data for a single view; for example PDF report
|
||||||
|
//if (isset($GLOBALS[$what . '_data']) && ! PMA_table::isView($db, $table)) {
|
||||||
|
if (isset($GLOBALS[$what . '_data'])) {
|
||||||
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
|
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user