From c2d495c530235e4be39c935c61c677e8f01affe8 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Tue, 20 Mar 2007 18:10:53 +0000 Subject: [PATCH] bug #1523747 [innodb] make warning about row count more visible --- ChangeLog | 1 + db_structure.php | 12 ++++++++++-- libraries/display_tbl.lib.php | 29 +++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3eedbb2f1..3d7c7bc6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #1648802 different mysql library and server version - bug #1662976 [auth] Authentication fails when controluser/pass is set - bug #1643758 [import] Error #1264 importing NULL values in MySQL 5.0 +- bug #1523747 [innodb] make warning about row count more visible - [gui] avoid displaying a wide selector in server selection + [core] added PMA_fatalError() and made use of it . [i18n] use generic $strOptions diff --git a/db_structure.php b/db_structure.php index 95bea781a..4461709d8 100644 --- a/db_structure.php +++ b/db_structure.php @@ -179,6 +179,7 @@ $row_count = 0; $hidden_fields = array(); $odd_row = true; $at_least_one_view_exceeds_max_count = false; +$sum_row_count_pre = ''; foreach ($tables as $keyname => $each_table) { if ($each_table['TABLE_ROWS'] === null || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) { @@ -356,12 +357,19 @@ foreach ($tables as $keyname => $each_table) { if (isset($each_table['TABLE_ROWS']) && ($each_table['ENGINE'] != null || $table_is_view)) { if ($table_is_view && $each_table['TABLE_ROWS'] >= $cfg['MaxExactCountViews']) { $at_least_one_view_exceeds_max_count = true; + $row_count_pre = '~'; + $sum_row_count_pre = '~'; $show_superscript = '1'; + } elseif($each_table['ENGINE'] == 'InnoDB') { + // InnoDB table: Row count is not accurate + $row_count_pre = '~'; + $sum_row_count_pre = '~'; } else { + $row_count_pre = ''; $show_superscript = ''; } ?> - + 1)) { ?> @@ -407,7 +415,7 @@ if ($is_show_stats) { - + 1)) { $default_engine = PMA_DBI_get_default_engine(); diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 7162163c3..75c6de21b 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1717,6 +1717,25 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) global $sql_query, $num_rows, $unlim_num_rows, $pos, $fields_meta, $fields_cnt; global $vertical_display, $disp_direction, $repeat_cells, $highlight_columns; global $cfgRelation; + global $showtable; + + /** + * @todo move this to a central place + * @todo for other future table types + */ + $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'); + + if (!isset($analyzed_sql[0]['queryflags']['union']) + && !isset($analyzed_sql[0]['table_ref'][1]['table_name']) + && (empty($analyzed_sql[0]['where_clause']) + || $analyzed_sql[0]['where_clause'] == '1 ')) { + // "j u s t b r o w s i n g" + $pre_count = '~'; + $after_count = '[sup]1[/sup]'; + } else { + $pre_count = ''; + $after_count = ''; + } // 1. ----- Prepares the work ----- @@ -1762,12 +1781,18 @@ function PMA_displayTable(&$dt_result, &$the_disp_mode, $analyzed_sql) $last_shown_rec = ($GLOBALS['session_max_rows'] == 'all' || $pos_next > $total) ? $total - 1 : $pos_next - 1; - PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec (" . PMA_formatNumber($total, 0) . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); - if (isset($table) && PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) { + PMA_showMessage($GLOBALS['strShowingRecords'] . " $pos - $last_shown_rec (" . $pre_count . PMA_formatNumber($total, 0) . $after_count . ' ' . $GLOBALS['strTotal'] . $selectstring . ', ' . sprintf($GLOBALS['strQueryTime'], $GLOBALS['querytime']) . ')'); + + if (PMA_Table::isView($db, $table) && $total == $GLOBALS['cfg']['MaxExactCount']) { echo '
' . "\n"; echo PMA_sanitize(sprintf($GLOBALS['strViewMaxExactCount'], PMA_formatNumber($GLOBALS['cfg']['MaxExactCount'], 0), '[a@./Documentation.html#cfg_MaxExactCount@_blank]', '[/a]')) . "\n"; echo '
' . "\n"; } + if ($pre_count) { + echo '
' . "\n"; + echo '1' . PMA_sanitize($GLOBALS['strApproximateCount']) . "\n"; + echo '
' . "\n"; + } } elseif (!isset($GLOBALS['printview']) || $GLOBALS['printview'] != '1') { PMA_showMessage($GLOBALS['strSQLQuery']);