Prepare for index edit
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@27 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
77dfca8168
commit
88e1dafdf2
|
@ -43,7 +43,7 @@ if ($_POST) {
|
|||
} else {
|
||||
$row = array("fields" => array());
|
||||
}
|
||||
//! collate columns, references, indexes, unsigned, zerofill, default
|
||||
//! collate columns, references, unsigned, zerofill, default
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<p>
|
||||
|
|
|
@ -17,6 +17,8 @@ if (isset($_GET["sql"])) {
|
|||
include "./edit.inc.php";
|
||||
} elseif (isset($_GET["create"])) {
|
||||
include "./create.inc.php";
|
||||
} elseif (isset($_GET["indexes"])) {
|
||||
include "./indexes.inc.php";
|
||||
} elseif (isset($_GET["dump"])) {
|
||||
include "./dump.inc.php";
|
||||
} elseif (isset($_GET["view"])) {
|
||||
|
|
38
indexes.inc.php
Normal file
38
indexes.inc.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
$index_types = array("PRIMARY", "UNIQUE", "INDEX", "FULLTEXT");
|
||||
if ($_POST) {
|
||||
}
|
||||
|
||||
page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]));
|
||||
echo "<h2>" . lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]) . "</h2>\n";
|
||||
|
||||
if ($_POST) {
|
||||
echo "<p class='error'>" . lang('Unable to operate indexes') . ": " . htmlspecialchars($error) . "</p>\n";
|
||||
$row = $_POST;
|
||||
} else {
|
||||
$row = array("indexes" => indexes($_GET["indexes"]));
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<table border="0" cellspacing="0" cellpadding="2">
|
||||
<?php
|
||||
$fields = array_keys(fields($_GET["indexes"]));
|
||||
$j = 0;
|
||||
foreach ($row["indexes"] as $type => $index) {
|
||||
foreach ($index as $columns) {
|
||||
echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $type, "not_vals") . "</select></td><td>";
|
||||
sort($columns);
|
||||
foreach ($columns as $i => $column) {
|
||||
echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column, "not_vals") . "</select>";
|
||||
}
|
||||
echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array(), "not_vals") . "</select>";
|
||||
echo "</td></tr>\n";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
//! JavaScript for adding more indexes and columns
|
||||
?>
|
||||
<tr><td><select name="indexes[<?php echo $j; ?>][type]"><option></option><?php echo optionlist($index_types, array(), "not_vals"); ?></select></td><td><select name="indexes[<?php echo $j; ?>][columns][1]"><option></option><?php echo optionlist($fields, array(), "not_vals"); ?></select></td></tr>
|
||||
</table>
|
||||
<p><input type="submit" value="<?php echo lang('Alter indexes'); ?>" /></p>
|
||||
</form>
|
|
@ -11,9 +11,9 @@ echo "</table>\n";
|
|||
mysql_free_result($result);
|
||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'create=' . urlencode($_GET["table"]) . '">' . lang('Alter table') . "</a></p>\n";
|
||||
|
||||
echo "<h3>" . lang('Indexes') . "</h3>\n";
|
||||
$indexes = indexes($_GET["table"]);
|
||||
if ($indexes) {
|
||||
echo "<h3>" . lang('Indexes') . "</h3>\n";
|
||||
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
||||
foreach ($indexes as $type => $index) {
|
||||
foreach ($index as $columns) {
|
||||
|
@ -23,6 +23,7 @@ if ($indexes) {
|
|||
}
|
||||
echo "</table>\n";
|
||||
}
|
||||
echo '<p><a href="' . htmlspecialchars($SELF) . 'indexes=' . urlencode($_GET["table"]) . '">' . lang('Alter indexes') . "</a></p>\n";
|
||||
|
||||
$result = mysql_query("SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "' AND TABLE_NAME = '" . mysql_real_escape_string($_GET["table"]) . "' AND REFERENCED_TABLE_NAME IS NOT NULL ORDER BY ORDINAL_POSITION");
|
||||
if (mysql_num_rows($result)) {
|
||||
|
|
Loading…
Reference in a new issue