1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 23:57:29 +02:00

Use output buffering for dump compression

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1161 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-10-02 12:31:28 +00:00
parent e40612a46f
commit 89a60e77b2
5 changed files with 41 additions and 58 deletions

View File

@@ -469,27 +469,6 @@ function process_input($field) {
}
}
/** Print data with optional compression
* @param string null to force output
* @return null
*/
function dump($string = null) { // null $string forces sending of buffer
static $buffer = ""; // used to improve compression and to allow GZ archives unpackable in Total Commander
if (!ereg("text|file", $_POST["output"])) {
$buffer .= $string;
if (!isset($string) || strlen($buffer) > 1e6) {
if ($_POST["output"] == "bz2") {
echo bzcompress($buffer); // should not be called repeatedly but it would require whole buffer in memory or temporary file
} else {
echo gzencode($buffer);
}
$buffer = "";
}
} else {
echo $string;
}
}
/** Print CSV row
* @param array
* @return null
@@ -500,7 +479,7 @@ function dump_csv($row) {
$row[$key] = '"' . str_replace('"', '""', $val) . '"';
}
}
dump(implode(",", $row) . "\n");
echo implode(",", $row) . "\n";
}
/** Apply SQL function