set local_query only if we are exporting data

This commit is contained in:
Marc Delisle
2006-12-26 14:07:02 +00:00
parent c06c96f317
commit ac5be0261a
2 changed files with 26 additions and 28 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog
$Id$ $Id$
$HeadURL$ $HeadURL$
2006-12-26 Marc Delisle <lem9@users.sourceforge.net>
* export.php: set $local_query only if we are exporting data
2006-12-20 Marc Delisle <lem9@users.sourceforge.net> 2006-12-20 Marc Delisle <lem9@users.sourceforge.net>
* libraries/export/sql.php: bug #1619647, export of query results * libraries/export/sql.php: bug #1619647, export of query results
should not contain procedure definitions should not contain procedure definitions

View File

@@ -421,13 +421,13 @@ if ($export_type == 'server') {
$views[] = $table; $views[] = $table;
continue; continue;
} }
$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'])) { if (isset($GLOBALS[$what . '_data'])) {
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
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;
} }
@@ -460,21 +460,17 @@ if ($export_type == 'server') {
$views[] = $table; $views[] = $table;
continue; continue;
} }
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
//if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))
//|| !isset($tmp_select)) {
if (isset($GLOBALS[$what . '_structure'])) { if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) { if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break 2; break 2;
} }
} }
if (isset($GLOBALS[$what . '_data'])) { if (isset($GLOBALS[$what . '_data'])) {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
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) { foreach ($views as $view) {
// no data export for a view // no data export for a view
@@ -502,6 +498,14 @@ if ($export_type == 'server') {
$add_query = ''; $add_query = '';
} }
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break;
}
}
// If this is an export of a single view, we have to export data;
// for example, a PDF report
if (isset($GLOBALS[$what . '_data'])) {
if (!empty($sql_query)) { if (!empty($sql_query)) {
// only preg_replace if needed // only preg_replace if needed
if (!empty($add_query)) { if (!empty($add_query)) {
@@ -513,15 +517,6 @@ if ($export_type == 'server') {
} else { } else {
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
} }
if (isset($GLOBALS[$what . '_structure'])) {
if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) {
break;
}
}
// 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;
} }