]> git.joonet.de Git - adminer.git/commitdiff
MySQL: Support spatial indexes (bug #455)
authorJakub Vrana <jakub@vrana.cz>
Mon, 20 Feb 2017 16:25:19 +0000 (17:25 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 20 Feb 2017 16:25:34 +0000 (17:25 +0100)
adminer/drivers/mysql.inc.php
adminer/indexes.inc.php
changes.txt

index 806ca949a709132b2285eb90c18a9a2c12605db7..dcd57bbffcb512befa5f337fe1001e3cc4205e2e 100644 (file)
@@ -500,9 +500,9 @@ if (!defined("DRIVER")) {
        function indexes($table, $connection2 = null) {
                $return = array();
                foreach (get_rows("SHOW INDEX FROM " . table($table), $connection2) as $row) {
-                       $return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? "INDEX" : "UNIQUE")));
+                       $return[$row["Key_name"]]["type"] = ($row["Key_name"] == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? ($row["Index_type"] == "SPATIAL" ? "SPATIAL" : "INDEX") : "UNIQUE")));
                        $return[$row["Key_name"]]["columns"][] = $row["Column_name"];
-                       $return[$row["Key_name"]]["lengths"][] = $row["Sub_part"];
+                       $return[$row["Key_name"]]["lengths"][] = ($row["Index_type"] == "SPATIAL" ? null : $row["Sub_part"]);
                        $return[$row["Key_name"]]["descs"][] = null;
                }
                return $return;
index ca69d5dd9b6a479aa127136b569efe883a8c9841..806e1b6e73e930401fc3726239dc6b5d85a93fe9 100644 (file)
@@ -5,6 +5,9 @@ $table_status = table_status($TABLE, true);
 if (preg_match('~MyISAM|M?aria' . ($connection->server_info >= 5.6 ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
        $index_types[] = "FULLTEXT";
 }
+if (preg_match('~MyISAM|M?aria' . ($connection->server_info >= 5.7 ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
+       $index_types[] = "SPATIAL";
+}
 $indexes = indexes($TABLE);
 $primary = array();
 if ($jush == "mongo") { // doesn't support primary key
index 5320d390c74f6565985796fc5978d409c80c1bb6..18ebbc6063bedfbed66455eded0a7ca625290e5c 100644 (file)
@@ -3,6 +3,7 @@ Add accessibility labels
 Make maxlength in edit fields a soft limit
 Add Cache-Control: immutable to static files
 MySQL: Add dedicated view for replication status
+MySQL: Support spatial indexes
 PostgreSQL: Export
 PostgreSQL: Don't treat partial indexes as unique
 MS SQL: Support pdo_dblib