fix incorrect size calculation with merge tables

This commit is contained in:
Steve Alberty
2001-07-21 14:20:12 +00:00
parent 4f4a1c3a51
commit f16316c7da
3 changed files with 41 additions and 14 deletions

View File

@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-07-21 Steve Alberty <alberty@neptunlabs.de>
* db_details.php3,tbl_properties.php3: fix incorrect size
calculation with merge tables
2001-07-21 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* ob.lib.inc.php3, lines 50-54 & 73-76: fixed a bug with php3.

View File

@@ -114,28 +114,46 @@ else if (MYSQL_MAJOR_VERSION >= 3.23 && isset($tbl_cache)) {
<td>
<a href="sql.php3<?php echo $query; ?>&sql_query=<?php echo urlencode("DELETE FROM $table"); ?>&zero_rows=<?php echo urlencode($strTable . ' ' . $table . ' ' . $strHasBeenEmptied); ?>"><?php echo $strEmpty; ?></a>
</td>
<?php
<?php
echo "\n";
if (isset($sts_data['Rows'])) {
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
$sum_size += $tblsize;
$sum_entries += $sts_data['Rows'];
if (isset($sts_data['Type']) && $sts_data['Type']=="MRG_MyISAM") $mergetable=true;
if (isset($sts_data['Rows']))
{
if (!isset($mergetable)){
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
$sum_size += $tblsize;
$sum_entries += $sts_data['Rows'];
if ($tblsize > 0) {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 1);
list($formated_size, $unit) = format_byte_down($tblsize, 3, 1);
} else {
list($formated_size, $unit) = format_byte_down($tblsize, 3, 0);
list($formated_size, $unit) = format_byte_down($tblsize, 3, 0);
}
?>
}
else if (isset($mergetable)) // MyISAM MERGE Table
{
$formated_size="&nbsp;-&nbsp;";
$unit="";
}
else
{
$formated_size="unknown";
$unit="";
}
?>
<td align="right">
<?php echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
<?php
if (isset($mergetable)) echo "<i>";
echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
if (isset($mergetable)) echo "</i>";
?>
</td>
<td align="right" nowrap="nowrap">
&nbsp;&nbsp;
<a href="tbl_properties.php3<?php echo $query; ?>>#showusage"><?php echo $formated_size . ' ' . $unit; ?></a>
</td>
<?php
<?php
} else {
?>
?>
<td colspan="3" align="center">
<?php echo $strInUse . "\n"; ?>
</td>

View File

@@ -262,8 +262,9 @@ if ($index_count > 0) {
// BEGIN - Calc Table Space - staybyte - 9 June 2001
if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_type != "INNODB" && isset($showtable)) {
// Gets some sizes
if (isset($showtable['Type']) && $showtable['Type']=="MRG_MyISAM") $mergetable=true;
list($data_size, $data_unit) = format_byte_down($showtable['Data_length']);
list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
if (!isset($mergetable)) list($index_size, $index_unit) = format_byte_down($showtable['Index_length']);
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = format_byte_down($showtable['Data_free']);
}
@@ -293,15 +294,19 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
<td align="right" nowrap="nowrap"><?php echo $data_size; ?></td>
<td><?php echo $data_unit; ?></td>
</tr>
<?php
if (isset($index_size)) {
?>
<tr bgcolor="<?php echo $cfgBgcolorTwo; ?>">
<td style="padding-right: 10px"><?php echo ucfirst($strIndex); ?></td>
<td align="right" nowrap="nowrap"><?php echo $index_size; ?></td>
<td><?php echo $index_unit; ?></td>
</tr>
<?php
}
if (isset($free_size)) {
echo "\n";
?>
?>
<tr bgcolor="<?php echo $cfgBgcolorTwo; ?>" style="color: #bb0000">
<td style="padding-right: 10px"><?php echo ucfirst($strOverhead); ?></td>
<td align="right" nowrap="nowrap"><?php echo $free_size; ?></td>
@@ -400,7 +405,7 @@ if (MYSQL_MAJOR_VERSION == "3.23" && intval(MYSQL_MINOR_VERSION) > 3 && $tbl_typ
</tr>
<?php
}
if (isset($showtable['Data_length']) && $showtable['Rows'] > 0) {
if (isset($showtable['Data_length']) && $showtable['Rows'] > 0 && !isset($mergetable)) {
echo (++$i%2)
? ' <tr bgcolor="' . $cfgBgcolorTwo . '">'
: ' <tr bgcolor="' . $cfgBgcolorOne . '">';