patch #2969449 Name for MERGE engine varies depending on the MySQL version
This commit is contained in:

committed by
Marc Delisle

parent
4a53eb1916
commit
7c818d046a
@@ -6,6 +6,8 @@ $Id$
|
||||
$HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyAdmin/ChangeLog $
|
||||
|
||||
3.3.2.0 (not yet released)
|
||||
- patch #2969449 [core] Name for MERGE engine varies depending on the
|
||||
MySQL version, thanks to Dieter Adriaenssens - ruleant
|
||||
|
||||
3.3.1.0 (not yet released)
|
||||
- bug #2941037 [core] Database structure not sorted by table correctly
|
||||
|
@@ -110,7 +110,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
|
||||
|
||||
// do not copy the data from a Merge table
|
||||
// note: on the calling FORM, 'data' means 'structure and data'
|
||||
if ($tables_full[$each_table]['Engine'] == 'MRG_MyISAM') {
|
||||
if (PMA_Table::isMerge($db, $each_table)) {
|
||||
if ($this_what == 'data') {
|
||||
$this_what = 'structure';
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ else {
|
||||
$sum_entries = $sum_size = 0;
|
||||
$odd_row = true;
|
||||
foreach ($tables as $sts_data) {
|
||||
if (strtoupper($sts_data['ENGINE']) == 'MRG_MYISAM'
|
||||
if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
|
||||
|| strtoupper($sts_data['ENGINE']) == 'FEDERATED') {
|
||||
$merged_size = true;
|
||||
} else {
|
||||
|
@@ -226,7 +226,11 @@ foreach ($tables as $keyname => $each_table) {
|
||||
}
|
||||
//$display_rows = ' - ';
|
||||
break;
|
||||
// Mysql 5.0.x (and lower) uses MRG_MyISAM and MySQL 5.1.x (and higher) uses MRG_MYISAM
|
||||
// Both are aliases for MERGE
|
||||
case 'MRG_MyISAM' :
|
||||
case 'MRG_MYISAM' :
|
||||
case 'MERGE' :
|
||||
case 'BerkeleyDB' :
|
||||
// Merge or BerkleyDB table: Only row count is accurate.
|
||||
if ($is_show_stats) {
|
||||
@@ -255,7 +259,7 @@ foreach ($tables as $keyname => $each_table) {
|
||||
}
|
||||
} // end switch
|
||||
|
||||
if ('MRG_MYISAM' != $each_table['ENGINE']) {
|
||||
if (! PMA_Table::isMerge($db, $each_table['TABLE_NAME'])) {
|
||||
$sum_entries += $each_table['TABLE_ROWS'];
|
||||
}
|
||||
|
||||
|
@@ -439,7 +439,7 @@ if ($export_type == 'server') {
|
||||
}
|
||||
}
|
||||
// if this is a view or a merge table, don't export data
|
||||
if (isset($GLOBALS[$what . '_data']) && !($is_view || (strcasecmp(PMA_Table::sGetStatusInfo($current_db, $table, 'Engine'),'MRG_MYISAM') == 0))) {
|
||||
if (isset($GLOBALS[$what . '_data']) && !($is_view || PMA_Table::isMerge($current_db, $table))) {
|
||||
$local_query = 'SELECT * FROM ' . PMA_backquote($current_db) . '.' . PMA_backquote($table);
|
||||
if (!PMA_exportData($current_db, $table, $crlf, $err_url, $local_query)) {
|
||||
break 3;
|
||||
@@ -488,7 +488,7 @@ if ($export_type == 'server') {
|
||||
}
|
||||
}
|
||||
// if this is a view or a merge table, don't export data
|
||||
if (isset($GLOBALS[$what . '_data']) && !($is_view || (strcasecmp(PMA_Table::sGetStatusInfo($db, $table, 'Engine'),'MRG_MYISAM') == 0))) {
|
||||
if (isset($GLOBALS[$what . '_data']) && !($is_view || PMA_Table::isMerge($db, $table))) {
|
||||
$local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
|
||||
if (!PMA_exportData($db, $table, $crlf, $err_url, $local_query)) {
|
||||
break 2;
|
||||
@@ -537,8 +537,7 @@ if ($export_type == 'server') {
|
||||
// If this is an export of a single view, we have to export data;
|
||||
// for example, a PDF report
|
||||
// if it is a merge table, no data is exported
|
||||
$is_merge = ! PMA_Table::isView($db, $table) && (strcasecmp(PMA_Table::sGetStatusInfo($db, $table, 'Engine'),'MRG_MYISAM') == 0);
|
||||
if (isset($GLOBALS[$what . '_data']) && ! $is_merge) {
|
||||
if (isset($GLOBALS[$what . '_data']) && ! PMA_Table::isMerge($db, $table)) {
|
||||
if (!empty($sql_query)) {
|
||||
// only preg_replace if needed
|
||||
if (!empty($add_query)) {
|
||||
|
@@ -238,6 +238,31 @@ class PMA_Table
|
||||
return $type == 'VIEW';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this is a merge table
|
||||
*
|
||||
* If the ENGINE of the table is MERGE or MRG_MYISAM (alias), this is a merge table.
|
||||
*
|
||||
* @param string the database name
|
||||
* @param string the table name
|
||||
* @return boolean true if it is a merge table
|
||||
* @access public
|
||||
*/
|
||||
public function isMerge($db = null, $table = null)
|
||||
{
|
||||
// if called static, with parameters
|
||||
if (! empty($db) && ! empty($table)) {
|
||||
$engine = PMA_Table::sGetStatusInfo($db, $table, 'ENGINE', null, true);
|
||||
}
|
||||
// if called as an object
|
||||
// does not work yet, because $this->settings[] is not filled correctly
|
||||
else if (! empty($this)) {
|
||||
$engine = $this->get('ENGINE');
|
||||
}
|
||||
|
||||
return (! empty($engine) && ((strtoupper($engine) == 'MERGE') || (strtoupper($engine) == 'MRG_MYISAM')));
|
||||
}
|
||||
|
||||
static public function sGetToolTip($db, $table)
|
||||
{
|
||||
return PMA_Table::sGetStatusInfo($db, $table, 'Comment')
|
||||
@@ -254,9 +279,10 @@ class PMA_Table
|
||||
* @param string $table
|
||||
* @param string $info
|
||||
* @param boolean $force_read
|
||||
* @param boolean if true, disables error message
|
||||
* @return mixed
|
||||
*/
|
||||
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false)
|
||||
static public function sGetStatusInfo($db, $table, $info = null, $force_read = false, $disable_error = false)
|
||||
{
|
||||
if (! isset(PMA_Table::$cache[$db][$table]) || $force_read) {
|
||||
PMA_DBI_get_tables_full($db, $table);
|
||||
@@ -274,7 +300,9 @@ class PMA_Table
|
||||
}
|
||||
|
||||
if (! isset(PMA_Table::$cache[$db][$table][$info])) {
|
||||
trigger_error('unknown table status: ' . $info, E_USER_WARNING);
|
||||
if (! $disable_error) {
|
||||
trigger_error('unknown table status: ' . $info, E_USER_WARNING);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -104,10 +104,7 @@ echo PMA_pluginGetJavascript($export_list);
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$is_merge = ! PMA_Table::isView($db, $table) && (strcasecmp(PMA_Table::sGetStatusInfo($db, $table, 'Engine'),'MRG_MYISAM') == 0);
|
||||
if (strlen($table) && ! isset($num_tables) && ! $is_merge) {
|
||||
?>
|
||||
<?php if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table)) { ?>
|
||||
<div class="formelementrow">
|
||||
<?php
|
||||
echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
|
||||
|
@@ -279,10 +279,9 @@ foreach ($the_tables as $key => $table) {
|
||||
}
|
||||
if ($nonisam == false) {
|
||||
// Gets some sizes
|
||||
$mergetable = false;
|
||||
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
|
||||
$mergetable = true;
|
||||
}
|
||||
|
||||
$mergetable = PMA_Table::isMerge($db, $table);
|
||||
|
||||
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
|
||||
if ($mergetable == false) {
|
||||
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
|
||||
|
@@ -612,10 +612,9 @@ if ($cfg['ShowStats']) {
|
||||
}
|
||||
|
||||
// Gets some sizes
|
||||
$mergetable = false;
|
||||
if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
|
||||
$mergetable = true;
|
||||
}
|
||||
|
||||
$mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']);
|
||||
|
||||
// this is to display for example 261.2 MiB instead of 268k KiB
|
||||
$max_digits = 5;
|
||||
$decimals = 1;
|
||||
|
Reference in New Issue
Block a user