From 9714c609ebbd12aa411c37a22872bc95b847e174 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 28 Jan 2015 14:47:33 +0530 Subject: [PATCH 1/2] More options for index creation Signed-off-by: Madhura Jayaratne --- libraries/Index.class.php | 40 ++++++++++++++++++++ libraries/tbl_indexes.lib.php | 69 ++++++++++++++++++++++++++--------- 2 files changed, 92 insertions(+), 17 deletions(-) diff --git a/libraries/Index.class.php b/libraries/Index.class.php index e4b366d4c7..975a6f1c36 100644 --- a/libraries/Index.class.php +++ b/libraries/Index.class.php @@ -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 * diff --git a/libraries/tbl_indexes.lib.php b/libraries/tbl_indexes.lib.php index 5ab354d4b2..5a40ed883d 100644 --- a/libraries/tbl_indexes.lib.php +++ b/libraries/tbl_indexes.lib.php @@ -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()" />' . ''; - $html .= '
' - . '
' - . '' - . '' - . '' - . '
' - . '' - . '
'; - $html .= '
' . '
' . '' @@ -312,6 +310,18 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields) . $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table'])) . '
'; + $html .= '
' + . '
' + . '' + . '' + . '' + . '
' + . '' + . '
'; + $html .= '
' . '
' . '' @@ -324,6 +334,31 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields) . $index->generateIndexTypeSelector() . '
'; + $html .= '
' + . '
' + . '' + . '' + . '' + . '
' + . '' + . '
'; + + $html .= '
' + . '
' + . '' + . '' + . '' + . '
' + . '' + . '
'; + $html .= '
'; $html .= '
'; From 2cb73f23735acb2ab07bb266f1ab4d9bf2d78c63 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Wed, 28 Jan 2015 16:47:46 +0530 Subject: [PATCH 2/2] Hide extra options in a slider Signed-off-by: Madhura Jayaratne --- js/functions.js | 1 + libraries/tbl_indexes.lib.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/js/functions.js b/js/functions.js index 4091ecefac..6efb5f3626 100644 --- a/js/functions.js +++ b/js/functions.js @@ -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, diff --git a/libraries/tbl_indexes.lib.php b/libraries/tbl_indexes.lib.php index 5a40ed883d..0580108a71 100644 --- a/libraries/tbl_indexes.lib.php +++ b/libraries/tbl_indexes.lib.php @@ -310,6 +310,10 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields) . $index->generateIndexChoiceSelector(isset($_REQUEST['create_edit_table'])) . '
'; + $html .= PMA_Util::getDivForSliderEffect( + 'indexoptions', __('Options') + ); + $html .= '
' . '
' . '' @@ -359,6 +363,8 @@ function PMA_getHtmlForIndexForm($fields, $index, $form_params, $add_fields) . 'value="' . htmlspecialchars($index->getComment()) . '" />' . '
'; + $html .= '
'; // end of indexoptions div + $html .= '
'; $html .= '';