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

📄 tbl_properties_operations.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/* $Id: tbl_properties_operations.php,v 2.48.2.2 2006/03/08 17:54:29 lem9 Exp $ */// vim: expandtab sw=4 ts=4 sts=4:require_once('./libraries/common.lib.php');/** * Runs common work */require('./libraries/tbl_properties_common.php');$url_query .= '&amp;goto=tbl_properties_operations.php&amp;back=tbl_properties_operations.php';/** * Gets relation settings */require_once('./libraries/relation.lib.php');$cfgRelation = PMA_getRelationsParam();/** * Gets available MySQL charsets and storage engines */require_once('./libraries/mysql_charsets.lib.php');require_once('./libraries/storage_engines.lib.php');// reselect current db (needed in some cases probably due to// the calling of relation.lib.php)PMA_DBI_select_db($GLOBALS['db']);/** * Gets tables informations */require_once('./libraries/tbl_move_copy.php');require('./libraries/tbl_properties_table_info.inc.php');$reread_info = false;$errors = array();$table_alters = array();/** * Updates table comment, type and options if required */if ( isset( $_REQUEST['submitoptions'] ) ) {    if ( isset( $_REQUEST['new_name'] ) && $_REQUEST['new_name'] !== $GLOBALS['table'] ) {        if ( trim($_REQUEST['new_name']) === '' ) {            $errors[] = $strTableEmpty;        } elseif ( strpos($_REQUEST['new_name'], '.') !== false ) {            $errors[] = $strError . ': ' . $_REQUEST['new_name'];        } else {            if ( PMA_table_rename( $GLOBALS['table'], $_REQUEST['new_name'] ) ) {                $message   = sprintf($GLOBALS['strRenameTableOK'],                    htmlspecialchars($GLOBALS['table']), htmlspecialchars($_REQUEST['new_name']));                $GLOBALS['table'] = $_REQUEST['new_name'];                $reread_info = true;                $reload = true;            } else {                $errors[] = $strError . ': ' . $_REQUEST['new_name'];            }        }    }    if ( isset( $_REQUEST['comment'] )      && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment'] ) {        $table_alters[] = 'COMMENT = \'' . PMA_sqlAddslashes($_REQUEST['comment']) . '\'';    }    if ( ! empty( $_REQUEST['new_tbl_type'] )      && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type) ) {        $table_alters[] = PMA_ENGINE_KEYWORD . ' = ' . $_REQUEST['new_tbl_type'];        $tbl_type = $_REQUEST['new_tbl_type'];    }    if ( ! empty( $_REQUEST['tbl_collation'] )      && $_REQUEST['tbl_collation'] !== $tbl_collation ) {        $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);    }    $l_tbl_type = strtolower( $tbl_type );    $pack_keys = empty( $pack_keys ) ? '0' : '1';    $_REQUEST['new_pack_keys'] = empty( $_REQUEST['new_pack_keys'] ) ? '0' : '1';    if ( ( $l_tbl_type === 'myisam' || $l_tbl_type === 'isam' )      && $_REQUEST['new_pack_keys'] !== $pack_keys ) {        $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];    }    $checksum = empty( $checksum ) ? '0' : '1';    $_REQUEST['new_checksum'] = empty( $_REQUEST['new_checksum'] ) ? '0' : '1';    if ( ( $l_tbl_type === 'myisam' )      && $_REQUEST['new_checksum'] !== $checksum ) {        $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];    }    $delay_key_write = empty( $delay_key_write ) ? '0' : '1';    $_REQUEST['new_delay_key_write'] = empty( $_REQUEST['new_delay_key_write'] ) ? '0' : '1';    if ( ( $l_tbl_type === 'myisam' )      && $_REQUEST['new_delay_key_write'] !== $delay_key_write ) {        $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];    }    if ( ( $l_tbl_type === 'myisam' || $l_tbl_type === 'innodb' )      &&  ! empty( $_REQUEST['new_auto_increment'] )      && ( ! isset( $auto_increment ) || $_REQUEST['new_auto_increment'] !== $auto_increment ) ) {        $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);    }    if ( count($table_alters) > 0 ) {        $sql_query      = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);        $sql_query     .= "\r\n" . implode("\r\n", $table_alters);        $message        = PMA_DBI_query($sql_query) ? $strSuccess : $strError;        $reread_info    = true;        unset( $table_alters );    }}/** * Reordering the table has been requested by the user */if ( isset( $_REQUEST['submitorderby'] ) && ! empty( $_REQUEST['order_field'] ) ) {    $sql_query = '        ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '        ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));    if ( isset( $_REQUEST['order_order'] ) && $_REQUEST['order_order'] === 'desc' ) {        $sql_query .= ' DESC';    }    $message = PMA_DBI_query($sql_query) ? $strSuccess : $strError;} // end ifif ( $reread_info ) {    $pack_keys = $checksum = $delay_key_write = 0;    require('./libraries/tbl_properties_table_info.inc.php');}unset( $reread_info );/** * Displays top menu links */require_once('./libraries/tbl_properties_links.inc.php');$url_params['goto'] = 'tbl_properties_operations.php';$url_params['back'] = 'tbl_properties_operations.php';/** * Get columns names */$local_query = '    SHOW COLUMNS    FROM ' . PMA_backquote($GLOBALS['table']) . '    FROM ' . PMA_backquote($GLOBALS['db']);$columns = PMA_DBI_fetch_result($local_query, null, 'Field');unset( $local_query );/** * Displays the page */?><!-- Order the table --><div id="div_table_order"><form method="post" action="tbl_properties_operations.php"><?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?><fieldset id="fieldset_table_order">    <legend><?php echo $strAlterOrderBy; ?></legend>    <select name="order_field"><?phpforeach ( $columns as $fieldname ) {    echo '            <option value="' . htmlspecialchars($fieldname) . '">'        . htmlspecialchars($fieldname) . '</option>' . "\n";}unset($columns);?>    </select> <?php echo $strSingly; ?>    <select name="order_order">        <option value="asc"><?php echo $strAscending; ?></option>        <option value="desc"><?php echo $strDescending; ?></option>    </select>    <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" /></fieldset></form></div><!-- Move table --><div id="div_table_rename"><form method="post" action="tbl_move_copy.php"    onsubmit="return emptyFormElements(this, 'new_name')"><?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?><input type="hidden" name="reload" value="1" /><input type="hidden" name="what" value="data" /><fieldset id="fieldset_table_rename">    <legend><?php echo $strMoveTable; ?></legend>    <select name="target_db"><?php// The function used below is defined in "common.lib.php"PMA_availableDatabases('main.php?' . PMA_generate_common_url());foreach ( $dblist as $each_db ) {    echo '        ';    echo '<option value="' . htmlspecialchars($each_db) . '">'        . htmlspecialchars($each_db) . '</option>';    echo "\n";} // end foreach $dblist?>    </select>    &nbsp;<b>.</b>&nbsp;    <input type="text" size="20" name="new_name" onfocus="this.select()"        value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />    <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" /></fieldset></form></div><?phpif (strstr($show_comment, '; InnoDB free') === false) {    if (strstr($show_comment, 'InnoDB free') === false) {        // only user entered comment        $comment = $show_comment;    } else {        // here we have just InnoDB generated part        $comment = '';    }} else {    // remove InnoDB comment from end, just the minimal part (*? is non greedy)    $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);}// PACK_KEYS: MyISAM or ISAM// DELAY_KEY_WRITE, CHECKSUM, : MyISAM only// AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3// nijel: Here should be version check for InnoDB, however it is supported// in >5.0.4, >4.1.12 and >4.0.11, so I decided not to// check for version?><!-- Table options --><div id="div_table_options"><form method="post" action="tbl_properties_operations.php"><?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?><input type="hidden" name="reload" value="1" /><fieldset>    <legend><?php echo $strTableOptions; ?></legend>    <table>    <!-- Change table name -->    <tr><td><?php echo $strRenameTable; ?></td>        <td><input type="text" size="20" name="new_name" onfocus="this.select()"                value="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />        </td>    </tr>    <!-- Table comments -->    <tr><td><?php echo $strTableComments; ?></td>        <td><input type="text" name="comment" maxlength="60" size="30"                value="<?php echo htmlspecialchars($comment); ?>" onfocus="this.select()" />            <input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" />        </td>    </tr>    <!-- Storage engine -->    <tr><td><?php echo $strStorageEngine; ?>            <?php echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?>        </td>        <td><?php echo PMA_generateEnginesDropdown('new_tbl_type', null, false, $tbl_type, 4); ?>        </td>    </tr>

⌨️ 快捷键说明

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