Add details about partition method and expression

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-08-14 13:14:33 +05:30
parent 46f2d752a0
commit 51da800173
2 changed files with 65 additions and 3 deletions

View File

@ -115,6 +115,26 @@ class PMA_SubPartition
return $this->ordinal;
}
/**
* Returns the partition method
*
* @return string partition method
*/
public function getMethod()
{
return $this->method;
}
/**
* Returns the partition expression
*
* @return string partition expression
*/
public function getExpression()
{
return $this->expression;
}
/**
* Returns the number of data rows
*
@ -182,6 +202,16 @@ class PMA_Partition extends PMA_SubPartition
}
}
/**
* Returns the partiotion description
*
* @return string partition description
*/
public function getDescription()
{
return $this->description;
}
/**
* Add a sub parition
*
@ -263,7 +293,7 @@ class PMA_Partition extends PMA_SubPartition
*
* @return PMA_SubPartition[]
*/
public function getSubParitions()
public function getSubPartitions()
{
return $this->subPartitions;
}

View File

@ -3,11 +3,35 @@
<legend><?php echo __('Partitions')
. PMA_Util::showMySQLDocu('partitioning'); ?>
</legend>
<?php
$firstPartition = $partitions[0];
$hasSubPartitions = $firstPartition->hasSubPartitions();
$hasDescription = ! empty($firstPartition->getDescription());
?>
<p>
<?php echo __('Partitioned by:');?>
<code><?php echo $firstPartition->getMethod()
. '(' . $firstPartition->getExpression() . ' )'; ?></code>
</p>
<?php if ($hasSubPartitions): ?>
<?php
$subParitions = $firstPartition->getSubPartitions();
$fristSubParition = $subParitions[0];
?>
<p>
<?php echo __('Sub partitioned by:'); ?>
<code><?php echo $fristSubParition->getMethod()
. '(' . $fristSubParition->getExpression() . ' )'; ?></code>
<p>
<?php endif; ?>
<table>
<thead>
<tr>
<th colspan="2">#</th>
<th><?php echo __('Name'); ?></th>
<?php if ($hasDescription): ?>
<th><?php echo __('Expression'); ?></th>
<?php endif; ?>
<th><?php echo __('Rows'); ?></th>
<th><?php echo __('Data length'); ?></th>
<th><?php echo __('Index length'); ?></th>
@ -28,7 +52,6 @@
);
?>
<?php foreach ($partitions as $partition): ?>
<?php $hasSubPartitions = $partition->hasSubPartitions(); ?>
<tr class="noclick <?php echo $odd ? 'odd' : 'even'; echo $hasSubPartitions ? ' marked' : '';?>">
<?php if ($hasSubPartitions): ?>
<td><?php echo $partition->getOrdinal(); ?></td>
@ -37,6 +60,12 @@
<td colspan="2"><?php echo $partition->getOrdinal(); ?></td>
<?php endif; ?>
<th><?php echo htmlspecialchars($partition->getName()); ?></th>
<?php if ($hasDescription): ?>
<td>
<code><?php echo htmlspecialchars($partition->getExpression()
. ' < ' . $partition->getDescription()); ?></code>
</td>
<?php endif; ?>
<td class="value"><?php echo $partition->getRows(); ?></td>
<td class="value"><?php
list($value, $unit) = PMA_Util::formatByteDown(
@ -69,11 +98,14 @@
<?php endforeach; ?>
<?php if ($hasSubPartitions): ?>
<?php foreach ($partition->getSubParitions() as $subParition): ?>
<?php foreach ($partition->getSubPartitions() as $subParition): ?>
<tr class="noclick <?php echo $odd ? 'odd' : 'even' ?>">
<td></td>
<td><?php echo $subParition->getOrdinal(); ?></td>
<td><?php echo htmlspecialchars($subParition->getName()); ?></td>
<?php if ($hasDescription): ?>
<td></td>
<?php endif; ?>
<td class="value"><?php echo $subParition->getRows(); ?></td>
<td class="value"><?php
list($value, $unit) = PMA_Util::formatByteDown(