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

📄 tbl_structure.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/* $Id: tbl_structure.php 9761 2006-11-26 09:53:45Z lem9 $ */// vim: expandtab sw=4 ts=4 sts=4:require_once './libraries/common.lib.php';require_once './libraries/mysql_charsets.lib.php';require_once './libraries/relation.lib.php';/** * Gets the relation settings */$cfgRelation = PMA_getRelationsParam();/** * Drop multiple fields if required */// workaround for IE problem:if (isset($submit_mult_change_x)) {    $submit_mult = $strChange;} elseif (isset($submit_mult_drop_x)) {    $submit_mult = $strDrop;} elseif (isset($submit_mult_primary_x)) {    $submit_mult = $strPrimary;} elseif (isset($submit_mult_index_x)) {    $submit_mult = $strIndex;} elseif (isset($submit_mult_unique_x)) {    $submit_mult = $strUnique;} elseif (isset($submit_mult_fulltext_x)) {    $submit_mult = $strIdxFulltext;}if ((!empty($submit_mult) && isset($selected_fld))    || isset($mult_btn)) {    $action = 'tbl_structure.php';    $err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);    require './libraries/mult_submits.inc.php';}/** * Runs common work */require_once './libraries/tbl_common.php';$url_query .= '&amp;goto=tbl_structure.php&amp;back=tbl_structure.php';/** * Prepares the table structure display *//** * Gets tables informations */require_once './libraries/tbl_info.inc.php';/** * Show result of multi submit operation */if ((!empty($submit_mult) && isset($selected_fld))    || isset($mult_btn)) {    $message = $strSuccess;}/** * Displays top menu links */require_once './libraries/tbl_links.inc.php';// 2. Gets table keys and retains them$result      = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table) . ';');$primary     = '';$ret_keys    = array();$pk_array    = array(); // will be use to emphasis prim. keys in the table viewwhile ($row = PMA_DBI_fetch_assoc($result)) {    $ret_keys[]  = $row;    // Backups the list of primary keys    if ($row['Key_name'] == 'PRIMARY') {        $primary .= $row['Column_name'] . ', ';        $pk_array[$row['Column_name']] = 1;    }} // end whilePMA_DBI_free_result($result);// 3. Get fields$fields_rs   = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);$fields_cnt  = PMA_DBI_num_rows($fields_rs);// Get more complete field information// For now, this is done just for MySQL 4.1.2+ new TIMESTAMP options// but later, if the analyser returns more information, it// could be executed for any MySQL version and replace// the info given by SHOW FULL FIELDS FROM.//// We also need this to correctly learn if a TIMESTAMP is NOT NULL, since// SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL// and SHOW CREATE TABLE says NOT NULL (tested// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).$show_create_table = PMA_DBI_fetch_value(        'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),        0, 1);$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));/** * prepare table infos */// action titles (image or string)$titles = array();if ($cfg['PropertiesIconic'] == true) {    if ($cfg['PropertiesIconic'] === 'both') {        $iconic_spacer = '<div class="nowrap">';    } else {        $iconic_spacer = '';    }    // images replaced 2004-05-08 by mkkeck    $titles['Change']        = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" />';    $titles['Drop']          = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';    $titles['NoDrop']        = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';    $titles['Primary']       = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';    $titles['Index']         = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';    $titles['Unique']        = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';    $titles['IdxFulltext']   = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';    $titles['NoPrimary']     = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';    $titles['NoIndex']       = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';    $titles['NoUnique']      = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';    $titles['NoIdxFulltext'] = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';    $titles['BrowseDistinctValues']        = $iconic_spacer        . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage        . 'b_browse.png" alt="' . $strBrowseDistinctValues . '" title="' . $strBrowseDistinctValues . '" />';    if ($cfg['PropertiesIconic'] === 'both') {        $titles['Change']               .= $strChange . '</div>';        $titles['Drop']                 .= $strDrop . '</div>';        $titles['NoDrop']               .= $strDrop . '</div>';        $titles['Primary']              .= $strPrimary . '</div>';        $titles['Index']                .= $strIndex . '</div>';        $titles['Unique']               .= $strUnique . '</div>';        $titles['IdxFulltext'  ]        .= $strIdxFulltext . '</div>';        $titles['NoPrimary']            .= $strPrimary . '</div>';        $titles['NoIndex']              .= $strIndex . '</div>';        $titles['NoUnique']             .= $strUnique . '</div>';        $titles['NoIdxFulltext']        .= $strIdxFulltext . '</div>';        $titles['BrowseDistinctValues'] .= $strBrowseDistinctValues . '</div>';    }} else {    $titles['Change']               = $strChange;    $titles['Drop']                 = $strDrop;    $titles['NoDrop']               = $strDrop;    $titles['Primary']              = $strPrimary;    $titles['Index']                = $strIndex;    $titles['Unique']               = $strUnique;    $titles['IdxFulltext']          = $strIdxFulltext;    $titles['NoPrimary']            = $strPrimary;    $titles['NoIndex']              = $strIndex;    $titles['NoUnique']             = $strUnique;    $titles['NoIdxFulltext']        = $strIdxFulltext;    $titles['BrowseDistinctValues'] = $strBrowseDistinctValues;}/** * Displays the table structure ('show table' works correct since 3.23.03) *//* TABLE INFORMATION */// table header$i = 0;?><form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm">    <?php echo PMA_generate_common_hidden_inputs($db, $table); ?><table id="tablestructure" class="data"><thead><tr>    <th id="th<?php echo ++$i; ?>"></th>    <th id="th<?php echo ++$i; ?>"><?php echo $strField; ?></th>    <th id="th<?php echo ++$i; ?>"><?php echo $strType; ?></th><?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <th id="th' . ++$i . '">' . $strCollation . '</th>' . "\n" : ''; ?>    <th id="th<?php echo ++$i; ?>"><?php echo $strAttr; ?></th>    <th id="th<?php echo ++$i; ?>"><?php echo $strNull; ?></th>    <th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th>    <th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th><?php if ($db_is_information_schema || $tbl_is_view) { ?>    <th id="th<?php echo ++$i; ?>"><?php echo $strView; ?></th><?php } else { ?>    <th colspan="7" id="th<?php echo ++$i; ?>"><?php echo $strAction; ?></th><?php } ?></tr></thead><tbody><?phpunset($i);// table body// prepare comments$comments_map = array();$mime_map = array();if ($GLOBALS['cfg']['ShowPropertyComments']) {    require_once './libraries/relation.lib.php';    require_once './libraries/transformations.lib.php';    $cfgRelation = PMA_getRelationsParam();    if ($cfgRelation['commwork'] || PMA_MYSQL_INT_VERSION >= 40100) {        $comments_map = PMA_getComments($db, $table);        if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {            $mime_map = PMA_getMIME($db, $table, true);        }    }}$rownum    = 0;$aryFields = array();$checked   = (!empty($checkall) ? ' checked="checked"' : '');$save_row  = array();$odd_row   = true;while ($row = PMA_DBI_fetch_assoc($fields_rs)) {    $save_row[] = $row;    $rownum++;    $aryFields[]      = $row['Field'];    $type             = $row['Type'];    // reformat mysql query output - staybyte - 9. June 2001    // loic1: set or enum types: slashes single quotes inside options    if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {        $tmp[2]       = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);        $type         = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';        // for the case ENUM('&#8211;','&ldquo;')        $type         = htmlspecialchars($type);        $type_nowrap  = '';        $binary       = 0;        $unsigned     = 0;        $zerofill     = 0;    } else {        $type_nowrap  = ' nowrap="nowrap"';        // strip the "BINARY" attribute, except if we find "BINARY(" because        // this would be a BINARY or VARBINARY field type        if (!preg_match('@BINARY[\(]@i', $type)) {            $type         = preg_replace('@BINARY@i', '', $type);        }        $type         = preg_replace('@ZEROFILL@i', '', $type);        $type         = preg_replace('@UNSIGNED@i', '', $type);        if (empty($type)) {            $type     = ' ';        }        if (!preg_match('@BINARY[\(]@i', $row['Type'])) {            $binary           = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');

⌨️ 快捷键说明

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