mirror of
https://github.com/vrana/adminer.git
synced 2025-08-17 20:01:25 +02:00
TSV export and import (bug #3097657)
This commit is contained in:
@@ -494,7 +494,7 @@ document.getElementById('username').focus();
|
||||
* @return array
|
||||
*/
|
||||
function dumpFormat() {
|
||||
return array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;');
|
||||
return array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;', 'tsv' => 'TSV');
|
||||
}
|
||||
|
||||
/** Export table structure
|
||||
|
@@ -697,11 +697,11 @@ function search_tables() {
|
||||
*/
|
||||
function dump_csv($row) {
|
||||
foreach ($row as $key => $val) {
|
||||
if (preg_match("~[\"\n,;]~", $val) || $val === "") {
|
||||
if (preg_match("~[\"\n,;\t]~", $val) || $val === "") {
|
||||
$row[$key] = '"' . str_replace('"', '""', $val) . '"';
|
||||
}
|
||||
}
|
||||
echo implode(($_POST["format"] == "csv" ? "," : ";"), $row) . "\n";
|
||||
echo implode(($_POST["format"] == "csv" ? "," : ($_POST["format"] == "tsv" ? "\t" : ";")), $row) . "\n";
|
||||
}
|
||||
|
||||
/** Apply SQL function
|
||||
|
Reference in New Issue
Block a user