[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_1RC1-219-g87dd6b3
Marc Delisle
lem9 at users.sourceforge.net
Fri Mar 12 23:22:33 CET 2010
The branch, master has been updated
via 87dd6b3ceeca9ed8e3feba529c9b4302eaf32b0b (commit)
via 7c818d046a4c9f01a8e94b55a0726a1cc3d6a60d (commit)
from c4bdb187033c908982e814af1b254d28ab3b1d3e (commit)
- Log -----------------------------------------------------------------
commit 87dd6b3ceeca9ed8e3feba529c9b4302eaf32b0b
Merge: c4bdb187033c908982e814af1b254d28ab3b1d3e 7c818d046a4c9f01a8e94b55a0726a1cc3d6a60d
Author: Marc Delisle <marc at infomarc.info>
Date: Fri Mar 12 17:16:58 2010 -0500
Merge branch 'QA_3_3'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 2 ++
db_operations.php | 2 +-
db_printview.php | 2 +-
db_structure.php | 6 +++++-
export.php | 7 +++----
libraries/Table.class.php | 32 ++++++++++++++++++++++++++++++--
libraries/display_export.lib.php | 5 +----
tbl_printview.php | 7 +++----
tbl_structure.php | 7 +++----
9 files changed, 49 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dad74c5..24103f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,6 +51,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ [lang] Uzbek update, thanks to Orzu Samarqandiy
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
diff --git a/db_operations.php b/db_operations.php
index bcee977..c09e2e1 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -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';
}
diff --git a/db_printview.php b/db_printview.php
index 277566d..e7c0547 100644
--- a/db_printview.php
+++ b/db_printview.php
@@ -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 {
diff --git a/db_structure.php b/db_structure.php
index c0df159..1d92330 100644
--- a/db_structure.php
+++ b/db_structure.php
@@ -225,7 +225,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) {
@@ -254,7 +258,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'];
}
diff --git a/export.php b/export.php
index 1f7b39e..5399d43 100644
--- a/export.php
+++ b/export.php
@@ -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)) {
diff --git a/libraries/Table.class.php b/libraries/Table.class.php
index b2b6963..25e3709 100644
--- a/libraries/Table.class.php
+++ b/libraries/Table.class.php
@@ -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;
}
diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php
index a680995..186b0d3 100644
--- a/libraries/display_export.lib.php
+++ b/libraries/display_export.lib.php
@@ -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" />';
diff --git a/tbl_printview.php b/tbl_printview.php
index c43efd9..3cd2868 100644
--- a/tbl_printview.php
+++ b/tbl_printview.php
@@ -278,10 +278,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']);
diff --git a/tbl_structure.php b/tbl_structure.php
index 4be5767..51b001e 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -625,10 +625,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;
hooks/post-receive
--
phpMyAdmin
More information about the Git
mailing list