]> git.joonet.de Git - adminer.git/commitdiff
Prepare for index edit
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 4 Jul 2007 17:16:44 +0000 (17:16 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Wed, 4 Jul 2007 17:16:44 +0000 (17:16 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@27 7c3ca157-0c34-0410-bff1-cbf682f78f5c

create.inc.php
index.php
indexes.inc.php [new file with mode: 0644]
table.inc.php

index 4967277c1ac3294c6bc1fe0db1a9e7e7a625fabe..cdcf2e421f119ab6f3fb9596cbca02632bd1629d 100644 (file)
@@ -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>
index 58e200856282c75df451aa7ce188c431ade0e858..6bcb10fa7e4a6b28ea88472011fedd7dbd0479be 100644 (file)
--- a/index.php
+++ b/index.php
@@ -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"])) {
diff --git a/indexes.inc.php b/indexes.inc.php
new file mode 100644 (file)
index 0000000..4e74124
--- /dev/null
@@ -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>
index 5d274953dff9fafd9a3a9a322f2344f0cd2f5cf6..f1241cd6e4eb907d5775756a79b1fb3fd86db075 100644 (file)
@@ -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)) {