Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prepare for index edit

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@27 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
commit 88e1dafdf26720660e69e1db335e029b67afc6d4 1 parent 77dfca8
jakubvrana authored
Showing with 43 additions and 2 deletions.
  1. +1 −1  create.inc.php
  2. +2 −0  index.php
  3. +38 −0 indexes.inc.php
  4. +2 −1  table.inc.php
View
2  create.inc.php
@@ -43,7 +43,7 @@
} else {
$row = array("fields" => array());
}
-//! collate columns, references, indexes, unsigned, zerofill, default
+//! collate columns, references, unsigned, zerofill, default
?>
<form action="" method="post">
<p>
View
2  index.php
@@ -17,6 +17,8 @@
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"])) {
View
38 indexes.inc.php
@@ -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>
View
3  table.inc.php
@@ -11,9 +11,9 @@
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 @@
}
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)) {

0 comments on commit 88e1daf

Please sign in to comment.
Something went wrong with that request. Please try again.