diff options
author | Marc Delisle <marc@infomarc.info> | 2006-12-26 17:07:02 +0300 |
---|---|---|
committer | Marc Delisle <marc@infomarc.info> | 2006-12-26 17:07:02 +0300 |
commit | ac5be0261a66432086749062c97022dcc7b60f64 (patch) | |
tree | b8d4f46cc905beed5de0990cdeacb50bbd5cbdf8 /export.php | |
parent | c06c96f317911f73d7362812ff3465bc7934f109 (diff) |
set local_query only if we are exporting data
Diffstat (limited to 'export.php')
-rw-r--r-- | export.php | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/export.php b/export.php index 4b7602bcaa..e6adb36f70 100644 --- a/export.php +++ b/export.php @@ -421,13 +421,13 @@ if ($export_type == 'server') { $views[] = $table; continue; } - $local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table); if (isset($GLOBALS[$what . '_structure'])) { if (!PMA_exportStructure($current_db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) { break 3; } } 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)) { break 3; } @@ -460,21 +460,17 @@ if ($export_type == 'server') { $views[] = $table; 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 (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) { - break 2; - } + if (isset($GLOBALS[$what . '_structure'])) { + if (!PMA_exportStructure($db, $table, $crlf, $err_url, $do_relation, $do_comments, $do_mime, $do_dates)) { + break 2; } - if (isset($GLOBALS[$what . '_data'])) { - if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) { - break 2; - } + } + 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)) { + break 2; } - //} + } } foreach ($views as $view) { // no data export for a view @@ -502,26 +498,25 @@ if ($export_type == 'server') { $add_query = ''; } - if (!empty($sql_query)) { - // only preg_replace if needed - if (!empty($add_query)) { - // remove trailing semicolon before adding a LIMIT - $sql_query = preg_replace('%;\s*$%', '', $sql_query); - } - $local_query = $sql_query . $add_query; - PMA_DBI_select_db($db); - } else { - $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 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)) { + // only preg_replace if needed + if (!empty($add_query)) { + // remove trailing semicolon before adding a LIMIT + $sql_query = preg_replace('%;\s*$%', '', $sql_query); + } + $local_query = $sql_query . $add_query; + PMA_DBI_select_db($db); + } else { + $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query; + } if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) { break; } |