Limitation feature for data dumps wasn't working with CSV exports
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2001-07-13 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
|
* lib.inc.php3, tbl_dump.php3: limitation feature for data dumps wasn't
|
||||||
|
working with CSV exports.
|
||||||
|
|
||||||
2001-07-13 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
2001-07-13 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||||
* lib.inc.php3, tbl_dump.php3, tbl_properties.php3, translations: added a
|
* lib.inc.php3, tbl_dump.php3, tbl_properties.php3, translations: added a
|
||||||
limitation feature for data dumps thanks to
|
limitation feature for data dumps thanks to
|
||||||
|
33
lib.inc.php3
33
lib.inc.php3
@@ -662,7 +662,7 @@ function get_table_content($db, $table, $limit_from = 0, $limit_to = 0, $handler
|
|||||||
*/
|
*/
|
||||||
function get_table_content_fast($db, $table, $add_query = '', $handler)
|
function get_table_content_fast($db, $table, $add_query = '', $handler)
|
||||||
{
|
{
|
||||||
$result = mysql_query('SELECT * FROM ' . db_name($db) . '.' . tbl_name($table). $add_query) or mysql_die();
|
$result = mysql_query('SELECT * FROM ' . db_name($db) . '.' . tbl_name($table) . $add_query) or mysql_die();
|
||||||
if ($result != false) {
|
if ($result != false) {
|
||||||
|
|
||||||
// Checks whether the field is an integer or not
|
// Checks whether the field is an integer or not
|
||||||
@@ -822,15 +822,20 @@ function count_records($db, $table, $ret = false)
|
|||||||
/**
|
/**
|
||||||
* Output the content of a table in CSV format
|
* Output the content of a table in CSV format
|
||||||
*
|
*
|
||||||
* @param string the database name
|
* @param string the database name
|
||||||
* @param string the table name
|
* @param string the table name
|
||||||
* @param string the separation string
|
* @param integer the offset on this table
|
||||||
* @param string the handler (function) to call. It must accept one parameter
|
* @param integer the last row to get
|
||||||
* ($sql_insert)
|
* @param string the separation string
|
||||||
|
* @param string the handler (function) to call. It must accept one
|
||||||
|
* parameter ($sql_insert)
|
||||||
*
|
*
|
||||||
* @return boolean always true
|
* @return boolean always true
|
||||||
|
*
|
||||||
|
* Last revision 14 July 2001: Patch for limiting dump size from
|
||||||
|
* vinay@sanisoft.com & girish@sanisoft.com
|
||||||
*/
|
*/
|
||||||
function get_table_csv($db, $table, $sep, $handler)
|
function get_table_csv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $handler)
|
||||||
{
|
{
|
||||||
// Handles the separator character
|
// Handles the separator character
|
||||||
if (empty($sep)) {
|
if (empty($sep)) {
|
||||||
@@ -843,8 +848,20 @@ function get_table_csv($db, $table, $sep, $handler)
|
|||||||
$sep = str_replace('\\t', "\011", $sep);
|
$sep = str_replace('\\t', "\011", $sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the data from the database
|
// Gets the data from the database
|
||||||
$result = mysql_query('SELECT * FROM ' . db_name($db) . '.' . tbl_name($table)) or mysql_die();
|
$result = mysql_query('SELECT * FROM ' . db_name($db) . '.' . tbl_name($table) . $add_query) or mysql_die();
|
||||||
|
|
||||||
// Format the data
|
// Format the data
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
@@ -164,7 +164,7 @@ else
|
|||||||
else
|
else
|
||||||
{ // $what != "csv"
|
{ // $what != "csv"
|
||||||
$tmp_buffer="";
|
$tmp_buffer="";
|
||||||
get_table_csv($db, $table, $separator, "my_csvhandler");
|
get_table_csv($db, $table, $limit_from, $limit_to, $separator, "my_csvhandler");
|
||||||
$dump_buffer.=$tmp_buffer;
|
$dump_buffer.=$tmp_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user