1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-07 23:27:17 +02:00

Abstract DELETE, INSERT and INSERT+UPDATE

This commit is contained in:
Jakub Vrana
2013-07-05 09:04:06 -07:00
parent 5557adf289
commit 1f7fa44923
12 changed files with 155 additions and 90 deletions

View File

@@ -203,7 +203,19 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
}
}
}
class Min_Driver extends Min_SQL {
function insertUpdate($table, $set, $primary) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")");
}
}
function idf_escape($idf) {
return '"' . str_replace('"', '""', $idf) . '"';
}
@@ -587,14 +599,6 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return queries("BEGIN");
}
function insert_into($table, $set) {
return queries("INSERT INTO " . table($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
}
function insert_update($table, $set, $primary) {
return queries("REPLACE INTO " . table($table) . " (" . implode(", ", array_keys($set)) . ") VALUES (" . implode(", ", $set) . ")");
}
function last_id() {
global $connection;
return $connection->result("SELECT LAST_INSERT_ROWID()");