make use of function PMA_DBI_get_tables_full()

This commit is contained in:
Sebastian Mendel
2005-10-21 13:48:00 +00:00
parent 5343b53fad
commit d3d3e5f8b6
2 changed files with 27 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ $Source$
extended function PMA_DBI_get_tables_full(): extended function PMA_DBI_get_tables_full():
- make use of information_schema - make use of information_schema
- always fill fields for information_schema and show table status - always fill fields for information_schema and show table status
* db_details_db_info.php: make use of function PMA_DBI_get_tables_full()
2005-10-20 Marc Delisle <lem9@users.sourceforge.net> 2005-10-20 Marc Delisle <lem9@users.sourceforge.net>
* server_databases.php: security fix * server_databases.php: security fix

View File

@@ -47,8 +47,9 @@ if ($cfg['ShowTooltip']) {
} }
// Special speedup for newer MySQL Versions (in 4.0 format changed) // Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == TRUE) { if ( true === $cfg['SkipLockedTables'] ) {
$db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';'); $db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
// Blending out tables in use // Blending out tables in use
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) { if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) { while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
@@ -63,11 +64,6 @@ if ($cfg['SkipLockedTables'] == TRUE) {
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE); $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) { if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) { 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]])) { if (!isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($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); $sts_tmp = PMA_DBI_fetch_assoc($sts_result);
@@ -92,6 +88,11 @@ if ($cfg['SkipLockedTables'] == TRUE) {
} }
} }
PMA_DBI_free_result($db_info_result); PMA_DBI_free_result($db_info_result);
if ( $GLOBALS['cfg']['NaturalOrder'] ) {
uksort( $tables, 'strnatcasecmp' );
}
$sot_ready = TRUE; $sot_ready = TRUE;
} }
} }
@@ -100,42 +101,31 @@ if ($cfg['SkipLockedTables'] == TRUE) {
unset($db_info_result); unset($db_info_result);
} }
} }
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'])) { if ( ! isset( $sot_ready ) ) {
$sts_tmp['Type'] =& $sts_tmp['Engine']; if ( ! empty( $tbl_group ) && ! $cfg['ShowTooltipAliasTB'] ) {
} // only tables for selected group
if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) { $tables = PMA_DBI_get_tables_full( $db, $tbl_group, true );
continue; } elseif ( ! empty( $tbl_group ) && $cfg['ShowTooltipAliasTB'] ) {
// only tables for selected group,
// but grouping is done on comment ...
$tables = PMA_DBI_get_tables_full( $db, $tbl_group, 'comment' );
} else {
// all tables in db
$tables = PMA_DBI_get_tables_full( $db );
} }
if ( $cfg['ShowTooltip'] ) { if ( $cfg['ShowTooltip'] ) {
fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp); foreach( $tables as $each_table ) {
fillTooltip( $tooltip_truename, $tooltip_aliasname, $each_table );
}
}
} }
$tables[$sts_tmp['Name']] = $sts_tmp; $num_tables = count( $tables );
}
}
@PMA_DBI_free_result($db_info_result);
unset($db_info_result);
}
$num_tables = (isset($tables) ? count($tables) : 0);
if ( $GLOBALS['cfg']['NaturalOrder'] ) {
uksort( $tables, 'strnatcasecmp' );
}
/** /**
* Displays top menu links * Displays top menu links
*/ */
echo '<!-- Top menu links -->' . "\n";
require('./db_details_links.php'); require('./db_details_links.php');
?> ?>