bug #2161443 [structure] Incorrect index choice shown when modifying an index
This commit is contained in:
@@ -41,6 +41,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
|||||||
+ [lang] Hungarian update, thanks to Jozsef Tamas Herczeg - dodika
|
+ [lang] Hungarian update, thanks to Jozsef Tamas Herczeg - dodika
|
||||||
- bug #2153970 [core] Properly truncate SQL to avoid half of html tags
|
- bug #2153970 [core] Properly truncate SQL to avoid half of html tags
|
||||||
+ [lang] Romanian update, thanks to Sergiu Bivol - sbivol
|
+ [lang] Romanian update, thanks to Sergiu Bivol - sbivol
|
||||||
|
- bug #2161443 [structure] Incorrect index choice shown when modifying an
|
||||||
|
index
|
||||||
|
|
||||||
3.0.0.0 (2008-09-27)
|
3.0.0.0 (2008-09-27)
|
||||||
+ [export] properly handle line breaks for YAML, thanks to Dan Barry -
|
+ [export] properly handle line breaks for YAML, thanks to Dan Barry -
|
||||||
|
@@ -48,6 +48,13 @@ class PMA_Index
|
|||||||
*/
|
*/
|
||||||
protected $_type = '';
|
protected $_type = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The index choice (PRIMARY, UNIQUE, INDEX, FULLTEXT)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $_choice = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Various remarks.
|
* Various remarks.
|
||||||
*
|
*
|
||||||
@@ -257,6 +264,15 @@ class PMA_Index
|
|||||||
if (isset($params['Packed'])) {
|
if (isset($params['Packed'])) {
|
||||||
$this->_packed = $params['Packed'];
|
$this->_packed = $params['Packed'];
|
||||||
}
|
}
|
||||||
|
if ('PRIMARY' == $this->_name) {
|
||||||
|
$this->_choice = 'PRIMARY';
|
||||||
|
} elseif ('FULLTEXT' == $this->_type) {
|
||||||
|
$this->_choice = 'FULLTEXT';
|
||||||
|
} elseif ('0' == $this->_non_unique) {
|
||||||
|
$this->_choice = 'UNIQUE';
|
||||||
|
} else {
|
||||||
|
$this->_choice = 'INDEX';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColumnCount()
|
public function getColumnCount()
|
||||||
@@ -291,11 +307,11 @@ class PMA_Index
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of all index types
|
* Return a list of all index choices
|
||||||
*
|
*
|
||||||
* @return array index types
|
* @return array index choices
|
||||||
*/
|
*/
|
||||||
static public function getTypes()
|
static public function getIndexChoices()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'PRIMARY',
|
'PRIMARY',
|
||||||
@@ -305,20 +321,20 @@ class PMA_Index
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTypeSelector()
|
public function generateIndexSelector()
|
||||||
{
|
{
|
||||||
$html_options = '';
|
$html_options = '';
|
||||||
|
|
||||||
foreach (PMA_Index::getTypes() as $each_index_type) {
|
foreach (PMA_Index::getIndexChoices() as $each_index_choice) {
|
||||||
if ($each_index_type === 'PRIMARY'
|
if ($each_index_choice === 'PRIMARY'
|
||||||
&& $this->_name !== 'PRIMARY'
|
&& $this->_choice !== 'PRIMARY'
|
||||||
&& PMA_Index::getPrimary($this->_table, $this->_schema)) {
|
&& PMA_Index::getPrimary($this->_table, $this->_schema)) {
|
||||||
// skip PRIMARY if there is already one in the table
|
// skip PRIMARY if there is already one in the table
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$html_options .= '<option value="' . $each_index_type . '"'
|
$html_options .= '<option value="' . $each_index_choice . '"'
|
||||||
. (($this->_type == $each_index_type) ? ' selected="selected"' : '')
|
. (($this->_choice == $each_index_choice) ? ' selected="selected"' : '')
|
||||||
. '>'. $each_index_type . '</option>' . "\n";
|
. '>'. $each_index_choice . '</option>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html_options;
|
return $html_options;
|
||||||
|
@@ -170,7 +170,7 @@ echo (isset($_REQUEST['create_index'])
|
|||||||
<div class="formelement">
|
<div class="formelement">
|
||||||
<label for="select_index_type"><?php echo $strIndexType; ?></label>
|
<label for="select_index_type"><?php echo $strIndexType; ?></label>
|
||||||
<select name="index[Index_type]" id="select_index_type" onchange="return checkIndexName()">
|
<select name="index[Index_type]" id="select_index_type" onchange="return checkIndexName()">
|
||||||
<?php echo $index->getTypeSelector(); ?>
|
<?php echo $index->generateIndexSelector(); ?>
|
||||||
</select>
|
</select>
|
||||||
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
|
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user