From: Jakub Vrana Date: Thu, 20 May 2010 20:06:34 +0000 (+0200) Subject: ON DELETE action for foreign keys in Create table X-Git-Tag: v3.0.0~101 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=dc4fc82db813882c32944a3e3c4a1291be020ddd;p=adminer.git ON DELETE action for foreign keys in Create table --- diff --git a/adminer/create.inc.php b/adminer/create.inc.php index 101ac2ab..22fe647c 100644 --- a/adminer/create.inc.php +++ b/adminer/create.inc.php @@ -5,7 +5,7 @@ $partition_by = array('HASH', 'LINEAR HASH', 'KEY', 'LINEAR KEY', 'RANGE', 'LIST $referencable_primary = referencable_primary($TABLE); $foreign_keys = array(); foreach ($referencable_primary as $table_name => $field) { - $foreign_keys[idf_escape($table_name) . "." . idf_escape($field["field"])] = $table_name; + $foreign_keys[str_replace("`", "``", $table_name) . "`" . str_replace("`", "``", $field["field"])] = $table_name; // not idf_escape() - used in JS } $orig_fields = array(); @@ -44,7 +44,7 @@ if ($_POST && !$error && !$_POST["add"] && !$_POST["drop_col"] && !$_POST["up"] $fields[] = array($field["orig"], $process_field, $after); } if (isset($foreign_key)) { - $foreign[] = ($TABLE != "" ? "ADD" : " ") . " FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_key) . " (" . idf_escape($type_field["field"]) . ")"; + $foreign[] = ($TABLE != "" ? "ADD" : " ") . " FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . ")" . (in_array($field["on_delete"], $on_actions) ? " ON DELETE $field[on_delete]" : ""); } $after = "AFTER " . idf_escape($field["field"]); } elseif ($field["orig"] != "") { @@ -178,12 +178,12 @@ if (support("partitioning")) { > $val) { - echo ''; - echo ''; + echo ' " size="3" onfocus="editingLengthFocus(this);">