Enabled the ability to export only some records in xml format

This commit is contained in:
Loïc Chapeaux
2002-05-05 13:07:38 +00:00
parent 639a9bb018
commit 9b1d989602
3 changed files with 24 additions and 4 deletions

View File

@@ -8,11 +8,14 @@ $Source$
2002-05-05 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lang/thai.inc.php3: completed thanks to Arthit Suriyawongkul &
Warit Wanasathian.
* tbl_dump.php3; libraries/build_dump.lib.php3: enabled the ability to
export only some records in xml format.
* tbl_properties_export.php3: xhtml fixes.
2002-05-05 Alexander M. Turek <rabus@users.sourceforge.net>
* db_details_links.php3, tbl_properties_links.php3, lang/*.inc.php3:
Use "SQL" instead of "home" as link name.
* tbl_properties_export.php3: Added XML export option (todo: limit feature).
* tbl_properties_export.php3: Added XML export option.
* tbl_dump.php3: Beautified XML output.
* lang/german.inc.php3: Better translation for $strDumpXRows.

View File

@@ -561,6 +561,8 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
*
* @param string the database name
* @param string the table name
* @param integer the offset on this table
* @param integer the last row to get
* @param string the end of line sequence
* @param string the url to go back in case of error
*
@@ -568,7 +570,7 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
*
* @access public
*/
function PMA_getTableXML($db, $table, $crlf, $error_url) {
function PMA_getTableXML($db, $table, $limit_from = 0, $limit_to = 0, $crlf, $error_url) {
$local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
for ($i = 0; $row = mysql_fetch_array($result, MYSQL_ASSOC); $i++) {
@@ -578,7 +580,19 @@ if (!defined('PMA_BUILD_DUMP_LIB_INCLUDED')){
unset($i);
mysql_free_result($result);
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
// Defines the offsets to use
if ($limit_from > 0) {
$limit_from--;
} else {
$limit_from = 0;
}
if ($limit_to > 0 && $limit_from >= 0) {
$add_query = " LIMIT $limit_from, $limit_to";
} else {
$add_query = '';
}
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . $add_query;
$result = mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $error_url);
$buffer = ' <!-- ' . $GLOBALS['strTable'] . ' ' . $table . ' -->' . $crlf;
while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) {

View File

@@ -305,9 +305,12 @@ else {
if (!isset($single)) {
$table = mysql_tablename($tables, $i);
}
if (!isset($limit_from) || !isset($limit_to)) {
$limit_from = $limit_to = 0;
}
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $table . '|'))
|| (!isset($tmp_select) && !empty($table))) {
$dump_buffer .= PMA_getTableXML($db, $table, $crlf, $err_url);
$dump_buffer .= PMA_getTableXML($db, $table, $limit_from, $limit_to, $crlf, $err_url);
}
$i++;
}