Compare commits
2 Commits
cc97d82fd1
...
1dac9cc3df
Author | SHA1 | Date | |
---|---|---|---|
1dac9cc3df | |||
65b1b6365e |
@@ -43,14 +43,14 @@ class PMA_Index
|
|||||||
protected $_columns = array();
|
protected $_columns = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index method used (BTREE, FULLTEXT, HASH, RTREE).
|
* The index method used (BTREE, SPATIAL, FULLTEXT, HASH, RTREE).
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_type = '';
|
protected $_type = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index choice (PRIMARY, UNIQUE, INDEX, FULLTEXT)
|
* The index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@@ -269,6 +269,8 @@ class PMA_Index
|
|||||||
$this->_choice = 'PRIMARY';
|
$this->_choice = 'PRIMARY';
|
||||||
} elseif ('FULLTEXT' == $this->_type) {
|
} elseif ('FULLTEXT' == $this->_type) {
|
||||||
$this->_choice = 'FULLTEXT';
|
$this->_choice = 'FULLTEXT';
|
||||||
|
} elseif ('SPATIAL' == $this->_type) {
|
||||||
|
$this->_choice = 'SPATIAL';
|
||||||
} elseif ('0' == $this->_non_unique) {
|
} elseif ('0' == $this->_non_unique) {
|
||||||
$this->_choice = 'UNIQUE';
|
$this->_choice = 'UNIQUE';
|
||||||
} else {
|
} else {
|
||||||
@@ -323,6 +325,7 @@ class PMA_Index
|
|||||||
'PRIMARY',
|
'PRIMARY',
|
||||||
'INDEX',
|
'INDEX',
|
||||||
'UNIQUE',
|
'UNIQUE',
|
||||||
|
'SPATIAL',
|
||||||
'FULLTEXT',
|
'FULLTEXT',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,11 @@ if (! empty($submit_mult)
|
|||||||
$query_type = 'unique_fld';
|
$query_type = 'unique_fld';
|
||||||
$mult_btn = __('Yes');
|
$mult_btn = __('Yes');
|
||||||
break;
|
break;
|
||||||
|
case 'spatial':
|
||||||
|
unset($submit_mult);
|
||||||
|
$query_type = 'spatial_fld';
|
||||||
|
$mult_btn = __('Yes');
|
||||||
|
break;
|
||||||
case 'ftext':
|
case 'ftext':
|
||||||
unset($submit_mult);
|
unset($submit_mult);
|
||||||
$query_type = 'fulltext_fld';
|
$query_type = 'fulltext_fld';
|
||||||
@@ -368,6 +373,12 @@ elseif ($mult_btn == __('Yes')) {
|
|||||||
. (($i == $selected_cnt-1) ? ');' : '');
|
. (($i == $selected_cnt-1) ? ');' : '');
|
||||||
break;
|
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':
|
case 'fulltext_fld':
|
||||||
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT( ' : ', ')
|
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT( ' : ', ')
|
||||||
. PMA_backquote($selected[$i])
|
. PMA_backquote($selected[$i])
|
||||||
|
@@ -303,11 +303,6 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
|
|||||||
echo __('No tables found in database.');
|
echo __('No tables found in database.');
|
||||||
}
|
}
|
||||||
unset($table_list);
|
unset($table_list);
|
||||||
if ($db != 'information_schema') {
|
|
||||||
echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
|
|
||||||
.'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" alt="' . _pgettext('short form', 'Create table') . '" />'
|
|
||||||
. _pgettext('short form', 'Create table') . '</a></li></ul>';
|
|
||||||
}
|
|
||||||
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
|
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
|
||||||
/* No need to tell user to select database if we're showing complete list */
|
/* No need to tell user to select database if we're showing complete list */
|
||||||
if (!$list) {
|
if (!$list) {
|
||||||
|
@@ -70,6 +70,7 @@ if (isset($_REQUEST['do_save_data'])) {
|
|||||||
case 'FULLTEXT':
|
case 'FULLTEXT':
|
||||||
case 'UNIQUE':
|
case 'UNIQUE':
|
||||||
case 'INDEX':
|
case 'INDEX':
|
||||||
|
case 'SPATIAL':
|
||||||
if ($index->getName() == 'PRIMARY') {
|
if ($index->getName() == 'PRIMARY') {
|
||||||
$error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
|
$error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
|
||||||
}
|
}
|
||||||
@@ -189,6 +190,10 @@ PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b>
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$odd_row = true;
|
$odd_row = true;
|
||||||
|
$spatial_types = array(
|
||||||
|
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
|
||||||
|
'multilinestring', 'multipolygon', 'geomtrycollection'
|
||||||
|
);
|
||||||
foreach ($index->getColumns() as $column) {
|
foreach ($index->getColumns() as $column) {
|
||||||
?>
|
?>
|
||||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||||
@@ -196,8 +201,9 @@ foreach ($index->getColumns() as $column) {
|
|||||||
<option value="">-- <?php echo __('Ignore'); ?> --</option>
|
<option value="">-- <?php echo __('Ignore'); ?> --</option>
|
||||||
<?php
|
<?php
|
||||||
foreach ($fields as $field_name => $field_type) {
|
foreach ($fields as $field_name => $field_type) {
|
||||||
if ($index->getType() != 'FULLTEXT'
|
if (($index->getType() != 'FULLTEXT' || preg_match('/(char|text)/i', $field_type))
|
||||||
|| preg_match('/(char|text)/i', $field_type)) {
|
&& ($index->getType() != 'SPATIAL' || in_array($field_type, $spatial_types))
|
||||||
|
) {
|
||||||
echo '<option value="' . htmlspecialchars($field_name) . '"'
|
echo '<option value="' . htmlspecialchars($field_name) . '"'
|
||||||
. (($field_name == $column->getName()) ? ' selected="selected"' : '') . '>'
|
. (($field_name == $column->getName()) ? ' selected="selected"' : '') . '>'
|
||||||
. htmlspecialchars($field_name) . ' [' . htmlspecialchars($field_type) . ']'
|
. htmlspecialchars($field_name) . ' [' . htmlspecialchars($field_type) . ']'
|
||||||
|
@@ -30,6 +30,8 @@ if (isset($_REQUEST['submit_mult_change_x'])) {
|
|||||||
$submit_mult = 'index';
|
$submit_mult = 'index';
|
||||||
} elseif (isset($_REQUEST['submit_mult_unique_x'])) {
|
} elseif (isset($_REQUEST['submit_mult_unique_x'])) {
|
||||||
$submit_mult = 'unique';
|
$submit_mult = 'unique';
|
||||||
|
} elseif (isset($_REQUEST['submit_mult_spatial_x'])) {
|
||||||
|
$submit_mult = 'spatial';
|
||||||
} elseif (isset($_REQUEST['submit_mult_fulltext_x'])) {
|
} elseif (isset($_REQUEST['submit_mult_fulltext_x'])) {
|
||||||
$submit_mult = 'ftext';
|
$submit_mult = 'ftext';
|
||||||
} elseif (isset($_REQUEST['submit_mult_browse_x'])) {
|
} elseif (isset($_REQUEST['submit_mult_browse_x'])) {
|
||||||
@@ -153,10 +155,12 @@ $titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
|
|||||||
$titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true);
|
$titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true);
|
||||||
$titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true);
|
$titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true);
|
||||||
$titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true);
|
$titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true);
|
||||||
|
$titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Spatial'), true);
|
||||||
$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true);
|
$titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true);
|
||||||
$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true);
|
$titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true);
|
||||||
$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true);
|
$titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true);
|
||||||
$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true);
|
$titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true);
|
||||||
|
$titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Spatial'), true);
|
||||||
$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true);
|
$titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true);
|
||||||
$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
|
$titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
|
||||||
|
|
||||||
@@ -169,6 +173,8 @@ $hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add inde
|
|||||||
$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true);
|
$hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true);
|
||||||
$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true);
|
$hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true);
|
||||||
$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true);
|
$hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true);
|
||||||
|
$hidden_titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Add SPATIAL index'), false, true);
|
||||||
|
$hidden_titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Add SPATIAL index'), false, true);
|
||||||
$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true);
|
$hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true);
|
||||||
$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true);
|
$hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true);
|
||||||
|
|
||||||
@@ -448,6 +454,26 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center" class="index">
|
||||||
|
<?php
|
||||||
|
$spatial_types = array(
|
||||||
|
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
|
||||||
|
'multilinestring', 'multipolygon', 'geomtrycollection'
|
||||||
|
);
|
||||||
|
if (! in_array($type, $spatial_types) || 'MYISAM' != $tbl_type) {
|
||||||
|
echo $titles['NoSpatial'] . "\n";
|
||||||
|
$spatial_enabled = false;
|
||||||
|
} else {
|
||||||
|
echo "\n";
|
||||||
|
?>
|
||||||
|
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL(' . PMA_backquote($row['Field']) . ')'); ?>&message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>"></a>
|
||||||
|
<?php echo $titles['Spatial']; ?></a>
|
||||||
|
<?php
|
||||||
|
$spatial_enabled = true;
|
||||||
|
}
|
||||||
|
echo "\n";
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')
|
if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')
|
||||||
// FULLTEXT is possible on TEXT, CHAR and VARCHAR
|
// FULLTEXT is possible on TEXT, CHAR and VARCHAR
|
||||||
@@ -519,6 +545,19 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
}
|
}
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="action_spatial">
|
||||||
|
<?php
|
||||||
|
if(isset($spatial_enabled)) {
|
||||||
|
if($spatial_enabled) { ?>
|
||||||
|
<a href="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL(' . PMA_backquote($row['Field']) . ')'); ?>&message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
|
||||||
|
<?php echo $hidden_titles['Spatial']; ?>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo $hidden_titles['NoSpatial'];
|
||||||
|
}
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
<div class="action_fulltext">
|
<div class="action_fulltext">
|
||||||
<?php
|
<?php
|
||||||
if(isset($fulltext_enabled)) {
|
if(isset($fulltext_enabled)) {
|
||||||
@@ -572,6 +611,9 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
|
|||||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index');
|
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($tbl_type) && $tbl_type == 'MYISAM') {
|
||||||
|
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_ftext.png', 'spatial');
|
||||||
|
}
|
||||||
if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')) {
|
if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')) {
|
||||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext');
|
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext');
|
||||||
}
|
}
|
||||||
|
@@ -206,42 +206,6 @@ div#left_tableList li {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
#newtable {
|
|
||||||
margin-top: 15px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#newtable a {
|
|
||||||
display: block;
|
|
||||||
padding: 1px;
|
|
||||||
background-image: url(./themes/svg_gradient.php?from=ffffff&to=cccccc);
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#cccccc));
|
|
||||||
background: -moz-linear-gradient(top, #ffffff, #cccccc);
|
|
||||||
background: -o-linear-gradient(top, #ffffff, #cccccc);
|
|
||||||
<?php echo PMA_ieFilter('#ffffff', '#cccccc'); ?>
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
-moz-border-radius: 20px;
|
|
||||||
-webkit-border-radius: 20px;
|
|
||||||
border-radius: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#newtable li:hover {
|
|
||||||
background: transparent !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#newtable a:hover {
|
|
||||||
background-image: url(./themes/svg_gradient.php?from=cccccc&to=dddddd);
|
|
||||||
background-size: 100% 100%;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#dddddd)) !important;
|
|
||||||
background: -moz-linear-gradient(top, #cccccc, #dddddd) !important;
|
|
||||||
background: -o-linear-gradient(top, #cccccc, #dddddd) !important;
|
|
||||||
<?php echo PMA_ieFilter('#cccccc', '#dddddd'); ?>
|
|
||||||
}
|
|
||||||
|
|
||||||
#newtable li a:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
select{
|
select{
|
||||||
-moz-border-radius:2px 2px 2px 2px;
|
-moz-border-radius:2px 2px 2px 2px;
|
||||||
-moz-box-shadow:0 1px 2px #DDDDDD;
|
-moz-box-shadow:0 1px 2px #DDDDDD;
|
||||||
|
Reference in New Issue
Block a user