libraries/mult_submits.inc.php -> sql.php // -> db_structure.php and if we got an error on the multi submit, // we must display it here and not call again mult_submits.inc.php if (! isset($error) || false === $error) { include 'libraries/mult_submits.inc.php'; } if (empty($message)) { $message = PMA_Message::success(); } } include 'libraries/db_common.inc.php'; $url_query .= '&goto=db_structure.php'; // Gets the database structure $sub_part = '_structure'; include 'libraries/db_info.inc.php'; if (!PMA_DRIZZLE) { include_once 'libraries/replication.inc.php'; } else { $server_slave_status = false; } } require_once 'libraries/bookmark.lib.php'; require_once 'libraries/mysql_charsets.lib.php'; $db_collation = PMA_getDbCollation($db); // in a separate file to avoid redeclaration of functions in some code paths require_once 'libraries/db_structure.lib.php'; $titles = PMA_buildActionTitles(); // 1. No tables if ($num_tables == 0) { echo '

' . __('No tables found in database') . '

' . "\n"; if (empty($db_is_information_schema)) { include 'libraries/display_create_table.lib.php'; } // end if (Create Table dialog) /** * Displays the footer */ include_once 'libraries/footer.inc.php'; exit; } // else // 2. Shows table informations /** * Displays the tables list */ echo '
'; $_url_params = array( 'pos' => $pos, 'db' => $db); // Add the sort options if they exists if (isset($_REQUEST['sort'])) { $_url_params['sort'] = $_REQUEST['sort']; } if (isset($_REQUEST['sort_order'])) { $_url_params['sort_order'] = $_REQUEST['sort_order']; } PMA_listNavigator( $total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList'] ); ?>
1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0; $row_count = 0; $hidden_fields = array(); $odd_row = true; $sum_row_count_pre = ''; foreach ($tables as $keyname => $each_table) { // Get valid statistics whatever is the table type $table_is_view = false; $table_encoded = urlencode($each_table['TABLE_NAME']); // Sets parameters for links $tbl_url_query = $url_query . '&table=' . $table_encoded; // do not list the previous table's size info for a view $formatted_size = '-'; $unit = ''; switch ( $each_table['ENGINE']) { // MyISAM, ISAM or Heap table: Row count, data size and index size // are accurate; data size is accurate for ARCHIVE case 'MyISAM' : case 'ISAM' : case 'HEAP' : case 'MEMORY' : case 'ARCHIVE' : case 'Aria' : case 'Maria' : if ($db_is_information_schema) { $each_table['Rows'] = PMA_Table::countRecords( $db, $each_table['Name'] ); } if ($is_show_stats) { $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']); $sum_size += $tblsize; list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) { list($formatted_overhead, $overhead_unit) = PMA_formatByteDown( $each_table['Data_free'], 3, ($each_table['Data_free'] > 0) ? 1 : 0 ); $overhead_size += $each_table['Data_free']; } } break; case 'InnoDB' : case 'PBMS' : // InnoDB table: Row count is not accurate but data and index sizes are. // PBMS table in Drizzle: TABLE_ROWS is taken from table cache, so it may be unavailable if (($each_table['ENGINE'] == 'InnoDB' && $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) || !isset($each_table['TABLE_ROWS']) ) { $each_table['COUNTED'] = true; $each_table['TABLE_ROWS'] = PMA_Table::countRecords( $db, $each_table['TABLE_NAME'], $force_exact = true, $is_view = false ); } else { $each_table['COUNTED'] = false; } // Drizzle doesn't provide data and index length, check for null if ($is_show_stats && $each_table['Data_length'] !== null) { $tblsize = $each_table['Data_length'] + $each_table['Index_length']; $sum_size += $tblsize; list($formatted_size, $unit) = PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0); } //$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) { $formatted_size = ' - '; $unit = ''; } break; // for a view, the ENGINE is sometimes reported as null, // or on some servers it's reported as "SYSTEM VIEW" case null : case 'SYSTEM VIEW' : case 'FunctionEngine' : // if table is broken, Engine is reported as null, so one more test if ($each_table['TABLE_TYPE'] == 'VIEW') { // countRecords() takes care of $cfg['MaxExactCountViews'] $each_table['TABLE_ROWS'] = PMA_Table::countRecords( $db, $each_table['TABLE_NAME'], $force_exact = true, $is_view = true ); $table_is_view = true; } break; default : // Unknown table type. if ($is_show_stats) { $formatted_size = __('unknown'); $unit = ''; } } // end switch if (! PMA_Table::isMerge($db, $each_table['TABLE_NAME'])) { $sum_entries += $each_table['TABLE_ROWS']; } if (isset($each_table['Collation'])) { $collation = '' . $each_table['Collation'] . ''; } else { $collation = '---'; } if ($is_show_stats) { if (isset($formatted_overhead)) { $overhead = '' . $formatted_overhead . ' ' . $overhead_unit . '' . "\n"; unset($formatted_overhead); $overhead_check .= "markAllRows('row_tbl_" . ($i + 1) . "');"; } else { $overhead = '-'; } } // end if unset($showtable); if ($GLOBALS['cfg']['ShowDbStructureCreation']) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); $create_time = isset($showtable['Create_time']) ? $showtable['Create_time'] : false; // show oldest creation date in summary row if ($create_time && (!$create_time_all || $create_time < $create_time_all)) { $create_time_all = $create_time; } } if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { // $showtable might already be set from ShowDbStructureCreation, see above if (! isset($showtable)) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); } $update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : false; // show newest update date in summary row if ($update_time && $update_time > $update_time_all) { $update_time_all = $update_time; } } if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { // $showtable might already be set from ShowDbStructureCreation, see above if (! isset($showtable)) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); } $check_time = isset($showtable['Check_time']) ? $showtable['Check_time'] : false; // show newest check date in summary row if ($check_time && $check_time > $check_time_all) { $check_time_all = $check_time; } } $alias = (! empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']])) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])) : str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])); $truename = (! empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']])) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])) : str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])); $i++; $row_count++; if ($table_is_view) { $hidden_fields[] = ''; } /* * Always activate links for Browse, Search and Empty, even if * the icons are greyed, because * 1. for views, we don't know the number of rows at this point * 2. for tables, another source could have populated them since the * page was generated * * I could have used the PHP ternary conditional operator but I find * the code easier to read without this operator. */ if ($each_table['TABLE_ROWS'] > 0 || $table_is_view) { $may_have_rows = true; } else { $may_have_rows = false; } $browse_table = ''; if ($may_have_rows) { $browse_table .= $titles['Browse']; } else { $browse_table .= $titles['NoBrowse']; } $browse_table .= ''; $search_table = ''; if ($may_have_rows) { $search_table .= $titles['Search']; } else { $search_table .= $titles['NoSearch']; } $search_table .= ''; $browse_table_label = '' . $truename . ''; if (! $db_is_information_schema) { $empty_table = ''; if ($may_have_rows) { $empty_table .= $titles['Empty']; } else { $empty_table .= $titles['NoEmpty']; } $empty_table .= ''; // truncating views doesn't work if ($table_is_view) { $empty_table = ' '; } $drop_query = 'DROP ' . (($table_is_view || $each_table['ENGINE'] == null) ? 'VIEW' : 'TABLE') . ' ' . PMA_backquote($each_table['TABLE_NAME']); $drop_message = sprintf( ($table_is_view || $each_table['ENGINE'] == null)? __('View %s has been dropped') : __('Table %s has been dropped'), str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])) ); } $tracking_icon = ''; if (PMA_Tracker::isActive()) { if (PMA_Tracker::isTracked($GLOBALS["db"], $truename)) { $tracking_icon = '' . PMA_getImage('eye.png', __('Tracking is active.')) . ''; } elseif (PMA_Tracker::getVersion($GLOBALS["db"], $truename) > 0) { $tracking_icon = '' . PMA_getImage('eye.png', __('Tracking is not active.')) . ''; } } if ($num_columns > 0 && $num_tables > $num_columns && ($row_count % $num_columns) == 0 ) { $row_count = 1; $odd_row = true; ?> 0) || (strlen(array_search($db, $server_slave_Do_DB)) > 0) || (count($server_slave_Do_DB) == 1 && count($server_slave_Ignore_DB) == 1) ) { $do = true; } foreach ($server_slave_Wild_Do_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); if (($db == PMA_extract_db_or_table($db_table, 'db')) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) ) { $do = true; } } if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0) ) { $ignored = true; } foreach ($server_slave_Wild_Ignore_Table as $db_table) { $table_part = PMA_extract_db_or_table($db_table, 'table'); if (($db == PMA_extract_db_or_table($db_table)) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename)) ) { $ignored = true; } } unset($table_part); } ?> /> href="tbl_change.php?"> href="sql.php?&reload=1&purge=1&sql_query=&message_to_show=" > = $GLOBALS['cfg']['MaxExactCountViews'] && $each_table['ENGINE'] != 'FunctionEngine' ) { $row_count_pre = '~'; $sum_row_count_pre = '~'; $show_superscript = PMA_showHint( PMA_sanitize( sprintf( __('This view has at least this number of rows. Please refer to %sdocumentation%s.'), '[a@./Documentation.html#cfg_MaxExactCountViews@_blank]', '[/a]' ) ) ); } } elseif ($each_table['ENGINE'] == 'InnoDB' && (! $each_table['COUNTED'])) { // InnoDB table: we did not get an accurate row count $row_count_pre = '~'; $sum_row_count_pre = '~'; $show_superscript = ''; } ?> 1)) { ?> ' . $formatted_size . ' ' . $unit . ''; ?> - --- - - ' . __('Replication') . '' . "\n"; } ?> 1)) { $default_engine = PMA_DBI_fetch_value('SHOW VARIABLES LIKE \'storage_engine\';', 0, 1); echo ' ' . "\n" . ' ' .$default_engine . '' . "\n"; // we got a case where $db_collation was empty echo ' ' . "\n"; if (! empty($db_collation)) { echo ' ' . $db_collation . ''; } echo ''; } if ($is_show_stats) { ?> ' . "\n" . ' ' . ($create_time_all ? PMA_localisedDate(strtotime($create_time_all)) : '-') . ' '; } if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { echo ' ' . "\n" . ' ' . ($update_time_all ? PMA_localisedDate(strtotime($update_time_all)) : '-') . ' '; } if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { echo ' ' . "\n" . ' ' . ($check_time_all ? PMA_localisedDate(strtotime($check_time_all)) : '-') . ' '; } ?>
<?php echo __('With selected:'); ?> / /

'; echo ''; echo PMA_getIcon('b_print.png', __('Print view'), true) . ''; echo ''; echo PMA_getIcon('b_tblanalyse.png', __('Data Dictionary'), true) . ''; echo '

'; if (empty($db_is_information_schema)) { include 'libraries/display_create_table.lib.php'; } // end if (Create Table dialog) /** * Displays the footer */ require 'libraries/footer.inc.php'; ?>