From 339981b9d6008dbbe855fe2a89a7180239ffa874 Mon Sep 17 00:00:00 2001 From: Takashi SHIRAI Date: Tue, 26 Mar 2019 13:18:34 +0900 Subject: [PATCH] Support importing table data Signed-off-by: Takashi SHIRAI --- adminer/drivers/oracle.inc.php | 19 +++++++++++++++++++ changes.txt | 1 + 2 files changed, 20 insertions(+) diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php index 8256ab44..94d30103 100644 --- a/adminer/drivers/oracle.inc.php +++ b/adminer/drivers/oracle.inc.php @@ -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; + } } diff --git a/changes.txt b/changes.txt index 71e5d292..e2416faf 100644 --- a/changes.txt +++ b/changes.txt @@ -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):