⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db_details_structure.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* $Id: db_details_structure.php,v 2.73.2.6 2006/02/17 13:57:36 lem9 Exp $ */// vim: expandtab sw=4 ts=4 sts=4:require_once './libraries/common.lib.php';/** * 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_details_structure.php';        $err_url = 'db_details_structure.php?'. PMA_generate_common_url($db);        require './libraries/mult_submits.inc.php';        $message = $strSuccess;    }    require './libraries/db_details_common.inc.php';    $url_query .= '&amp;goto=db_details_structure.php';    // Gets the database structure    $sub_part = '_structure';    require './libraries/db_details_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';if (PMA_MYSQL_INT_VERSION >= 40101) {    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    PMA_MYSQL_INT_VERSION * @uses    $GLOBALS['cfg']['PropertiesNumColumns'] * @uses    $GLOBALS['cfg']['ShowStats'] * @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($GLOBALS['strApproximateCount']) . "\n"        .'    </th>' . "\n";    if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) {        echo '    <th>' . $GLOBALS['strType'] . '</th>' . "\n";        $cnt++;        if (PMA_MYSQL_INT_VERSION >= 40100) {            echo '    <th>' . $GLOBALS['strCollation'] . '</th>' . "\n";            $cnt++;        }    }    if ($GLOBALS['cfg']['ShowStats']) {        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;}$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 */?><form method="post" action="db_details_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;$at_least_one_view_exceeds_max_count = false;foreach ($tables as $keyname => $each_table) {    if ($each_table['TABLE_ROWS'] === null || $each_table['TABLE_ROWS'] < $GLOBALS['cfg']['MaxExactCount']) {        $each_table['TABLE_ROWS'] = PMA_countRecords($db,            $each_table['TABLE_NAME'], $return = true, $force_exact = true);    }    $table_encoded = urlencode($each_table['TABLE_NAME']);    // MySQL < 5.0.13 returns "view", >= 5.0.13 returns "VIEW"    $table_is_view = ($each_table['TABLE_TYPE'] === 'VIEW'                       || $each_table['TABLE_TYPE'] === 'SYSTEM VIEW');    $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']]))               ? htmlspecialchars($tooltip_aliasname[$each_table['TABLE_NAME']])               :  htmlspecialchars($each_table['TABLE_NAME']);    $truename = (!empty($tooltip_truename) && isset($tooltip_truename[$each_table['TABLE_NAME']]))               ? htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])               : htmlspecialchars($each_table['TABLE_NAME']);    // Sets parameters for links    $tbl_url_query = $url_query . '&amp;table=' . $table_encoded;    $i++;    $row_count++;    if ($table_is_view) {        $hidden_fields[] = '<input type="hidden" name="views[]" value="' .  $table_encoded . '" />';    }    if ($each_table['TABLE_ROWS'] > 0) {        $browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">' . $titles['Browse'] . '</a>';        $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . $titles['Search'] . '</a>';    } else {        $browse_table = $titles['NoBrowse'];        $search_table = $titles['NoSearch'];    }    if (! $db_is_information_schema) {        if (! empty($each_table['TABLE_ROWS'])) {            $empty_table = '<a href="sql.php?' . $tbl_url_query                 . '&amp;sql_query=';            if (PMA_MYSQL_INT_VERSION >= 40000) {                $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))                     . '&amp;zero_rows='                     . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))                     . '" onclick="return confirmLink(this, \'TRUNCATE ';            } else {                $empty_table .= urlencode('DELETE FROM ' . PMA_backquote($each_table['TABLE_NAME']))                     . '&amp;zero_rows='                     . urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($each_table['TABLE_NAME'])))                     . '" onclick="return confirmLink(this, \'DELETE FROM ';            }            $empty_table .= PMA_jsFormat($each_table['TABLE_NAME']) . '\')">' . $titles['Empty'] . '</a>';        } else {            $empty_table = $titles['NoEmpty'];        }        $drop_query = 'DROP '            . ($table_is_view ? 'VIEW' : 'TABLE')            . ' ' . PMA_backquote($each_table['TABLE_NAME']);        $drop_message = sprintf(            $table_is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped,            htmlspecialchars($each_table['TABLE_NAME']));    }    // loic1: Patch from Joshua Nye <josh at boxcarmedia.com> to get valid    //        statistics whatever is the table type    if (isset($each_table['TABLE_ROWS'])) {        // MyISAM, ISAM or Heap table: Row count, data size and index size        // is accurate.        if (preg_match('@^(MyISAM|ISAM|HEAP|MEMORY)$@', $each_table['ENGINE'])) {            if ($cfg['ShowStats']) {                $tblsize                    =  doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']);                $sum_size                   += $tblsize;                list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);                if (isset($each_table['Data_free']) && $each_table['Data_free'] > 0) {                    list($formated_overhead, $overhead_unit)     = PMA_formatByteDown($each_table['Data_free']);                    $overhead_size           += $each_table['Data_free'];                }            }            $sum_entries                    += $each_table['TABLE_ROWS'];        } elseif ($each_table['ENGINE'] == 'InnoDB') {            // InnoDB table: Row count is not accurate but data and index            // sizes are.            if ($cfg['ShowStats']) {                $tblsize                    =  $each_table['Data_length'] + $each_table['Index_length'];                $sum_size                   += $tblsize;                list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, ($tblsize > 0) ? 1 : 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -