mirror of
https://github.com/vrana/adminer.git
synced 2025-08-16 11:34:10 +02:00
Customizable export
This commit is contained in:
@@ -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;
|
||||
?>
|
||||
|
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user