is used */ if (isset($_REQUEST['submit_mult_change_x'])) { $submit_mult = 'change'; } elseif (isset($_REQUEST['submit_mult_drop_x'])) { $submit_mult = 'drop'; } elseif (isset($_REQUEST['submit_mult_primary_x'])) { $submit_mult = 'primary'; } elseif (isset($_REQUEST['submit_mult_index_x'])) { $submit_mult = 'index'; } elseif (isset($_REQUEST['submit_mult_unique_x'])) { $submit_mult = 'unique'; } elseif (isset($_REQUEST['submit_mult_spatial_x'])) { $submit_mult = 'spatial'; } elseif (isset($_REQUEST['submit_mult_fulltext_x'])) { $submit_mult = 'ftext'; } elseif (isset($_REQUEST['submit_mult_browse_x'])) { $submit_mult = 'browse'; } elseif (isset($_REQUEST['submit_mult'])) { $submit_mult = $_REQUEST['submit_mult']; } elseif (isset($_REQUEST['mult_btn']) && $_REQUEST['mult_btn'] == __('Yes')) { $submit_mult = 'row_delete'; if (isset($_REQUEST['selected'])) { $_REQUEST['selected_fld'] = $_REQUEST['selected']; } } if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) { $err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table); if ($submit_mult == 'browse') { // browsing the table displaying only selected fields/columns $GLOBALS['active_page'] = 'sql.php'; $sql_query = ''; foreach ($_REQUEST['selected_fld'] as $idx => $sval) { if ($sql_query == '') { $sql_query .= 'SELECT ' . PMA_backquote($sval); } else { $sql_query .= ', ' . PMA_backquote($sval); } } // what is this htmlspecialchars() for?? //$sql_query .= ' FROM ' . PMA_backquote(htmlspecialchars($table)); $sql_query .= ' FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table); include 'sql.php'; exit; } else { // handle multiple field commands // handle confirmation of deleting multiple fields/columns $action = 'tbl_structure.php'; include 'libraries/mult_submits.inc.php'; //require_once 'libraries/header.inc.php'; if (empty($message)) { $message = PMA_Message::success(); } } } /** * Gets the relation settings */ $cfgRelation = PMA_getRelationsParam(); /** * Runs common work */ require_once 'libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_structure.php&back=tbl_structure.php'; $url_params['goto'] = 'tbl_structure.php'; $url_params['back'] = 'tbl_structure.php'; /** * Prepares the table structure display */ /** * Gets tables informations */ require_once 'libraries/tbl_info.inc.php'; require_once 'libraries/Index.class.php'; // 2. Gets table keys and retains them // @todo should be: $server->db($db)->table($table)->primary() $primary = PMA_Index::getPrimary($table, $db); $columns_with_unique_index = array(); foreach (PMA_Index::getFromTable($table, $db) as $index) { if ($index->isUnique() && $index->getChoice() == 'UNIQUE') { $columns = $index->getColumns(); foreach ($columns as $column_name => $dummy) { $columns_with_unique_index[$column_name] = 1; } } } unset($index, $columns, $column_name, $dummy); // 3. Get fields $fields = (array) PMA_DBI_get_columns($db, $table, null, true); // 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 COLUMNS FROM. // // We also need this to correctly learn if a TIMESTAMP is NOT NULL, since // SHOW FULL COLUMNS 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(); $titles['Change'] = PMA_getIcon('b_edit.png', __('Change')); $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop')); $titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop')); $titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary')); $titles['Index'] = PMA_getIcon('b_index.png', __('Index')); $titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique')); $titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Spatial')); $titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext')); $titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary')); $titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index')); $titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique')); $titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Spatial')); $titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext')); $titles['DistinctValues'] = PMA_getIcon('b_browse.png', __('Distinct values')); // hidden action titles (image and string) $hidden_titles = array(); $hidden_titles['DistinctValues'] = PMA_getIcon('b_browse.png', __('Distinct values'), true); $hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), true); $hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), true); $hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), true); $hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), true); $hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), true); $hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), true); $hidden_titles['Spatial'] = PMA_getIcon('b_spatial.png', __('Add SPATIAL index'), true); $hidden_titles['NoSpatial'] = PMA_getIcon('bd_spatial.png', __('Add SPATIAL index'), true); $hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), true); $hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), true); /** * Displays the table structure ('show table' works correct since 3.23.03) */ /* TABLE INFORMATION */ // table header $i = 0; ?>
> '; } else if ($tbl_is_view) { echo '"view" />'; } else { echo '"table" />'; } ?> MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']); } else { $type_mime = ''; } $attribute = $extracted_columnspec['attribute']; // MySQL 4.1.2+ TIMESTAMP options // (if on_update_current_timestamp is set, then it's TRUE) if (isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) { $attribute = 'on update CURRENT_TIMESTAMP'; } // here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having the // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe // the latter. if (! empty($analyzed_sql[0]['create_table_fields'][$row['Field']]['type']) && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] ) { $row['Null'] = ''; } if (! isset($row['Default'])) { if ($row['Null'] == 'YES') { $row['Default'] = 'NULL'; } } else { $row['Default'] = htmlspecialchars($row['Default']); } $field_encoded = urlencode($row['Field']); $field_name = htmlspecialchars($row['Field']); $displayed_field_name = $field_name; // underline commented fields and display a hover-title (CSS only) if (isset($comments_map[$row['Field']])) { $displayed_field_name = '' . $field_name . ''; } if ($primary && $primary->hasColumn($field_name)) { $displayed_field_name = '' . $field_name . ''; } echo "\n"; ?> > = 50604)) && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char')) ) { echo "\n"; ?> ' . "\n" .'
#
/> ' . $field_charset . ''); ?> ' . _pgettext('None for default', 'None') . ''; } ?> href="sql.php?&sql_query=&dropped_column=&message_to_show=" > hasColumn($field_name))) { echo $titles['NoPrimary'] . "\n"; $primary_enabled = false; } else { echo "\n"; ?>
' . "\n"; $checkall_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table); ?> <?php echo __('With selected:'); ?> /

$create_view, 'show_query' => '1', ) ), PMA_getIcon('b_edit.png', __('Edit view'), true) ); } ?> '; echo PMA_getIcon('eye.png', __('Track table'), true); echo ''; } ?>
onsubmit="return checkFormElementInRange(this, 'num_fields', '', 1)"> '); // I tried displaying the drop-down inside the label but with Firefox // the drop-down was blinking $column_selector = ''; $choices = array( 'last' => __('At End of Table'), 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), '') ); echo PMA_getRadioFields('field_where', $choices, 'last', false); echo $column_selector; unset($column_selector, $choices); ?>

