db_structure.php
来自「phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站」· PHP 代码 · 共 585 行 · 第 1/2 页
PHP
585 行
<?php/* vim: set expandtab sw=4 ts=4 sts=4: *//** * * @version $Id: db_structure.php 12039 2008-11-30 12:28:57Z lem9 $ *//** * */require_once './libraries/common.inc.php';require_once './libraries/Table.class.php';$GLOBALS['js_include'][] = 'mootools.js';/** * Prepares the tables list if the user where not redirected to this script * because there is no table in the database ($is_info is true) */if (empty($is_info)) { // Drops/deletes/etc. multiple tables if required if ((!empty($submit_mult) && isset($selected_tbl)) || isset($mult_btn)) { $action = 'db_structure.php'; $err_url = 'db_structure.php?'. PMA_generate_common_url($db); require './libraries/mult_submits.inc.php'; if (empty($message)) { $message = PMA_Message::success(); } } require './libraries/db_common.inc.php'; $url_query .= '&goto=db_structure.php'; // Gets the database structure $sub_part = '_structure'; require './libraries/db_info.inc.php';}// 1. No tablesif ($num_tables == 0) { echo '<p>' . $strNoTablesFound . '</p>' . "\n"; if (empty($db_is_information_schema)) { require './libraries/display_create_table.lib.php'; } // end if (Create Table dialog) /** * Displays the footer */ require_once './libraries/footer.inc.php'; exit;}// else// 2. Shows table informations - staybyte - 11 June 2001require_once './libraries/bookmark.lib.php';require_once './libraries/mysql_charsets.lib.php';$db_collation = PMA_getDbCollation($db);// Display function/** * void PMA_TableHeader([bool $db_is_information_schema = false]) * display table header (<table><thead>...</thead><tbody>) * * @uses PMA_showHint() * @uses $GLOBALS['cfg']['PropertiesNumColumns'] * @uses $GLOBALS['is_show_stats'] * @uses $GLOBALS['strTable'] * @uses $GLOBALS['strAction'] * @uses $GLOBALS['strRecords'] * @uses $GLOBALS['strApproximateCount'] * @uses $GLOBALS['strType'] * @uses $GLOBALS['strCollation'] * @uses $GLOBALS['strSize'] * @uses $GLOBALS['strOverhead'] * @uses $GLOBALS['structure_tbl_col_cnt'] * @param boolean $db_is_information_schema */function PMA_TableHeader($db_is_information_schema = false){ $cnt = 0; // Let's count the columns... if ($db_is_information_schema) { $action_colspan = 3; } else { $action_colspan = 6; } echo '<table class="data" style="float: left;">' . "\n" .'<thead>' . "\n" .'<tr><td></td>' . "\n" .' <th>' . $GLOBALS['strTable'] . '</th>' . "\n" .' <th colspan="' . $action_colspan . '">' . "\n" .' ' . $GLOBALS['strAction'] . "\n" .' </th>' .' <th>' . $GLOBALS['strRecords'] .PMA_showHint(PMA_sanitize($GLOBALS['strApproximateCount'])) . "\n" .' </th>' . "\n"; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { echo ' <th>' . $GLOBALS['strType'] . '</th>' . "\n"; $cnt++; echo ' <th>' . $GLOBALS['strCollation'] . '</th>' . "\n"; $cnt++; } if ($GLOBALS['is_show_stats']) { echo ' <th>' . $GLOBALS['strSize'] . '</th>' . "\n" . ' <th>' . $GLOBALS['strOverhead'] . '</th>' . "\n"; $cnt += 2; } echo '</tr>' . "\n"; echo '</thead>' . "\n"; echo '<tbody>' . "\n"; $GLOBALS['structure_tbl_col_cnt'] = $cnt + $action_colspan + 3;} // end function PMA_TableHeader()$titles = array();if (true == $cfg['PropertiesIconic']) { $titles['Browse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />'; $titles['NoBrowse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />'; $titles['Search'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />'; $titles['NoSearch'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . $strSearch . '" title="' . $strSearch . '" />'; $titles['Insert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />'; $titles['NoInsert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_insrow.png" alt="' . $strInsert . '" title="' . $strInsert . '" />'; $titles['Structure'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . $strStructure . '" title="' . $strStructure . '" />'; $titles['Drop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />'; $titles['NoDrop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />'; $titles['Empty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />'; $titles['NoEmpty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . $strEmpty . '" title="' . $strEmpty . '" />'; if ('both' === $cfg['PropertiesIconic']) { $titles['Browse'] .= $strBrowse; $titles['Search'] .= $strSearch; $titles['NoBrowse'] .= $strBrowse; $titles['NoSearch'] .= $strSearch; $titles['Insert'] .= $strInsert; $titles['NoInsert'] .= $strInsert; $titles['Structure'] .= $strStructure; $titles['Drop'] .= $strDrop; $titles['NoDrop'] .= $strDrop; $titles['Empty'] .= $strEmpty; $titles['NoEmpty'] .= $strEmpty; }} else { $titles['Browse'] = $strBrowse; $titles['Search'] = $strSearch; $titles['NoBrowse'] = $strBrowse; $titles['NoSearch'] = $strSearch; $titles['Insert'] = $strInsert; $titles['NoInsert'] = $strInsert; $titles['Structure'] = $strStructure; $titles['Drop'] = $strDrop; $titles['NoDrop'] = $strDrop; $titles['Empty'] = $strEmpty; $titles['NoEmpty'] = $strEmpty;}/** * Displays the tables list */$_url_params = array( 'pos' => $pos, 'db' => $db);PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);?><form method="post" action="db_structure.php" name="tablesForm" id="tablesForm"><?phpecho PMA_generate_common_hidden_inputs($db);PMA_TableHeader($db_is_information_schema);$i = $sum_entries = 0;$sum_size = (double) 0;$overhead_size = (double) 0;$overhead_check = '';$checked = !empty($checkall) ? ' checked="checked"' : '';$num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 : 0;$row_count = 0;$hidden_fields = array();$odd_row = true;$sum_row_count_pre = '';// added by rajk - for blobstreaming$PMA_Config = $_SESSION['PMA_Config'];if (!empty ($PMA_Config)) $session_bs_tables = $PMA_Config->get('BLOBSTREAMING_TABLES'); // list of blobstreaming tables$tableReductionCount = 0; // the amount to reduce the table count byforeach ($tables as $keyname => $each_table) { if (isset($session_bs_tables)) { // compare table name against blobstreaming tables foreach ($session_bs_tables as $table_key=>$table_val) // if the table is a blobstreaming table, reduce table count and skip outer foreach loop if ($table_key == $keyname) { $tableReductionCount++; continue 2; } } // loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to 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. case 'MyISAM' : case 'ISAM' : case 'HEAP' : case 'MEMORY' : 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' : // InnoDB table: Row count is not accurate but data and index // sizes are. if ($each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) { $each_table['COUNTED'] = true; $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db, $each_table['TABLE_NAME'], $return = true, $force_exact = true, $is_view = false); } else { $each_table['COUNTED'] = false; } if ($is_show_stats) { $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; case 'MRG_MyISAM' : 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 null case null : case 'SYSTEM VIEW' : // countRecords() takes care of $cfg['MaxExactCountViews'] $each_table['TABLE_ROWS'] = PMA_Table::countRecords($db, $each_table['TABLE_NAME'], $return = true, $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 $sum_entries += $each_table['TABLE_ROWS']; if (isset($each_table['Collation'])) { $collation = '<dfn title="' . PMA_getCollationDescr($each_table['Collation']) . '">' . $each_table['Collation'] . '</dfn>'; } else { $collation = '---'; } if ($is_show_stats) { if (isset($formatted_overhead)) {
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?