]> git.joonet.de Git - adminer.git/commitdiff
Disable foreign_key_checks only with drop and truncate
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 13 Oct 2009 20:08:58 +0000 (20:08 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 13 Oct 2009 20:08:58 +0000 (20:08 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1191 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/db.inc.php

index e74b8ffa2a4ea7aa435474a194d52414580c0490..d2fe5f59becaf068430f6707b12ff84c526c144f 100644 (file)
@@ -4,7 +4,7 @@ $tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
 if ($tables_views && !$error) {
        $result = true;
        $message = "";
-       if (count($_POST["tables"]) > 1) {
+       if (count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"])) {
                queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
        }
        if (isset($_POST["truncate"])) {
@@ -21,6 +21,7 @@ if ($tables_views && !$error) {
                        $rename[] = idf_escape($table) . " TO " . idf_escape($_POST["target"]) . "." . idf_escape($table);
                }
                $result = queries("RENAME TABLE " . implode(", ", $rename));
+               //! move triggers
                $message = lang('Tables have been moved.');
        } elseif ((!isset($_POST["drop"]) || !$_POST["views"] || queries("DROP VIEW " . implode(", ", array_map('idf_escape', $_POST["views"]))))
        && (!$_POST["tables"] || ($result = queries((isset($_POST["optimize"]) ? "OPTIMIZE" : (isset($_POST["check"]) ? "CHECK" : (isset($_POST["repair"]) ? "REPAIR" : (isset($_POST["drop"]) ? "DROP" : "ANALYZE")))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])))))