3 // vim: expandtab sw=4 ts=4 sts=4:
5 require_once('./libraries/common.lib.php');
6 require_once('./libraries/mysql_charsets.lib.php');
9 * Drop multiple fields if required
12 // workaround for IE problem:
13 if (isset($submit_mult_change_x)) {
14 $submit_mult = $strChange;
15 } elseif (isset($submit_mult_drop_x)) {
16 $submit_mult = $strDrop;
17 } elseif (isset($submit_mult_primary_x)) {
18 $submit_mult = $strPrimary;
19 } elseif (isset($submit_mult_index_x)) {
20 $submit_mult = $strIndex;
21 } elseif (isset($submit_mult_unique_x)) {
22 $submit_mult = $strUnique;
23 } elseif (isset($submit_mult_fulltext_x)) {
24 $submit_mult = $strIdxFulltext;
27 if ((!empty($submit_mult) && isset($selected_fld))
28 ||
isset($mult_btn)) {
29 $action = 'tbl_properties_structure.php';
30 $err_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db, $table);
31 require('./mult_submits.inc.php');
37 require_once('./tbl_properties_common.php');
38 $url_query .= '&goto=tbl_properties_structure.php&back=tbl_properties_structure.php';
41 * Prepares the table structure display
45 * Gets tables informations
47 require_once('./tbl_properties_table_info.php');
50 * Show result of multi submit operation
52 if ((!empty($submit_mult) && isset($selected_fld))
53 ||
isset($mult_btn)) {
54 $message = $strSuccess;
58 * Displays top menu links
60 require_once('./tbl_properties_links.php');
62 // 2. Gets table keys and retains them
63 $result = PMA_DBI_query('SHOW INDEX FROM ' . PMA_backquote($table) . ';');
66 $pk_array = array(); // will be use to emphasis prim. keys in the table view
67 while ($row = PMA_DBI_fetch_assoc($result)) {
69 // Backups the list of primary keys
70 if ($row['Key_name'] == 'PRIMARY') {
71 $primary .= $row['Column_name'] . ', ';
72 $pk_array[$row['Column_name']] = 1;
75 PMA_DBI_free_result($result);
78 $fields_rs = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE
);
79 $fields_cnt = PMA_DBI_num_rows($fields_rs);
81 // Get more complete field information
82 // For now, this is done just for MySQL 4.1.2+ new TIMESTAMP options
83 // but later, if the analyser returns more information, it
84 // could be executed for any MySQL version and replace
85 // the info given by SHOW FULL FIELDS FROM.
87 // We also need this to correctly learn if a TIMESTAMP is NOT NULL, since
88 // SHOW FULL FIELDS says NULL and SHOW CREATE TABLE says NOT NULL (tested
91 $show_create_table = PMA_DBI_fetch_value(
92 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
94 $analyzed_sql = PMA_SQP_analyze( PMA_SQP_parse( $show_create_table ) );
99 // action titles (image or string)
101 if ( $cfg['PropertiesIconic'] == true ) {
102 if ( $cfg['PropertiesIconic'] === 'both' ) {
103 $iconic_spacer = '<div class="nowrap">';
108 // images replaced 2004-05-08 by mkkeck
109 $titles['Change'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" />';
110 $titles['Drop'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
111 $titles['NoDrop'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" />';
112 $titles['Primary'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';
113 $titles['Index'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';
114 $titles['Unique'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';
115 $titles['IdxFulltext'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';
116 $titles['NoPrimary'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" />';
117 $titles['NoIndex'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" />';
118 $titles['NoUnique'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" />';
119 $titles['NoIdxFulltext'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />';
120 $titles['Browse'] = $iconic_spacer . '<img class="icon" width="16" height="16" src="' . $pmaThemeImage . 'b_browse.png" alt="' . $strBrowse . '" title="' . $strBrowse . '" />';
122 if ( $cfg['PropertiesIconic'] === 'both' ) {
123 $titles['Change'] .= $strChange . '</div>';
124 $titles['Drop'] .= $strDrop . '</div>';
125 $titles['NoDrop'] .= $strDrop . '</div>';
126 $titles['Primary'] .= $strPrimary . '</div>';
127 $titles['Index'] .= $strIndex . '</div>';
128 $titles['Unique'] .= $strUnique . '</div>';
129 $titles['IdxFulltext' ] .= $strIdxFulltext . '</div>';
130 $titles['NoPrimary'] .= $strPrimary . '</div>';
131 $titles['NoIndex'] .= $strIndex . '</div>';
132 $titles['NoUnique'] .= $strUnique . '</div>';
133 $titles['NoIdxFulltext'] .= $strIdxFulltext . '</div>';
134 $titles['Browse'] .= $strBrowse . '</div>';
137 $titles['Change'] = $strChange;
138 $titles['Drop'] = $strDrop;
139 $titles['NoDrop'] = $strDrop;
140 $titles['Primary'] = $strPrimary;
141 $titles['Index'] = $strIndex;
142 $titles['Unique'] = $strUnique;
143 $titles['IdxFulltext'] = $strIdxFulltext;
144 $titles['NoPrimary'] = $strPrimary;
145 $titles['NoIndex'] = $strIndex;
146 $titles['NoUnique'] = $strUnique;
147 $titles['NoIdxFulltext'] = $strIdxFulltext;
148 $titles['Browse'] = $strBrowse;
152 * Displays the table structure ('show table' works correct since 3.23.03)
154 /* TABLE INFORMATION */
158 <form method
="post" action
="tbl_properties_structure.php" name
="fieldsForm" id
="fieldsForm">
159 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
160 <table id
="tablestructure" class="data">
163 <th id
="th<?php echo ++$i; ?>"></th
>
164 <th id
="th<?php echo ++$i; ?>"><?php
echo $strField; ?
></th
>
165 <th id
="th<?php echo ++$i; ?>"><?php
echo $strType; ?
></th
>
166 <?php
echo PMA_MYSQL_INT_VERSION
>= 40100 ?
' <th id="th' . ++
$i . '">' . $strCollation . '</th>' . "\n" : ''; ?
>
167 <th id
="th<?php echo ++$i; ?>"><?php
echo $strAttr; ?
></th
>
168 <th id
="th<?php echo ++$i; ?>"><?php
echo $strNull; ?
></th
>
169 <th id
="th<?php echo ++$i; ?>"><?php
echo $strDefault; ?
></th
>
170 <th id
="th<?php echo ++$i; ?>"><?php
echo $strExtra; ?
></th
>
171 <?php
if ( $db_is_information_schema ||
$tbl_is_view ) { ?
>
172 <th id
="<?php echo ++$i; ?>"><?php
echo $strView; ?
></th
>
174 <th colspan
="7" id
="<?php echo ++$i; ?>"><?php
echo $strAction; ?
></th
>
186 $comments_map = array();
189 if ($GLOBALS['cfg']['ShowPropertyComments']) {
190 require_once('./libraries/relation.lib.php');
191 require_once('./libraries/transformations.lib.php');
193 $cfgRelation = PMA_getRelationsParam();
195 if ($cfgRelation['commwork']) {
196 $comments_map = PMA_getComments($db, $table);
198 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
199 $mime_map = PMA_getMIME($db, $table, true);
205 $aryFields = array();
206 $checked = (!empty($checkall) ?
' checked="checked"' : '');
209 while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
212 $aryFields[] = $row['Field'];
214 $type = $row['Type'];
215 // reformat mysql query output - staybyte - 9. June 2001
216 // loic1: set or enum types: slashes single quotes inside options
217 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
218 $tmp[2] = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
219 $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
221 // for the case ENUM('–','“')
222 $type = htmlspecialchars($type);
230 $type_nowrap = ' nowrap="nowrap"';
231 // strip the "BINARY" attribute, except if we find "BINARY(" because
232 // this would be a BINARY or VARBINARY field type
233 if (!preg_match('@BINARY[\(]@i', $type)) {
234 $type = preg_replace('@BINARY@i', '', $type);
236 $type = preg_replace('@ZEROFILL@i', '', $type);
237 $type = preg_replace('@UNSIGNED@i', '', $type);
242 if (!preg_match('@BINARY[\(]@i', $row['Type'])) {
243 $binary = stristr($row['Type'], 'blob') ||
stristr($row['Type'], 'binary');
248 $unsigned = stristr($row['Type'], 'unsigned');
249 $zerofill = stristr($row['Type'], 'zerofill');
252 // rabus: Divide charset from the rest of the type definition (MySQL >= 4.1)
253 unset($field_charset);
254 if (PMA_MYSQL_INT_VERSION
>= 40100) {
255 if ((substr($type, 0, 4) == 'char'
256 ||
substr($type, 0, 7) == 'varchar'
257 ||
substr($type, 0, 4) == 'text'
258 ||
substr($type, 0, 8) == 'tinytext'
259 ||
substr($type, 0, 10) == 'mediumtext'
260 ||
substr($type, 0, 8) == 'longtext'
261 ||
substr($type, 0, 3) == 'set'
262 ||
substr($type, 0, 4) == 'enum'
264 if (strpos($type, ' character set ')) {
265 $type = substr($type, 0, strpos($type, ' character set '));
267 if (!empty($row['Collation'])) {
268 $field_charset = $row['Collation'];
277 // garvin: Display basic mimetype [MIME]
278 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) {
279 $type_mime = '<br />MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
286 $attribute = 'BINARY';
289 $attribute = 'UNSIGNED';
292 $attribute = 'UNSIGNED ZEROFILL';
295 // MySQL 4.1.2+ TIMESTAMP options
296 // (if on_update_current_timestamp is set, then it's TRUE)
297 if (isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
298 $attribute = 'ON UPDATE CURRENT_TIMESTAMP';
301 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
302 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
304 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']) {
309 if (!isset($row['Default'])) {
310 if ($row['Null'] == 'YES') {
311 $row['Default'] = '<i>NULL</i>';
314 $row['Default'] = htmlspecialchars($row['Default']);
317 $field_encoded = urlencode($row['Field']);
318 $field_name = htmlspecialchars($row['Field']);
320 // garvin: underline commented fields and display a hover-title (CSS only)
323 if (isset($comments_map[$row['Field']])) {
324 $field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
327 if (isset($pk_array[$row['Field']])) {
328 $field_name = '<u>' . $field_name . '</u>';
332 <tr
class="<?php echo $odd_row ? 'odd': 'even'; $odd_row = !$odd_row; ?>">
334 <input type
="checkbox" name
="selected_fld[]" value
="<?php echo $field_encoded; ?>" id
="checkbox_row_<?php echo $rownum; ?>" <?php
echo $checked; ?
> />
336 <th nowrap
="nowrap"><label
for="checkbox_row_<?php echo $rownum; ?>"><?php
echo $field_name; ?
></label
></th
>
337 <td
<?php
echo $type_nowrap; ?
>><?php
echo $type; echo $type_mime; ?
><bdo dir
="ltr"></bdo
></td
>
338 <?php
echo PMA_MYSQL_INT_VERSION
>= 40100 ?
' <td>' . (empty($field_charset) ?
'' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?
>
339 <td nowrap
="nowrap" style
="font-size: <?php echo $font_smallest; ?>"><?php
echo $attribute; ?
></td
>
340 <td
><?php
echo (($row['Null'] == 'YES') ?
$strYes : $strNo); ?
></td
>
341 <td nowrap
="nowrap"><?php
if (isset($row['Default'])) echo $row['Default']; ?
></td
>
342 <td nowrap
="nowrap"><?php
echo $row['Extra']; ?
></td
>
344 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode( 'SELECT COUNT(*) AS `' . $strRows . '`, `' . $row['Field'] . '` FROM `' . $table . '` GROUP BY `' . $row['Field'] . '` ORDER BY `' . $row['Field'] . '`' ); ?>">
345 <?php
echo $titles['Browse']; ?
></a
>
347 <?php
if ( ! $tbl_is_view && ! $db_is_information_schema ) { ?
>
349 <a href
="tbl_alter.php?<?php echo $url_query; ?>&field=<?php echo $field_encoded; ?>">
350 <?php
echo $titles['Change']; ?
></a
>
354 // loic1: Drop field only if there is more than one field in the table
355 if ($fields_cnt > 1) {
358 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&cpurge=1&purgekey=<?php echo urlencode($row['Field']); ?>&zero_rows=<?php echo urlencode(sprintf($strFieldHasBeenDropped, htmlspecialchars($row['Field']))); ?>"
359 onclick
="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
360 <?php
echo $titles['Drop']; ?
></a
>
363 echo "\n" . ' ' . $titles['NoDrop'];
370 if ($type == 'text' ||
$type == 'blob') {
371 echo $titles['NoPrimary'] . "\n";
375 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
376 onclick
="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,'); ?> ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
377 <?php
echo $titles['Primary']; ?
></a
>
385 if ($type == 'text' ||
$type == 'blob') {
386 echo $titles['NoIndex'] . "\n";
390 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf($strAnIndex ,htmlspecialchars($row['Field']))); ?>">
391 <?php
echo $titles['Index']; ?
></a
>
399 if ($type == 'text' ||
$type == 'blob') {
400 echo $titles['NoUnique'] . "\n";
404 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
405 <?php
echo $titles['Unique']; ?
></a
>
412 if ((!empty($tbl_type) && $tbl_type == 'MYISAM')
413 && (strpos(' ' . $type, 'text') ||
strpos(' ' . $type, 'varchar'))) {
416 <td align
="center" nowrap
="nowrap">
417 <a href
="sql.php?<?php echo $url_query; ?>&sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
418 <?php
echo $titles['IdxFulltext']; ?
></a
>
424 <td align
="center" nowrap
="nowrap">
425 <?php
echo $titles['NoIdxFulltext'] . "\n"; ?
>
428 } // end if... else...
430 } // end if ( ! $tbl_is_view && ! $db_is_information_schema )
434 unset($field_charset);
437 echo '</tbody>' . "\n"
440 $checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
443 <img
class="selectallarrow" src
="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>"
444 width
="38" height
="22" alt
="<?php echo $strWithChecked; ?>" />
445 <a href
="<?php echo $checkall_url; ?>&checkall=1"
446 onclick
="if ( markAllRows('fieldsForm') ) return false;">
447 <?php
echo $strCheckAll; ?
></a
>
449 <a href
="<?php echo $checkall_url; ?>"
450 onclick
="if ( unMarkAllRows('fieldsForm') ) return false;">
451 <?php
echo $strUncheckAll; ?
></a
>
453 <i
><?php
echo $strWithChecked; ?
></i
>
456 if ($cfg['PropertiesIconic']) {
457 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_browse', $strBrowse, 'b_browse.png');
459 echo '<input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
461 if ( ! $tbl_is_view && ! $db_is_information_schema ) {
462 if ($cfg['PropertiesIconic']) {
463 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $strChange, 'b_edit.png');
464 // Drop button if there is at least two fields
465 if ($fields_cnt > 1) {
466 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', $strDrop, 'b_drop.png');
468 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', $strPrimary, 'b_primary.png');
469 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', $strIndex, 'b_index.png');
470 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', $strUnique, 'b_unique.png');
471 if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
472 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', $strIdxFulltext, 'b_ftext.png');
475 // Drop button if there is at least two fields
476 if ($fields_cnt > 1) {
477 echo '<i>' . $strOr . '</i>' . "\n"
478 . '<input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
480 echo '<i>' . $strOr . '</i>' . "\n"
481 . '<input type="submit" name="submit_mult" value="' . $strPrimary . '" title="' . $strPrimary . '" />' . "\n";
482 echo '<i>' . $strOr . '</i>' . "\n"
483 . '<input type="submit" name="submit_mult" value="' . $strIndex . '" title="' . $strIndex . '" />' . "\n";
484 echo '<i>' . $strOr . '</i>' . "\n"
485 . '<input type="submit" name="submit_mult" value="' . $strUnique . '" title="' . $strUnique . '" />' . "\n";
486 if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
487 echo '<i>' . $strOr . '</i>' . "\n"
488 . '<input type="submit" name="submit_mult" value="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' . "\n";
501 <a href
="tbl_printview.php?<?php echo $url_query; ?>"><?php
502 if ($cfg['PropertiesIconic']) {
503 echo '<img class="icon" src="' . $pmaThemeImage . 'b_print.png" width="16" height="16" alt="' . $strPrintView . '"/>';
509 if ( ! $tbl_is_view && ! $db_is_information_schema ) {
510 // if internal relations are available, or the table type is INNODB
511 // ($tbl_type comes from tbl_properties_table_info.php)
513 if ($cfg['Server']['relation'] ||
$tbl_type=="INNODB") {
515 <a href
="tbl_relation.php?<?php echo $url_query; ?>"><?php
516 if ($cfg['PropertiesIconic']) {
517 echo '<img class="icon" src="' . $pmaThemeImage . 'b_relations.png" width="16" height="16" alt="' . $strRelationView . '"/>';
519 echo $strRelationView;
524 <a href
="sql.php?<?php echo $url_query; ?>&session_max_rows=all&sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
525 if ($cfg['PropertiesIconic']) {
526 echo '<img class="icon" src="' . $pmaThemeImage . 'b_tblanalyse.png" width="16" height="16" alt="' . $strStructPropose . '" />';
528 echo $strStructPropose;
530 echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
532 <form method
="post" action
="tbl_addfield.php"
533 onsubmit
="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)">
535 echo PMA_generate_common_hidden_inputs($db, $table);
536 if ($cfg['PropertiesIconic']) {
537 echo '<img class="icon" src="' . $pmaThemeImage . 'b_insrow.png" width="16" height="16" alt="' . $strAddNewField . '"/>';
539 echo sprintf($strAddFields, '<input type="text" name="num_fields" size="2" maxlength="2" value="1" style="vertical-align: middle" onfocus="this.select()" />');
541 <input type
="radio" name
="field_where" id
="radio_field_where_last" value
="last" checked
="checked" /><label
for="radio_field_where_last"><?php
echo $strAtEndOfTable; ?
></label
>
542 <input type
="radio" name
="field_where" id
="radio_field_where_first" value
="first" /><label
for="radio_field_where_first"><?php
echo $strAtBeginningOfTable; ?
></label
>
543 <input type
="radio" name
="field_where" id
="radio_field_where_after" value
="after" /><?php
544 $fieldOptions = '</label><select name="after_field" style="vertical-align: middle" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">';
545 foreach ($aryFields AS $fieldname) {
546 $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
549 $fieldOptions .= '</select><label for="radio_field_where_after">';
550 echo str_replace('<label for="radio_field_where_after"></label>', '', '<label for="radio_field_where_after">' . sprintf($strAfter, $fieldOptions) . '</label>') . "\n";
552 <input type
="submit" value
="<?php echo $strGo; ?>" style
="vertical-align: middle" />
559 * If there are more than 20 rows, displays browse/select/insert/empty/drop
562 if ($fields_cnt > 20) {
563 require('./tbl_properties_links.php');
564 } // end if ($fields_cnt > 20)
570 echo '<div id="tablestatistics">' . "\n";
571 if ( ! $tbl_is_view && ! $db_is_information_schema ) {
572 define('PMA_IDX_INCLUDED', 1);
573 require ('./tbl_indexes.php');
576 * Displays Space usage and row statistics
578 // BEGIN - Calc Table Space - staybyte - 9 June 2001
579 // loic1, 22 feb. 2002: updated with patch from
580 // Joshua Nye <josh at boxcarmedia.com> to get valid
581 // statistics whatever is the table type
582 if ( $cfg['ShowStats'] ) {
584 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
585 if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
591 if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
594 list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
595 if ($mergetable == FALSE) {
596 list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
598 if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
599 list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
600 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] +
$showtable['Index_length'] - $showtable['Data_free']);
602 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] +
$showtable['Index_length']);
604 list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] +
$showtable['Index_length']);
605 if ($table_info_num_rows > 0) {
606 list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] +
$showtable['Index_length']) / $showtable['Rows'], 6, 1);
613 <a name
="showusage"></a
>
614 <?php
if ( ! $tbl_is_view && ! $db_is_information_schema ) { ?
>
615 <table id
="tablespaceusage" class="data">
616 <caption
class="tblHeaders"><?php
echo $strSpaceUsage; ?
></caption
>
619 <th
><?php
echo $strType; ?
></th
>
620 <th colspan
="2"><?php
echo $strUsage; ?
></th
>
624 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
625 <th
class="name"><?php
echo $strData; ?
></th
>
626 <td
class="value"><?php
echo $data_size; ?
></td
>
627 <td
class="unit"><?php
echo $data_unit; ?
></td
>
630 if ( isset( $index_size ) ) {
632 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
633 <th
class="name"><?php
echo $strIndex; ?
></th
>
634 <td
class="value"><?php
echo $index_size; ?
></td
>
635 <td
class="unit"><?php
echo $index_unit; ?
></td
>
639 if ( isset( $free_size ) ) {
641 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
642 <th
class="name"><?php
echo $strOverhead; ?
></th
>
643 <td
class="value"><?php
echo $free_size; ?
></td
>
644 <td
class="unit"><?php
echo $free_unit; ?
></td
>
646 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
647 <th
class="name"><?php
echo $strEffective; ?
></th
>
648 <td
class="value"><?php
echo $effect_size; ?
></td
>
649 <td
class="unit"><?php
echo $effect_unit; ?
></td
>
653 if ( isset( $tot_size ) && $mergetable == FALSE ) {
655 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
656 <th
class="name"><?php
echo $strTotalUC; ?
></th
>
657 <td
class="value"><?php
echo $tot_size; ?
></td
>
658 <td
class="unit"><?php
echo $tot_unit; ?
></td
>
662 // Optimize link if overhead
663 if (isset($free_size) && ($tbl_type == 'MYISAM' ||
$tbl_type == 'BDB')) {
665 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
666 <td colspan
="3" align
="center">
667 <a href
="sql.php?<?php echo $url_query; ?>&pos=0&sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php
668 if ($cfg['PropertiesIconic']) {
669 echo '<img class="icon" src="' . $pmaThemeImage . 'b_tbloptimize.png" width="16" height="16" alt="' . $strOptimizeTable. '" />';
671 echo $strOptimizeTable;
684 <table id
="tablerowstats" class="data">
685 <caption
class="tblHeaders"><?php
echo $strRowsStatistic; ?
></caption
>
688 <th
><?php
echo $strStatement; ?
></th
>
689 <th
><?php
echo $strValue; ?
></th
>
694 if (isset($showtable['Row_format'])) {
696 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
697 <th
class="name"><?php
echo $strFormat; ?
></th
>
698 <td
class="value"><?php
699 if ($showtable['Row_format'] == 'Fixed') {
702 else if ($showtable['Row_format'] == 'Dynamic') {
706 echo $showtable['Row_format'];
712 if (PMA_MYSQL_INT_VERSION
>= 40100 && !empty($tbl_collation)) {
714 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
715 <th
class="name"><?php
echo $strCollation; ?
></th
>
716 <td
class="value"><?php
717 echo '<dfn title="' . PMA_getCollationDescr($tbl_collation) . '">' . $tbl_collation . '</dfn>';
722 if (!$is_innodb && isset($showtable['Rows'])) {
724 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
725 <th
class="name"><?php
echo $strRows; ?
></th
>
726 <td
class="value"><?php
echo PMA_formatNumber( $showtable['Rows'], 0 ); ?
></td
>
730 if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
732 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
733 <th
class="name"><?php
echo $strRowLength; ?
> ø
;</th
>
734 <td
class="value"><?php
echo PMA_formatNumber( $showtable['Avg_row_length'], 0 ); ?
></td
>
738 if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == FALSE) {
740 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
741 <th
class="name"><?php
echo $strRowSize; ?
> ø
;</th
>
742 <td
class="value"><?php
echo $avg_size . ' ' . $avg_unit; ?
></td
>
746 if (isset($showtable['Auto_increment'])) {
748 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
749 <th
class="name"><?php
echo $strNext; ?
> Autoindex
</th
>
750 <td
class="value"><?php
echo PMA_formatNumber( $showtable['Auto_increment'], 0 ); ?
></td
>
754 if (isset($showtable['Create_time'])) {
756 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
757 <th
class="name"><?php
echo $strStatCreateTime; ?
></th
>
758 <td
class="value"><?php
echo PMA_localisedDate(strtotime($showtable['Create_time'])); ?
></td
>
762 if (isset($showtable['Update_time'])) {
764 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
765 <th
class="name"><?php
echo $strStatUpdateTime; ?
></th
>
766 <td
class="value"><?php
echo PMA_localisedDate(strtotime($showtable['Update_time'])); ?
></td
>
770 if (isset($showtable['Check_time'])) {
772 <tr
class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
773 <th
class="name"><?php
echo $strStatCheckTime; ?
></th
>
774 <td
class="value"><?php
echo PMA_localisedDate(strtotime($showtable['Check_time'])); ?
></td
>
783 // END - Calc Table Space
784 echo '<div class="clearfloat"></div>' . "\n";
785 echo '</div>' . "\n";
788 * Displays the footer
790 require_once('./footer.inc.php');