Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Peccatte <hugues.peccatte@gmail.com>2015-09-29 22:19:57 +0300
committerHugues Peccatte <hugues.peccatte@gmail.com>2015-09-29 22:19:57 +0300
commit6c8c2880677e8dc3023c8d4a348bd7ee4133b507 (patch)
tree6eb97d975e3b2ef474bd36513a2ae3738cc18b9b /tbl_create.php
parentc752c01309e6443981f8d19337997ea057330e84 (diff)
parentbfacea997a4eecc979090837fd2dd254dcb867c3 (diff)
Merge remote-tracking branch 'origin/master' into useNamespaces_master
Diffstat (limited to 'tbl_create.php')
-rw-r--r--tbl_create.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/tbl_create.php b/tbl_create.php
index 24ff64c3ed..d692f7adb1 100644
--- a/tbl_create.php
+++ b/tbl_create.php
@@ -101,6 +101,104 @@ if (isset($_REQUEST['do_save_data'])) {
//This global variable needs to be reset for the headerclass to function properly
$GLOBAL['table'] = '';
+$partitionDetails = array();
+
+// Extract some partitioning and subpartitioning parameters from the request
+$partitionParams = array(
+ 'partition_by', 'partition_expr', 'partition_count',
+ 'subpartition_by', 'subpartition_expr', 'subpartition_count'
+);
+foreach ($partitionParams as $partitionParam) {
+ $partitionDetails[$partitionParam] = isset($_REQUEST[$partitionParam])
+ ? $_REQUEST[$partitionParam] : '';
+}
+
+// Only LIST and RANGE type parameters allow subpartitioning
+$partitionDetails['can_have_subpartitions'] = isset($_REQUEST['partition_count'])
+ && $_REQUEST['partition_count'] > 1
+ && isset($_REQUEST['partition_by'])
+ && ($_REQUEST['partition_by'] == 'RANGE' || $_REQUEST['partition_by'] == 'LIST');
+
+if (PMA_isValid($_REQUEST['partition_count'], 'numeric')
+ && $_REQUEST['partition_count'] > 1
+) { // Has partitions
+ $partitions = isset($_REQUEST['partitions']) ? $_REQUEST['partitions'] : array();
+
+ // Remove details of the additional partitions
+ // when number of partitions have been reduced
+ array_splice($partitions, $_REQUEST['partition_count']);
+
+ for ($i = 0; $i < $_REQUEST['partition_count']; $i++) {
+ if (! isset($partitions[$i])) { // Newly added partition
+ $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 . ']';
+
+ // Values are specified only for LIST and RANGE type partitions
+ $partition['value_enabled'] = isset($_REQUEST['partition_by'])
+ && ($_REQUEST['partition_by'] == 'RANGE'
+ || $_REQUEST['partition_by'] == 'LIST');
+ if (! $partition['value_enabled']) {
+ $partition['value_type'] = '';
+ $partition['value'] = '';
+ }
+
+ if (PMA_isValid($_REQUEST['subpartition_count'], 'numeric')
+ && $_REQUEST['subpartition_count'] > 1
+ && $partitionDetails['can_have_subpartitions'] == true
+ ) { // Has subpartitions
+ $partition['subpartition_count'] = $_REQUEST['subpartition_count'];
+
+ if (! isset($partition['subpartitions'])) {
+ $partition['subpartitions'] = array();
+ }
+ $subpartitions =& $partition['subpartitions'];
+
+ // Remove details of the additional subpartitions
+ // when number of subpartitions have been reduced
+ array_splice($subpartitions, $_REQUEST['subpartition_count']);
+
+ for ($j = 0; $j < $_REQUEST['subpartition_count']; $j++) {
+ if (! isset($subpartitions[$j])) { // Newly added subpartition
+ $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 { // No subpartitions
+ unset($partition['subpartitions']);
+ unset($partition['subpartition_count']);
+ }
+ }
+ $partitionDetails['partitions'] = $partitions;
+}
+
/**
* Displays the form used to define the structure of the table
*/