diff --git a/ChangeLog b/ChangeLog index 0db1f899d..b7eef1daa 100755 --- a/ChangeLog +++ b/ChangeLog @@ -8,11 +8,14 @@ $Source$ 2002-05-05 Loïc Chapeaux * 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 * 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. diff --git a/libraries/build_dump.lib.php3 b/libraries/build_dump.lib.php3 index 4cd00feed..073625a48 100644 --- a/libraries/build_dump.lib.php3 +++ b/libraries/build_dump.lib.php3 @@ -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 = ' ' . $crlf; while ($record = mysql_fetch_array($result, MYSQL_ASSOC)) { diff --git a/tbl_dump.php3 b/tbl_dump.php3 index 5304ff100..61e8c99cd 100755 --- a/tbl_dump.php3 +++ b/tbl_dump.php3 @@ -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++; }