Merge branch 'index'

This commit is contained in:
Madhura Jayaratne 2015-01-28 16:54:24 +05:30
commit d6c89793b6
3 changed files with 99 additions and 17 deletions

View File

@ -3379,6 +3379,7 @@ function indexEditorDialog(url, title, callback_success, callback_failure)
});
$('#index_columns tbody').sortable();
PMA_showHints($div);
PMA_init_slider();
// Add a slider for selecting how many columns to add to the index
$div.find('.slider').slider({
animate: true,

View File

@ -87,6 +87,20 @@ class PMA_Index
*/
private $_packed = null;
/**
* Block size for the index
*
* @var int
*/
private $_key_block_size = null;
/**
* Parser option for the index
*
* @var string
*/
private $_parser = null;
/**
* Constructor
*
@ -307,6 +321,12 @@ class PMA_Index
$this->_choice = 'INDEX';
}
}
if (isset($params['Key_block_size'])) {
$this->_key_block_size = $params['Key_block_size'];
}
if (isset($params['Parser'])) {
$this->_parser = $params['Parser'];
}
}
/**
@ -339,6 +359,26 @@ class PMA_Index
return $this->_remarks;
}
/**
* Return the key block size
*
* @return number
*/
public function getKeyBlockSize()
{
return $this->_key_block_size;
}
/**
* Return the parser
*
* @return string
*/
public function getParser()
{
return $this->_parser;
}
/**
* Returns concatenated remarks and comment
*

View File

@ -146,6 +146,11 @@ function PMA_getSqlQueryForIndexCreateOrEdit($db, $table, $index, &$error)
$sql_query .= ' (' . implode(', ', $index_fields) . ')';
}
if (! empty($index->getKeyBlockSize())) {
$sql_query .= " KEY_BLOCK_SIZE = "
. PMA_Util::sqlAddSlashes($index->getKeyBlockSize());
}
// specifying index type is allowed only for primary, unique and index only
if ($index->getChoice() != 'SPATIAL'
&& $index->getChoice() != 'FULLTEXT'
@ -154,9 +159,16 @@ function PMA_getSqlQueryForIndexCreateOrEdit($db, $table, $index, &$error)
$sql_query .= ' USING ' . $index->getType();
}
$sql_query .= " COMMENT '"
. PMA_Util::sqlAddSlashes($index->getComment())
. "'";
if ($index->getChoice() == 'FULLTEXT' && ! empty($index->getParser())) {
$sql_query .= " WITH PARSER "
. PMA_Util::sqlAddSlashes($index->getParser());
}
if (! empty($index->getComment())) {
$sql_query .= " COMMENT '"
. PMA_Util::sqlAddSlashes($index->getComment()) . "'";
}
$sql_query .= ';';
return $sql_query;
@ -286,20 +298,6 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields)
. 'onfocus="this.select()" />'
. '</div>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_index_comment">'
. __('Comment:')
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Index_comment]" '
. 'id="input_index_comment" size="30"'
. 'value="' . htmlspecialchars($index->getComment()) . '"'
. 'onfocus="this.select()" />'
. '</div>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
@ -312,6 +310,22 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields)
. $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table']))
. '</div>';
$html .= PMA_Util::getDivForSliderEffect(
'indexoptions', __('Options')
);
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_key_block_size">'
. __('Key block size:')
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Key_block_size]" '
. 'id="input_key_block_size" size="30" value="" />'
. '</div>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
@ -324,6 +338,33 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields)
. $index->generateIndexTypeSelector()
. '</div>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_parser">'
. __('Parser:')
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Parser]" '
. 'id="input_parse" size="30" value="" />'
. '</div>';
$html .= '<div>'
. '<div class="label">'
. '<strong>'
. '<label for="input_index_comment">'
. __('Comment:')
. '</label>'
. '</strong>'
. '</div>'
. '<input type="text" name="index[Index_comment]" '
. 'id="input_index_comment" size="30"'
. 'value="' . htmlspecialchars($index->getComment()) . '" />'
. '</div>';
$html .= '</div>'; // end of indexoptions div
$html .= '<div class="clearfloat"></div>';
$html .= '</div>';