[engines] Fix parsing of PBXT status.

This commit is contained in:
Madhura Jayaratne
2010-04-13 13:54:25 +02:00
committed by Michal Čihař
parent f7ffcf8975
commit 846ce15039
4 changed files with 53 additions and 2 deletions

View File

@@ -66,6 +66,7 @@ $Id$
+ patch #2984337 [interface] Convert loading of export/import to jQuery ready
event, thanks to sutharshan.
- [edit] CURRENT_TIMESTAMP is also valid for datetime fields.
- patch #2985068 [engines] Fix parsing of PBXT status, thanks to Madhura Jayaratne.
3.3.3.0 (not yet released)
- patch #2982480 [navi] Do not group if there would be one table in group,

View File

@@ -178,7 +178,7 @@ class PMA_StorageEngine
. ' <td class="value">';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($details['value']);
$parsed_size = $this->resolveTypeSize($details['value']);
$ret .= $parsed_size[0] . '&nbsp;' . $parsed_size[1];
unset($parsed_size);
break;
@@ -204,6 +204,21 @@ class PMA_StorageEngine
return $ret;
}
/**
* returns the engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE type variables.
*
* This function should be overridden when
* PMA_ENGINE_DETAILS_TYPE_SIZE type needs to be
* handled differently for a particular engine.
*
* @return string the formatted value and its unit
*/
function resolveTypeSize($value)
{
return PMA_formatByteDown($value);
}
/**
* returns array with detailed info about engine specific server variables
*

View File

@@ -1271,7 +1271,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
PMA_profilingCheckbox($sql_query);
}
$inline_edit = "<script type=\"text/javascript\">\n" .
"//<![CDATA[\n" .
"//<![CDATA[\n" .
"document.write('[<a href=\"#\" title=\"" .
PMA_escapeJsString(__('Inline edit of this query')) .
"\" id=\"inline_edit\">" .
@@ -1503,6 +1503,27 @@ function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)
return $sign . $value . ' ' . $unit;
} // end of the 'PMA_formatNumber' function
/**
* Returns the number of bytes when a formatted size is given
*
* @param double $value the value that should be converted to bytes
* @uses PMA_pow()
* @return integer The number of bytes corresponding to the formatted size given
*/
function PMA_getBytes($value)
{
$return_value = -1;
if (preg_match('/^[0-9]+GB$/', $value)) {
$return_value = substr($value, 0, -2) * PMA_pow(1024, 3);
} elseif (preg_match('/^[0-9]+MB$/', $value)) {
$return_value = substr($value, 0, -2) * PMA_pow(1024, 2);
} elseif (preg_match('/^[0-9]+K$/', $value)) {
$return_value = substr($value, 0, -1) * PMA_pow(1024, 1);
}
return $return_value;
}// end of the 'PMA_getBytes' function
/**
* Writes localised date
*

View File

@@ -81,6 +81,20 @@ class PMA_StorageEngine_pbxt extends PMA_StorageEngine
),
);
}
/**
* returns the pbxt engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE variables.
*
* @return string the formatted value and its unit
*/
function resolveTypeSize($value)
{
if (preg_match('/^[0-9]+[a-zA-Z]+$/', $value)){
$value = PMA_getBytes($value);
}
return PMA_formatByteDown($value);
}
}
?>