mirror of
https://github.com/vrana/adminer.git
synced 2025-08-15 11:04:02 +02:00
Display foreign keys only for InnoDB
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@158 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -73,8 +73,7 @@ if ($_POST) {
|
||||
$row["fields"][$row["auto_increment"] - 1]["auto_increment"] = true;
|
||||
}
|
||||
} elseif (strlen($_GET["create"])) {
|
||||
$result = table_status($_GET["create"]);
|
||||
$row = $result->fetch_assoc();
|
||||
$row = table_status($_GET["create"]);
|
||||
$row["name"] = $_GET["create"];
|
||||
$row["fields"] = array_values(fields($_GET["create"]));
|
||||
} else {
|
||||
|
@@ -42,7 +42,8 @@ function get_vals($query) {
|
||||
|
||||
function table_status($table) {
|
||||
global $mysql;
|
||||
return $mysql->query("SHOW TABLE STATUS LIKE '" . $mysql->escape_string(addcslashes($table, "%_")) . "'");
|
||||
$result = $mysql->query("SHOW TABLE STATUS LIKE '" . $mysql->escape_string(addcslashes($table, "%_")) . "'");
|
||||
return $result->fetch_assoc();
|
||||
}
|
||||
|
||||
function fields($table) {
|
||||
|
@@ -5,6 +5,7 @@ $result = $mysql->query("SHOW COLUMNS FROM " . idf_escape($_GET["table"]));
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . lang('Unable to show the table definition') . ": " . $mysql->error . ".</p>\n";
|
||||
} else {
|
||||
$table_status = table_status($_GET["table"]);
|
||||
$auto_increment_only = true;
|
||||
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
@@ -33,6 +34,7 @@ if (!$result) {
|
||||
}
|
||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'indexes=' . urlencode($_GET["table"]) . '">' . lang('Alter indexes') . "</a></p>\n";
|
||||
|
||||
if ($table_status["Engine"] == "InnoDB") {
|
||||
echo "<h3>" . lang('Foreign keys') . "</h3>\n";
|
||||
$foreign_keys = foreign_keys($_GET["table"]);
|
||||
if ($foreign_keys) {
|
||||
@@ -49,6 +51,7 @@ if (!$result) {
|
||||
}
|
||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'foreign=' . urlencode($_GET["table"]) . '">' . lang('Add foreign key') . "</a></p>\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($mysql->server_info >= 5) {
|
||||
$result = $mysql->query("SHOW TRIGGERS LIKE '" . $mysql->escape_string(addcslashes($_GET["table"], "%_")) . "'");
|
||||
|
Reference in New Issue
Block a user