diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-09-25 07:36:55 +0300 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2015-09-25 07:44:28 +0300 |
commit | 7c325469d590e1fef384dc8f7051ae5b4eebeca9 (patch) | |
tree | b2f083d0653230c29d3edad233413a51f92ca658 /tbl_create.php | |
parent | 12307045c094b8aaa8ea127473426fd4af77f5a4 (diff) |
Fix #11490 UI for defining partitioning in create table window
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'tbl_create.php')
-rw-r--r-- | tbl_create.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tbl_create.php b/tbl_create.php index 3993baeaa4..7def879b07 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -100,6 +100,72 @@ if (isset($_REQUEST['do_save_data'])) { //This global variable needs to be reset for the headerclass to function properly $GLOBAL['table'] = ''; +if (PMA_isValid($_REQUEST['partition_count'], 'numeric') + && $_REQUEST['partition_count'] > 0 +) { + $partitions = isset($_REQUEST['partitions']) ? $_REQUEST['partitions'] : array(); + array_splice($partitions, $_REQUEST['partition_count']); + + for ($i = 0; $i < $_REQUEST['partition_count']; $i++) { + if (! isset($partitions[$i])) { + $partitions[$i] = array( + 'value_type' => '', + 'value' => '', + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } + + $partition =& $partitions[$i]; + $partition['name'] = 'p' . $i; + $partition['prefix'] = 'partitions[' . $i . ']'; + $partition['value_enabled'] = isset($_REQUEST['partition_by']) + && ($_REQUEST['partition_by'] == 'RANGE' + || $_REQUEST['partition_by'] == 'LIST'); + + if (PMA_isValid($_REQUEST['subpartition_count'], 'numeric') + && $_REQUEST['subpartition_count'] > 0 + ) { + $partition['subpartition_count'] = $_REQUEST['subpartition_count']; + + if (! isset($partition['subpartitions'])) { + $partition['subpartitions'] = array(); + } + $subpartitions =& $partition['subpartitions']; + array_splice($subpartitions, $_REQUEST['subpartition_count']); + + for ($j = 0; $j < $_REQUEST['subpartition_count']; $j++) { + if (! isset($subpartitions[$j])) { + $subpartitions[$j] = array( + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } + + $subpartition =& $subpartitions[$j]; + $subpartition['name'] = 'p' . $i . 's' . $j; + $subpartition['prefix'] = 'partitions[' . $i . ']' + . '[subpartitions][' . $j . ']'; + } + } else { + unset($partition['subpartitions']); + unset($partition['subpartition_count']); + } + } +} + /** * Displays the form used to define the structure of the table */ |