diff --git a/libraries/Index.class.php b/libraries/Index.class.php
index ee266aa13..bab0018ab 100644
--- a/libraries/Index.class.php
+++ b/libraries/Index.class.php
@@ -43,14 +43,14 @@ class PMA_Index
protected $_columns = array();
/**
- * The index method used (BTREE, FULLTEXT, HASH, RTREE).
+ * The index method used (BTREE, SPATIAL, FULLTEXT, HASH, RTREE).
*
* @var string
*/
protected $_type = '';
/**
- * The index choice (PRIMARY, UNIQUE, INDEX, FULLTEXT)
+ * The index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
*
* @var string
*/
@@ -269,6 +269,8 @@ class PMA_Index
$this->_choice = 'PRIMARY';
} elseif ('FULLTEXT' == $this->_type) {
$this->_choice = 'FULLTEXT';
+ } elseif ('SPATIAL' == $this->_type) {
+ $this->_choice = 'SPATIAL';
} elseif ('0' == $this->_non_unique) {
$this->_choice = 'UNIQUE';
} else {
@@ -323,6 +325,7 @@ class PMA_Index
'PRIMARY',
'INDEX',
'UNIQUE',
+ 'SPATIAL',
'FULLTEXT',
);
}
diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php
index 270ab71f0..22e9e49fe 100644
--- a/libraries/mult_submits.inc.php
+++ b/libraries/mult_submits.inc.php
@@ -88,6 +88,11 @@ if (! empty($submit_mult)
$query_type = 'unique_fld';
$mult_btn = __('Yes');
break;
+ case 'spatial':
+ unset($submit_mult);
+ $query_type = 'spatial_fld';
+ $mult_btn = __('Yes');
+ break;
case 'ftext':
unset($submit_mult);
$query_type = 'fulltext_fld';
@@ -368,6 +373,12 @@ elseif ($mult_btn == __('Yes')) {
. (($i == $selected_cnt-1) ? ');' : '');
break;
+ case 'spatial_fld':
+ $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL( ' : ', ')
+ . PMA_backquote($selected[$i])
+ . (($i == $selected_cnt-1) ? ');' : '');
+ break;
+
case 'fulltext_fld':
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT( ' : ', ')
. PMA_backquote($selected[$i])
diff --git a/tbl_indexes.php b/tbl_indexes.php
index ac3238721..f44c28ac3 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -70,6 +70,7 @@ if (isset($_REQUEST['do_save_data'])) {
case 'FULLTEXT':
case 'UNIQUE':
case 'INDEX':
+ case 'SPATIAL':
if ($index->getName() == 'PRIMARY') {
$error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
}
@@ -189,6 +190,10 @@ PMA_Message::notice(__('("PRIMARY" must be the name of and only of
getColumns() as $column) {
?>
@@ -196,8 +201,9 @@ foreach ($index->getColumns() as $column) {
$field_type) {
- if ($index->getType() != 'FULLTEXT'
- || preg_match('/(char|text)/i', $field_type)) {
+ if (($index->getType() != 'FULLTEXT' || preg_match('/(char|text)/i', $field_type))
+ && ($index->getType() != 'SPATIAL' || in_array($field_type, $spatial_types))
+ ) {
echo '