disable table stats for MySQL 5 by default

This commit is contained in:
Sebastian Mendel
2006-04-13 15:37:09 +00:00
parent b8ea26cfca
commit 951ea7cdfa
3 changed files with 28 additions and 20 deletions

View File

@@ -6,6 +6,8 @@ $Id$
$Source$
2006-04-12 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* server_databases.php, libraries/database_interface.lib.php:
disable table stats for MySQL 5 by default
* server_databases.php:
use new functionality of PMA_DBI_get_databases_full() to limit display
* libraries/database_interface.lib.php:

View File

@@ -453,7 +453,9 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
// for PMA bc:
// `SCHEMA_FIELD_NAME` AS `SHOW_TABLE_STATUS_FIELD_NAME`
$sql = '
SELECT `information_schema`.`SCHEMATA`.*,
SELECT `information_schema`.`SCHEMATA`.*';
if ($force_stats) {
$sql .= ',
COUNT(`information_schema`.`TABLES`.`TABLE_SCHEMA`)
AS `SCHEMA_TABLES`,
SUM(`information_schema`.`TABLES`.`TABLE_ROWS`)
@@ -468,17 +470,23 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
+ `information_schema`.`TABLES`.`INDEX_LENGTH`)
AS `SCHEMA_LENGTH`,
SUM(`information_schema`.`TABLES`.`DATA_FREE`)
AS `SCHEMA_DATA_FREE`
FROM `information_schema`.`SCHEMATA`
AS `SCHEMA_DATA_FREE`';
}
$sql .= '
FROM `information_schema`.`SCHEMATA`';
if ($force_stats) {
$sql .= '
LEFT JOIN `information_schema`.`TABLES`
ON `information_schema`.`TABLES`.`TABLE_SCHEMA`
= `information_schema`.`SCHEMATA`.`SCHEMA_NAME`
= `information_schema`.`SCHEMATA`.`SCHEMA_NAME`';
}
$sql .= '
' . $sql_where_schema . '
GROUP BY `information_schema`.`SCHEMATA`.`SCHEMA_NAME`
ORDER BY ' . PMA_backquote($sort_by) . ' ' . $sort_order
. $limit;
$databases = PMA_DBI_fetch_result( $sql, 'SCHEMA_NAME', null, $link );
unset( $sql_where_schema, $sql );
unset($sql_where_schema, $sql);
} else {
foreach ( PMA_DBI_get_dblist( $link ) as $database_name ) {
// MySQL forward compatibility

View File

@@ -351,22 +351,20 @@ if ($databases_count > 0) {
PMA_buttonOrImage( 'drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png' );
}
if ( PMA_MYSQL_INT_VERSION < 50002 ) {
echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
if ( empty( $dbstats ) ) {
echo ' <a href="./server_databases.php?' . $url_query . '&amp;dbstats=1"'
.' title="' . $strDatabasesStatsEnable . '">' . "\n"
.' ' . $strDatabasesStatsEnable;
} else {
echo ' <a href="./server_databases.php?' . $url_query . '"'
.' title="' . $strDatabasesStatsDisable . '">' . "\n"
.' ' . $strDatabasesStatsDisable;
}
echo '</a></strong><br />' . "\n"
.' <div class="warning">'
. $strDatabasesStatsHeavyTraffic . '</div></li>' . "\n"
.'</ul>' . "\n";
echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
if ( empty( $dbstats ) ) {
echo ' <a href="./server_databases.php?' . $url_query . '&amp;dbstats=1"'
.' title="' . $strDatabasesStatsEnable . '">' . "\n"
.' ' . $strDatabasesStatsEnable;
} else {
echo ' <a href="./server_databases.php?' . $url_query . '"'
.' title="' . $strDatabasesStatsDisable . '">' . "\n"
.' ' . $strDatabasesStatsDisable;
}
echo '</a></strong><br />' . "\n"
.' <div class="warning">'
. $strDatabasesStatsHeavyTraffic . '</div></li>' . "\n"
.'</ul>' . "\n";
echo '</form>';
} else {
echo $strNoDatabases;