]> git.joonet.de Git - adminer.git/commitdiff
Support importing table data
authorTakashi SHIRAI <shirai@nintendo.co.jp>
Tue, 26 Mar 2019 04:18:34 +0000 (13:18 +0900)
committerJakub Vrana <jakub@vrana.cz>
Tue, 9 Feb 2021 08:42:18 +0000 (09:42 +0100)
Signed-off-by: Takashi SHIRAI <shirai@nintendo.co.jp>
adminer/drivers/oracle.inc.php
changes.txt

index 8256ab443b9d096ad75b589844dac7576b68fc5b..94d30103e8e6400e7db60679a345cbd76a6e0439 100644 (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;
+               }
        }
 
 
index 71e5d292043e82f6f5bdb61ed36ed1ebe12280d8..e2416faf8b1a757e299bb8afc78d65b1799d0724 100644 (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):