>
' ); ?>
'; if (empty($showtable)) { $showtable = PMA_Table::sGetStatusInfo( $GLOBALS['db'], $GLOBALS['table'], null, true ); } $nonisam = false; $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB'); if (isset($showtable['Type']) && ! preg_match('@ISAM|HEAP@i', $showtable['Type']) ) { $nonisam = true; } // Gets some sizes $mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']); // this is to display for example 261.2 MiB instead of 268k KiB $max_digits = 3; $decimals = 1; list($data_size, $data_unit) = PMA_formatByteDown( $showtable['Data_length'], $max_digits, $decimals ); if ($mergetable == false) { list($index_size, $index_unit) = PMA_formatByteDown( $showtable['Index_length'], $max_digits, $decimals ); } // InnoDB returns a huge value in Data_free, do not use it if (! $is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0 ) { list($free_size, $free_unit) = PMA_formatByteDown( $showtable['Data_free'], $max_digits, $decimals ); list($effect_size, $effect_unit) = PMA_formatByteDown( $showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals ); } else { list($effect_size, $effect_unit) = PMA_formatByteDown( $showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals ); } list($tot_size, $tot_unit) = PMA_formatByteDown( $showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals ); if ($table_info_num_rows > 0) { list($avg_size, $avg_unit) = PMA_formatByteDown( ($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1 ); } // Displays them $odd_row = false; ?>
0) { ?> 0 && $mergetable == false) { ?>
' . $tbl_collation . ''; ?>
ø
ø
' . "\n"; /** * Displays the footer */ require 'libraries/footer.inc.php'; ?>