remove control M
[phpmyadmin/crack.git] / tbl_properties_structure.php3
blob5aa90cb6ab2955582c66c0d8a9d355e35c477107
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 if (!defined('PMA_GRAB_GLOBALS_INCLUDED')) {
6 include('./libraries/grab_globals.lib.php3');
8 if (!defined('PMA_COMMON_LIB_INCLUDED')) {
9 include('./libraries/common.lib.php3');
11 if (PMA_MYSQL_INT_VERSION >= 40100 && !defined('PMA_MYSQL_CHARSETS_LIB_INCLUDED')) {
12 include('./libraries/mysql_charsets.lib.php3');
15 /**
16 * Drop multiple fields if required
19 // workaround for IE problem:
20 if (isset($submit_mult_change_x)) {
21 $submit_mult = $strChange;
23 if (isset($submit_mult_drop_x)) {
24 $submit_mult = $strDrop;
27 if ((!empty($submit_mult) && isset($selected_fld))
28 || isset($mult_btn)) {
29 $action = 'tbl_properties_structure.php3';
30 $err_url = 'tbl_properties_structure.php3?' . PMA_generate_common_url($db, $table);
31 include('./mult_submits.inc.php3');
34 /**
35 * Runs common work
37 require('./tbl_properties_common.php3');
38 $url_query .= '&amp;goto=tbl_properties_structure.php3&amp;back=tbl_properties_structure.php3';
40 /**
41 * Prepares the table structure display
43 // 1. Get table information/display tabs
44 require('./tbl_properties_table_info.php3');
46 /**
47 * Show result of multi submit operation
49 if ((!empty($submit_mult) && isset($selected_fld))
50 || isset($mult_btn)) {
51 PMA_showMessage($strSuccess);
54 // 2. Gets table keys and retains them
55 $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
56 $result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
57 $primary = '';
58 $ret_keys = array();
59 $pk_array = array(); // will be use to emphasis prim. keys in the table view
60 while ($row = PMA_mysql_fetch_array($result)) {
61 $ret_keys[] = $row;
62 // Backups the list of primary keys
63 if ($row['Key_name'] == 'PRIMARY') {
64 $primary .= $row['Column_name'] . ', ';
65 $pk_array[$row['Column_name']] = 1;
67 } // end while
68 mysql_free_result($result);
70 // 3. Get fields
71 $local_query = 'SHOW FIELDS FROM ' . PMA_backquote($table);
72 $fields_rs = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
73 $fields_cnt = mysql_num_rows($fields_rs);
77 /**
78 * Displays the table structure ('show table' works correct since 3.23.03)
82 <!-- TABLE INFORMATIONS -->
84 <form method="post" action="tbl_properties_structure.php3" name="fieldsForm">
85 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
87 <table border="<?php echo $cfg['Border']; ?>">
88 <tr>
89 <td></td>
90 <th>&nbsp;<?php echo $strField; ?>&nbsp;</th>
91 <th><?php echo $strType; ?></th>
92 <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <th>' . $strCharset . '</th>' . "\n" : ''; ?>
93 <th><?php echo $strAttr; ?></th>
94 <th><?php echo $strNull; ?></th>
95 <th><?php echo $strDefault; ?></th>
96 <th><?php echo $strExtra; ?></th>
97 <th colspan="<?php echo((PMA_MYSQL_INT_VERSION >= 32323) ? '6' : '5'); ?>"><?php echo $strAction; ?></th>
98 </tr>
100 <?php
101 $comments_map = array();
102 $mime_map = array();
104 if ($GLOBALS['cfg']['ShowPropertyComments']) {
105 require('./libraries/relation.lib.php3');
106 require('./libraries/transformations.lib.php3');
108 $cfgRelation = PMA_getRelationsParam();
111 if ($cfgRelation['commwork']) {
112 $comments_map = PMA_getComments($db, $table);
114 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
115 $mime_map = PMA_getMIME($db, $table, true);
120 $i = 0;
121 $aryFields = array();
122 $checked = (!empty($checkall) ? ' checked="checked"' : '');
124 while ($row = PMA_mysql_fetch_array($fields_rs)) {
125 $i++;
126 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
127 $aryFields[] = $row['Field'];
129 $type = $row['Type'];
130 // reformat mysql query output - staybyte - 9. June 2001
131 // loic1: set or enum types: slashes single quotes inside options
132 if (eregi('^(set|enum)\((.+)\)$', $type, $tmp)) {
133 $tmp[2] = substr(ereg_replace('([^,])\'\'', '\\1\\\'', ',' . $tmp[2]), 1);
134 $type = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
135 $type_nowrap = '';
137 $binary = 0;
138 $unsigned = 0;
139 $zerofill = 0;
140 } else {
141 $type_nowrap = ' nowrap="nowrap"';
142 $type = eregi_replace('BINARY', '', $type);
143 $type = eregi_replace('ZEROFILL', '', $type);
144 $type = eregi_replace('UNSIGNED', '', $type);
145 if (empty($type)) {
146 $type = '&nbsp;';
149 $binary = eregi('BLOB', $row['Type'], $test) || eregi('BINARY', $row['Type'], $test);
150 $unsigned = eregi('UNSIGNED', $row['Type'], $test);
151 $zerofill = eregi('ZEROFILL', $row['Type'], $test);
154 // rabus: Devide charset from the rest of the type definition (MySQL >= 4.1)
155 unset($field_charset);
156 if (PMA_MYSQL_INT_VERSION >= 40100) {
157 if ((substr($type, 0, 4) == 'char'
158 || substr($type, 0, 7) == 'varchar'
159 || substr($type, 0, 4) == 'text'
160 || substr($type, 0, 8) == 'tinytext'
161 || substr($type, 0, 10) == 'mediumtext'
162 || substr($type, 0, 8) == 'longtext'
163 || substr($type, 0, 3) == 'set'
164 || substr($type, 0, 4) == 'enum'
165 ) && !$binary) {
166 if (strpos($type, ' character set ')) {
167 $type = substr($type, 0, strpos($type, ' character set '));
169 if (!empty($row['Collation'])) {
170 $field_charset = $row['Collation'];
171 } else {
172 $field_charset = '';
174 } else {
175 $field_charset = '';
179 // garvin: Display basic mimetype [MIME]
180 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) {
181 $type_mime = '<br />MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
182 } else {
183 $type_mime = '';
186 $strAttribute = '&nbsp;';
187 if ($binary) {
188 $strAttribute = 'BINARY';
190 if ($unsigned) {
191 $strAttribute = 'UNSIGNED';
193 if ($zerofill) {
194 $strAttribute = 'UNSIGNED ZEROFILL';
196 if (!isset($row['Default'])) {
197 if ($row['Null'] != '') {
198 $row['Default'] = '<i>NULL</i>';
200 } else {
201 $row['Default'] = htmlspecialchars($row['Default']);
204 $field_encoded = urlencode($row['Field']);
205 $field_name = htmlspecialchars($row['Field']);
207 // garvin: underline commented fields and display a hover-title (CSS only)
209 $comment_style = '';
210 if (isset($comments_map[$row['Field']])) {
211 $field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
214 if (isset($pk_array[$row['Field']])) {
215 $field_name = '<u>' . $field_name . '</u>';
217 echo "\n";
219 $titles = array();
220 if ($cfg['PropertiesIconic'] == true) {
221 // We need to copy the value or else the == 'both' check will always return true
222 $propicon = (string)$cfg['PropertiesIconic'];
224 if ($propicon == 'both') {
225 $iconic_spacer = '<nobr>';
226 } else {
227 $iconic_spacer = '';
230 $titles['Change'] = $iconic_spacer . '<img hspace="7" width="12" height="13" src="images/button_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
231 $titles['Drop'] = $iconic_spacer . '<img hspace="7" width="11" height="12" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
232 $titles['NoDrop'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
233 $titles['Primary'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
234 $titles['Index'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
235 $titles['Unique'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
236 $titles['IdxFulltext'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_fulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
237 $titles['NoPrimary'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noprimary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
238 $titles['NoIndex'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noindex.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
239 $titles['NoUnique'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nounique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
240 $titles['NoIdxFulltext'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nofulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
242 if ($propicon == 'both') {
243 $titles['Change'] .= '&nbsp;' . $strChange . '</nobr>';
244 $titles['Drop'] .= '&nbsp;' . $strDrop . '</nobr>';
245 $titles['NoDrop'] .= '&nbsp;' . $strDrop . '</nobr>';
246 $titles['Primary'] .= '&nbsp;' . $strPrimary . '</nobr>';
247 $titles['Index'] .= '&nbsp;' . $strIndex . '</nobr>';
248 $titles['Unique'] .= '&nbsp;' . $strUnique . '</nobr>';
249 $titles['IdxFulltext' ] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
250 $titles['NoPrimary'] .= '&nbsp;' . $strPrimary . '</nobr>';
251 $titles['NoIndex'] .= '&nbsp;' . $strIndex . '</nobr>';
252 $titles['NoUnique'] .= '&nbsp;' . $strUnique . '</nobr>';
253 $titles['NoIdxFulltext'] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
255 } else {
256 $titles['Change'] = $strChange;
257 $titles['Drop'] = $strDrop;
258 $titles['NoDrop'] = $strDrop;
259 $titles['Primary'] = $strPrimary;
260 $titles['Index'] = $strIndex;
261 $titles['Unique'] = $strUnique;
262 $titles['IdxFulltext'] = $strIdxFulltext;
263 $titles['NoPrimary'] = $strPrimary;
264 $titles['NoIndex'] = $strIndex;
265 $titles['NoUnique'] = $strUnique;
266 $titles['NoIdxFulltext'] = $strIdxFulltext;
270 <tr>
271 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
272 <input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
273 </td>
274 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
275 <td bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
276 <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td bgcolor="' . $bgcolor . '">' . (empty($field_charset) ? '&nbsp;' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
277 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>
278 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
279 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
280 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
281 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
282 <a href="tbl_alter.php3?<?php echo $url_query; ?>&amp;field=<?php echo $field_encoded; ?>">
283 <?php echo $titles['Change']; ?></a>
284 </td>
285 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
286 <?php
287 // loic1: Drop field only if there is more than one field in the table
288 if ($fields_cnt > 1) {
289 echo "\n";
291 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&amp;cpurge=1&amp;purgekey=<?php echo urlencode($row['Field']); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strFieldHasBeenDropped, htmlspecialchars($row['Field']))); ?>"
292 onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
293 <?php echo $titles['Drop']; ?></a>
294 <?php
295 } else {
296 echo "\n" . ' ' . $titles['NoDrop'];
298 echo "\n";
300 </td>
301 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
302 <?php
303 if ($type == 'text' || $type == 'blob') {
304 echo $titles['NoPrimary'] . "\n";
305 } else {
306 echo "\n";
308 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP PRIMARY KEY, ADD PRIMARY KEY(' . $primary . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
309 onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP PRIMARY KEY, ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
310 <?php echo $titles['Primary']; ?></a>
311 <?php
313 echo "\n";
315 </td>
316 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
317 <?php
318 if ($type == 'text' || $type == 'blob') {
319 echo $titles['NoIndex'] . "\n";
320 } else {
321 echo "\n";
323 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex ,htmlspecialchars($row['Field']))); ?>">
324 <?php echo $titles['Index']; ?></a>
325 <?php
327 echo "\n";
329 </td>
330 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
331 <?php
332 if ($type == 'text' || $type == 'blob') {
333 echo $titles['NoUnique'] . "\n";
334 } else {
335 echo "\n";
337 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
338 <?php echo $titles['Unique']; ?></a>
339 <?php
341 echo "\n";
343 </td>
344 <?php
345 if (PMA_MYSQL_INT_VERSION >= 32323) {
346 if ((!empty($tbl_type) && $tbl_type == 'MYISAM')
347 && ($type == 'text' || strpos(' ' . $type, 'varchar'))) {
348 echo "\n";
350 <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
351 <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAnIndex , htmlspecialchars($row['Field']))); ?>">
352 <?php echo $titles['IdxFulltext']; ?></a>
353 </td>
354 <?php
355 } else {
356 echo "\n";
358 <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
359 <?php echo $titles['NoIdxFulltext'] . "\n"; ?>
360 </td>
361 <?php
362 } // end if... else...
363 } // end if
364 echo "\n"
366 </tr>
367 <?php
368 unset($field_charset);
369 } // end while
371 echo "\n";
373 $checkall_url = 'tbl_properties_structure.php3?' . PMA_generate_common_url($db,$table);
376 <tr>
377 <td colspan="<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '14' : (PMA_MYSQL_INT_VERSION >= 32323 ? '13' : '12'); ?>">
378 <table>
379 <tr>
380 <td>
381 <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
382 <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('fieldsForm', true); return false;">
383 <?php echo $strCheckAll; ?></a>
384 &nbsp;/&nbsp;
385 <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('fieldsForm', false); return false;">
386 <?php echo $strUncheckAll; ?></a>
387 &nbsp;&nbsp;&nbsp;
388 <i><?php echo $strWithChecked; ?></i>&nbsp;&nbsp;
389 </td>
390 <td>
391 <?php
393 if ($cfg['PropertiesIconic']) {
394 /* Opera has trouble with <input type="image"> */
395 /* IE has trouble with <button> */
396 if (PMA_USR_BROWSER_AGENT != 'IE') {
397 echo '<button class="mult_submit" type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '">' . "\n"
398 . '<img src="./images/button_edit.png" title="' . $strChange . '" alt="' . $strChange . '" width="12" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n"
399 . '</button>' . "\n";
400 } else {
401 echo ' <input type="image" name="submit_mult_change" value="' .$strChange . '" title="' . $strChange . '" src="./images/button_edit.png" />' . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n";
403 // Drop button if there is at least two fields
404 if ($fields_cnt > 1) {
405 if (PMA_USR_BROWSER_AGENT != 'IE') {
406 echo ' <button class="mult_submit" type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '">' . "\n"
407 . '<img src="./images/button_drop.png" title="' . $strDrop . '" alt="' . $strDrop . '" width="11" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n"
408 . '</button>' . "\n";
409 } else {
410 echo ' <input type="image" name="submit_mult_drop" value="' .$strDrop . '" title="' . $strDrop . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n";
413 } else {
414 echo ' <input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
415 // Drop button if there is at least two fields
416 if ($fields_cnt > 1) {
417 echo ' &nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
418 . ' <input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
423 </td>
424 </tr>
425 </table>
426 </td>
427 </tr>
428 </table>
430 </form>
433 <?php
435 * If there are more than 20 rows, displays browse/select/insert/empty/drop
436 * links again
438 if ($fields_cnt > 20) {
440 <!-- Browse links -->
441 <?php
442 echo "\n";
443 include('./tbl_properties_links.php3');
444 } // end if ($fields_cnt > 20)
445 echo "\n\n";
449 * Displays indexes
452 <!-- Indexes, space usage and row statistics -->
453 <br />
454 <table border="0" cellspacing="0" cellpadding="0">
455 <tr>
456 <td valign="top">
457 <?php
458 define('PMA_IDX_INCLUDED', 1);
459 require ('./tbl_indexes.php3');
461 </td>
463 <?php
465 * Displays Space usage and row statistics
467 // BEGIN - Calc Table Space - staybyte - 9 June 2001
468 // loic1, 22 feb. 2002: updated with patch from
469 // Joshua Nye <josh at boxcarmedia.com> to get valid
470 // statistics whatever is the table type
471 if ($cfg['ShowStats']) {
472 $nonisam = FALSE;
473 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
474 if (isset($showtable['Type']) && !eregi('ISAM|HEAP', $showtable['Type'])) {
475 $nonisam = TRUE;
477 if (PMA_MYSQL_INT_VERSION >= 32303 && ($nonisam == FALSE || $is_innodb)) {
478 // Gets some sizes
479 $mergetable = FALSE;
480 if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
481 $mergetable = TRUE;
483 list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length']);
484 if ($mergetable == FALSE) {
485 list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length']);
487 if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
488 list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free']);
489 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
490 } else {
491 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
493 list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
494 if ($table_info_num_rows > 0) {
495 list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
498 // Displays them
501 <!-- Space usage -->
502 <td width="20">&nbsp;</td>
503 <td valign="top">
504 <?php echo $strSpaceUsage . '&nbsp;:' . "\n"; ?>
505 <a name="showusage"></a>
506 <table border="<?php echo $cfg['Border']; ?>">
507 <tr>
508 <th><?php echo $strType; ?></th>
509 <th colspan="2" align="center"><?php echo $strUsage; ?></th>
510 </tr>
511 <tr>
512 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strData; ?></td>
513 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $data_size; ?></td>
514 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $data_unit; ?></td>
515 </tr>
516 <?php
517 if (isset($index_size)) {
518 echo "\n";
520 <tr>
521 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strIndex; ?></td>
522 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $index_size; ?></td>
523 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $index_unit; ?></td>
524 </tr>
525 <?php
527 if (isset($free_size)) {
528 echo "\n";
530 <tr style="color: #bb0000">
531 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strOverhead; ?></td>
532 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $free_size; ?></td>
533 <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $free_unit; ?></td>
534 </tr>
535 <tr>
536 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strEffective; ?></td>
537 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $effect_size; ?></td>
538 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $effect_unit; ?></td>
539 </tr>
540 <?php
542 if (isset($tot_size) && $mergetable == FALSE) {
543 echo "\n";
545 <tr>
546 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strTotalUC; ?></td>
547 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $tot_size; ?></td>
548 <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $tot_unit; ?></td>
549 </tr>
550 <?php
552 // Optimize link if overhead
553 if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
554 echo "\n";
556 <tr>
557 <td colspan="3" align="center">
558 [<a href="sql.php3?<?php echo $url_query; ?>&amp;pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
559 </td>
560 </tr>
561 <?php
563 echo "\n";
565 </table>
566 </td>
568 <!-- Rows Statistic -->
569 <td width="20">&nbsp;</td>
570 <td valign="top">
571 <?php echo $strRowsStatistic . '&nbsp;:' . "\n"; ?>
572 <table border="<?php echo $cfg['Border']; ?>">
573 <tr>
574 <th><?php echo $strStatement; ?></th>
575 <th align="center"><?php echo $strValue; ?></th>
576 </tr>
577 <?php
578 $i = 0;
579 if (isset($showtable['Row_format'])) {
580 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
581 echo "\n";
583 <tr>
584 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strFormat; ?></td>
585 <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
586 <?php
587 echo ' ';
588 if ($showtable['Row_format'] == 'Fixed') {
589 echo $strFixed;
591 else if ($showtable['Row_format'] == 'Dynamic') {
592 echo $strDynamic;
594 else {
595 echo $showtable['Row_format'];
597 echo "\n";
599 </td>
600 </tr>
601 <?php
603 if (PMA_MYSQL_INT_VERSION >= 40100) {
604 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
606 <tr>
607 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCharset; ?></td>
608 <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
609 <?php
610 echo '<dfn title="' . PMA_getCollationDescr($tbl_charset) . '">' . $tbl_charset . '</dfn>';
612 </td>
613 </tr>
614 <?php
616 if (!$is_innodb && isset($showtable['Rows'])) {
617 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
618 echo "\n";
620 <tr>
621 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRows; ?></td>
622 <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
623 <?php echo number_format($showtable['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
624 </td>
625 </tr>
626 <?php
628 if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
629 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
630 echo "\n";
632 <tr>
633 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowLength; ?>&nbsp;&oslash;</td>
634 <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
635 <?php echo number_format($showtable['Avg_row_length'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
636 </td>
637 </tr>
638 <?php
640 if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == FALSE) {
641 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
642 echo "\n";
644 <tr>
645 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowSize; ?>&nbsp;&oslash;</td>
646 <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
647 <?php echo $avg_size . ' ' . $avg_unit . "\n"; ?>
648 </td>
649 </tr>
650 <?php
652 if (isset($showtable['Auto_increment'])) {
653 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
654 echo "\n";
656 <tr>
657 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strNext; ?>&nbsp;Autoindex</td>
658 <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
659 <?php echo number_format($showtable['Auto_increment'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
660 </td>
661 </tr>
662 <?php
664 echo "\n";
666 if (isset($showtable['Create_time'])) {
667 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
668 echo "\n";
670 <tr>
671 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCreateTime; ?></td>
672 <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
673 <?php echo PMA_localisedDate(strtotime($showtable['Create_time'])) . "\n"; ?>
674 </td>
675 </tr>
676 <?php
678 echo "\n";
680 if (isset($showtable['Update_time'])) {
681 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
682 echo "\n";
684 <tr>
685 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatUpdateTime; ?></td>
686 <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
687 <?php echo PMA_localisedDate(strtotime($showtable['Update_time'])) . "\n"; ?>
688 </td>
689 </tr>
690 <?php
692 echo "\n";
694 if (isset($showtable['Check_time'])) {
695 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
696 echo "\n";
698 <tr>
699 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCheckTime; ?></td>
700 <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
701 <?php echo PMA_localisedDate(strtotime($showtable['Check_time'])) . "\n"; ?>
702 </td>
703 </tr>
704 <?php
706 echo "\n";
708 </table>
709 </td>
710 <?php
713 // END - Calc Table Space
714 echo "\n";
716 </tr>
717 </table>
718 <hr />
721 <?php
723 * Work on the table
726 <!-- TABLE WORK -->
727 <ul>
729 <!-- Printable view of the table -->
730 <li>
731 <div style="margin-bottom: 10px"><a href="tbl_printview.php3?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
732 </li>
734 <!-- Add some new fields -->
735 <li>
736 <form method="post" action="tbl_addfield.php3"
737 onsubmit="return checkFormElementInRange(this, 'num_fields', 1)">
738 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
739 <?php echo $strAddNewField; ?>&nbsp;:
740 <input type="text" name="num_fields" size="2" maxlength="2" value="1" class="textfield" style="vertical-align: middle" onfocus="this.select()" />
741 <select name="after_field" style="vertical-align: middle">
742 <option value="--end--"><?php echo $strAtEndOfTable; ?></option>
743 <option value="--first--"><?php echo $strAtBeginningOfTable; ?></option>
744 <?php
745 reset($aryFields);
746 while (list($junk, $fieldname) = each($aryFields)) {
747 echo ' <option value="' . htmlspecialchars($fieldname) . '">' . sprintf($strAfter, htmlspecialchars($fieldname)) . '</option>' . "\n";
749 unset($aryFields);
751 </select>
752 <input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
753 </form>
754 </li>
756 <?php
757 if ($cfg['Server']['relation']) {
759 <!-- Work on Relations -->
760 <li>
761 <div style="margin-bottom: 10px">
762 <a href="tbl_relation.php3?<?php echo $url_query; ?>"><?php echo $strRelationView; ?></a>
763 </div>
764 </li>
765 <?php
767 echo "\n";
770 <!-- Let MySQL propose the optimal structure -->
771 <li>
772 <div style="margin-bottom: 10px">
773 <a href="sql.php3?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>">
774 <?php echo $strStructPropose; ?></a>
775 <?php echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n"; ?>
776 </div>
777 </li>
779 <?php
781 * Query box, bookmark, insert data from textfile
783 $goto = 'tbl_properties_structure.php3';
784 require('./tbl_query_box.php3');
787 </ul>
790 <?php
792 * Displays the footer
794 echo "\n";
795 require('./footer.inc.php3');