diff --git a/ChangeLog b/ChangeLog index f1b4d8c9e..a0b4025de 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ ----------------------- +---------------------- phpMyAdmin - Changelog ---------------------- @@ -19,6 +19,8 @@ $Source$ no table statistics for information_schema * tbl_properties_table_info.php: bug #1317655 information_schema browsing + * db_details_db_info.php, db_details_structure.php: + fixed display table statistics for information_schema 2005-10-09 Marc Delisle * tbl_properties_links.php: invalid js confirmation and operation feedback diff --git a/db_details_db_info.php b/db_details_db_info.php index abb07dc5e..d9218158f 100644 --- a/db_details_db_info.php +++ b/db_details_db_info.php @@ -63,6 +63,11 @@ if ($cfg['SkipLockedTables'] == TRUE) { $db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE); if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) { while ($tmp = PMA_DBI_fetch_row($db_info_result)) { + if ( NULL === $tmp['Rows'] ) { + $tmp['Rows'] = PMA_countRecords( $GLOBALS['db'], + $tmp['Name'], $return = true, $force_exact = true ); + } + if (!isset($sot_cache[$tmp[0]])) { $sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';'); $sts_tmp = PMA_DBI_fetch_assoc($sts_result); @@ -99,6 +104,11 @@ if (!isset($sot_ready)) { $db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE); if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) { while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) { + if ( NULL === $sts_tmp['Rows'] ) { + $sts_tmp['Rows'] = PMA_countRecords( $GLOBALS['db'], + $sts_tmp['Name'], $return = true, $force_exact = true ); + } + if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) { $sts_tmp['Type'] =& $sts_tmp['Engine']; } diff --git a/db_details_structure.php b/db_details_structure.php index 231454d6b..cf8094c94 100644 --- a/db_details_structure.php +++ b/db_details_structure.php @@ -34,48 +34,51 @@ if (PMA_MYSQL_INT_VERSION >= 40101) { // Display function -function pma_TableHeader($alternate = FALSE, $record_count = TRUE) { +function pma_TableHeader( $is_schema = false ) { $cnt = 0; // Let's count the columns... + + if ( $is_schema ) { + $action_colspan = 3; + } else { + $action_colspan = 6; + } + echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" - . ' ' . "\n"; - $cnt += 3; - if ($record_count) { + $cnt += 2 + $action_colspan; + echo ' ' . "\n"; + $cnt++; + if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { echo ' ' . "\n"; $cnt++; - } - if (!$alternate) { - if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { + if (PMA_MYSQL_INT_VERSION >= 40100) { echo ' ' . "\n"; - $cnt++; - if (PMA_MYSQL_INT_VERSION >= 40100) { - echo ' ' . "\n"; - $cnt++; - } + $cnt++; } - if ($GLOBALS['cfg']['ShowStats']) { - echo ' ' . "\n" - . ' ' . "\n"; - $cnt += 2; - } - echo "\n"; } + if ($GLOBALS['cfg']['ShowStats']) { + echo ' ' . "\n" + . ' ' . "\n"; + $cnt += 2; + } + echo "\n"; echo ' ' . "\n"; $GLOBALS['structure_tbl_col_cnt'] = $cnt; } @@ -159,12 +162,13 @@ else { } // rabus: disable statistics for information_schema. - if (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema') { - $cfg['ShowStats'] = FALSE; - pma_TableHeader(FALSE, FALSE); + if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') { + $cfg['ShowStats'] = false; + $table_is_schema = true; } else { - pma_TableHeader(); + $table_is_schema = false; } + pma_TableHeader( $table_is_schema ); $i = $sum_entries = 0; (double) $sum_size = 0; @@ -232,7 +236,7 @@ else { > @@ -254,7 +258,7 @@ else { require_once('./libraries/bookmark.lib.php'); $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); - if (!empty($sts_data['Rows']) || $is_view || (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { + if ( ! empty( $sts_data['Rows'] ) || $is_view ) { echo '' . $titles['Browse'] . ''; @@ -269,7 +273,7 @@ else { - + - + to get valid // statistics whatever is the table type - if (isset($sts_data['Rows']) || (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { + if ( isset( $sts_data['Rows'] ) ) { // MyISAM, ISAM or Heap table: Row count, data size and index size // is accurate. - if (isset($sts_data['Type']) && preg_match('@^(MyISAM|ISAM|HEAP)$@', $sts_data['Type'])) { + if (isset($sts_data['Type']) && preg_match('@^(MyISAM|ISAM|HEAP|MEMORY)$@', $sts_data['Type'])) { if ($cfg['ShowStats']) { $tblsize = doubleval($sts_data['Data_length']) + doubleval($sts_data['Index_length']); $sum_size += $tblsize; @@ -398,16 +391,13 @@ else { } $display_rows = 'unknown'; } - // Don't display number of rows for information_schema tables. - if (!(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { - ?> - - + + 1)) { echo '    - = 50000 && $db == 'information_schema') { - ?> - - - 1)) { echo '
' . "\n" . '  ' . $GLOBALS['strTable'] . ' ' . "\n" . ' ' . "\n" + . ' ' . "\n" . '  ' . $GLOBALS['strAction'] . ' ' . "\n" . ' ' . "\n" + . '  ' . $GLOBALS['strRecords'] . PMA_showHint($GLOBALS['strApproximateCount']) . ' ' . "\n" + . ' ' . "\n" - . '  ' . $GLOBALS['strRecords'] . PMA_showHint($GLOBALS['strApproximateCount']) . ' ' . "\n" + . '  ' . $GLOBALS['strType'] . ' ' . "\n" . ' ' . "\n" - . '  ' . $GLOBALS['strType'] . ' ' . "\n" + . '  ' . $GLOBALS['strCollation'] . ' ' . "\n" . ' ' . "\n" - . '  ' . $GLOBALS['strCollation'] . ' ' . "\n" - . ' ' . "\n" - . '  ' . $GLOBALS['strSize'] . ' ' . "\n" - . ' ' . "\n" - . '  ' . $GLOBALS['strOverhead'] . ' ' . "\n" - . ' ' . "\n" + . '  ' . $GLOBALS['strSize'] . ' ' . "\n" + . ' ' . "\n" + . '  ' . $GLOBALS['strOverhead'] . ' ' . "\n" + . '
= 50000 && $db == 'information_schema')); + pma_TableHeader(); } ?>
= 50000 && $db == 'information_schema')) { + if ( ! empty($sts_data['Rows'] ) || $is_view ) { echo '' . $titles['Search'] . ''; } else { @@ -277,70 +281,59 @@ else { } ?> = 50000 && $db == 'information_schema') { - // rabus: We cannot insert into information_schema tables! - echo $titles['NoInsert']; - } else { + if ( ! $table_is_schema ) { ?> + + - - = 40000) { - echo urlencode('TRUNCATE ' . PMA_backquote($table)) - . '&zero_rows=' - . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))) - . '" onclick="return confirmLink(this, \'TRUNCATE '; + if ( ! empty($sts_data['Rows']) ) { + echo '' . $titles['Empty'] . ''; } else { - echo urlencode('DELETE FROM ' . PMA_backquote($table)) - . '&zero_rows=' - . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))) - . '" onclick="return confirmLink(this, \'DELETE FROM '; + echo $titles['NoEmpty']; } - echo PMA_jsFormat($table) . '\')">' . $titles['Empty'] . ''; - } else { - echo $titles['NoEmpty']; - } - - $drop_query = 'DROP ' - . ($is_view ? 'VIEW' : 'TABLE') - . ' ' . PMA_backquote($table); - $drop_message = sprintf(($is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table)); - ?> + ?> - = 50000 && $db == 'information_schema') { - echo $titles['NoDrop']; - } else { + > - - > + + ' . "\n" . '  ' . (isset($sts_data['Type']) ? $sts_data['Type'] : ' ') . ' ' . "\n" @@ -419,7 +409,7 @@ else { } } - if ($cfg['ShowStats']) { + if ( $cfg['ShowStats']) { echo "\n"; ?> > @@ -467,7 +457,7 @@ else { } } else { ?> - > + >   + ' . "\n" . ' --' . "\n" @@ -633,7 +615,7 @@ if ($num_tables > 0) { = 50002 && $db != 'information_schema')) { +if ( ! $table_is_schema ) { require('./libraries/display_create_table.lib.php'); } // end if (Create Table dialog) @@ -642,4 +624,4 @@ if (PMA_MYSQL_INT_VERSION < 50002 || (PMA_MYSQL_INT_VERSION >= 50002 && $db != ' */ echo "\n"; require_once('./footer.inc.php'); -?> +?> \ No newline at end of file