Support importing table data

Signed-off-by: Takashi SHIRAI <shirai@nintendo.co.jp>
This commit is contained in:
Takashi SHIRAI 2019-03-26 13:18:34 +09:00 committed by Jakub Vrana
parent 53a8496412
commit 339981b9d6
2 changed files with 20 additions and 0 deletions

View file

@ -141,6 +141,25 @@ if (isset($_GET["oracle"])) {
return true; // automatic start
}
function insertUpdate($table, $rows, $primary) {
global $connection;
foreach ($rows as $set) {
$update = array();
$where = array();
foreach ($set as $key => $val) {
$update[] = "$key = $val";
if (isset($primary[idf_unescape($key)])) {
$where[] = "$key = $val";
}
}
if (!(($where && queries("UPDATE " . table($table) . " SET " . implode(", ", $update) . " WHERE " . implode(" AND ", $where)) && $connection->affected_rows)
|| queries("INSERT INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")")
)) {
return false;
}
}
return true;
}
}

View file

@ -11,6 +11,7 @@ PostgreSQL: Do not show triggers from other schemas (PR #412)
PostgreSQL: Fix multi-parameter functions in default values (bug #736)
PostgreSQL PDO: Do not select NULL function for false values in edit
Oracle: Count tables
Oracle: Import from CSV
SimpleDB, Firebird, ClickHouse: Move to plugin
Adminer 4.7.9 (released 2021-02-07):