1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 11:34:10 +02:00

Customizable export

This commit is contained in:
Jakub Vrana
2010-10-29 17:03:02 +02:00
parent a2443670f8
commit 095d472366
8 changed files with 229 additions and 208 deletions

View File

@@ -442,6 +442,29 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
return html_select("format", array('csv' => 'CSV,', 'csv;' => 'CSV;'), $value, $select);
}
function dumpTable() {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
}
function dumpData($table, $style, $select = "") {
global $connection;
$result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT
if ($result) {
while ($row = $result->fetch_assoc()) {
dump_csv($row);
}
}
}
function dumpHeaders($identifier) {
$filename = ($identifier != "" ? friendly_url($identifier) : "dump");
$ext = "csv";
header("Content-Type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename.$ext");
session_write_close();
return $ext;
}
function navigation($missing) {
global $VERSION, $token;
?>

View File

@@ -1,23 +0,0 @@
<?php
function dump_table($table) {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
}
function dump_data($table, $style, $select = "") {
global $connection;
$result = $connection->query(($select ? $select : "SELECT * FROM " . idf_escape($table)), 1); // 1 - MYSQLI_USE_RESULT
if ($result) {
while ($row = $result->fetch_assoc()) {
dump_csv($row);
}
}
}
function dump_headers($identifier) {
$filename = ($identifier != "" ? friendly_url($identifier) : "dump");
$ext = "csv";
header("Content-Type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=$filename.$ext");
session_write_close();
return $ext;
}