Documentation TYPO3 par Ameos

tbl_properties_structure.php

00001 <?php
00002 /* $Id: tbl_properties_structure.php,v 2.3 2003/12/29 17:15:14 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 require_once('./libraries/grab_globals.lib.php');
00006 require_once('./libraries/common.lib.php');
00007 require_once('./libraries/mysql_charsets.lib.php');
00008 
00013 // workaround for IE problem:
00014 if (isset($submit_mult_change_x)) {
00015     $submit_mult = $strChange;
00016 }
00017 if (isset($submit_mult_drop_x)) {
00018     $submit_mult = $strDrop;
00019 }
00020 
00021 if ((!empty($submit_mult) && isset($selected_fld))
00022     || isset($mult_btn)) {
00023     $action = 'tbl_properties_structure.php';
00024     $err_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db, $table);
00025     require('./mult_submits.inc.php');
00026 }
00027 
00031 require('./tbl_properties_common.php');
00032 $url_query .= '&amp;goto=tbl_properties_structure.php&amp;back=tbl_properties_structure.php';
00033 
00037 // 1. Get table information/display tabs
00038 require('./tbl_properties_table_info.php');
00039 
00043 if ((!empty($submit_mult) && isset($selected_fld))
00044     || isset($mult_btn)) {
00045     PMA_showMessage($strSuccess);
00046 }
00047 
00048 // 2. Gets table keys and retains them
00049 $local_query = 'SHOW KEYS FROM ' . PMA_backquote($table);
00050 $result      = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
00051 $primary     = '';
00052 $ret_keys    = array();
00053 $pk_array    = array(); // will be use to emphasis prim. keys in the table view
00054 while ($row = PMA_mysql_fetch_array($result)) {
00055     $ret_keys[]  = $row;
00056     // Backups the list of primary keys
00057     if ($row['Key_name'] == 'PRIMARY') {
00058         $primary .= $row['Column_name'] . ', ';
00059         $pk_array[$row['Column_name']] = 1;
00060     }
00061 } // end while
00062 mysql_free_result($result);
00063 
00064 // 3. Get fields
00065 $local_query = 'SHOW FULL FIELDS FROM ' . PMA_backquote($table);
00066 $fields_rs   = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
00067 $fields_cnt  = mysql_num_rows($fields_rs);
00068 
00069 
00070 
00074 ?>
00075 
00076 <!-- TABLE INFORMATION -->
00077 
00078 <form method="post" action="tbl_properties_structure.php" name="fieldsForm">
00079     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00080 
00081 <table border="<?php echo $cfg['Border']; ?>">
00082 <tr>
00083     <td></td>
00084     <th>&nbsp;<?php echo $strField; ?>&nbsp;</th>
00085     <th><?php echo $strType; ?></th>
00086 <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <th>' . $strCollation . '</th>' . "\n" : ''; ?>
00087     <th><?php echo $strAttr; ?></th>
00088     <th><?php echo $strNull; ?></th>
00089     <th><?php echo $strDefault; ?></th>
00090     <th><?php echo $strExtra; ?></th>
00091     <th colspan="6"><?php echo $strAction; ?></th>
00092 </tr>
00093 
00094 <?php
00095 $comments_map = array();
00096 $mime_map = array();
00097 
00098 if ($GLOBALS['cfg']['ShowPropertyComments']) {
00099     require_once('./libraries/relation.lib.php');
00100     require_once('./libraries/transformations.lib.php');
00101 
00102     $cfgRelation = PMA_getRelationsParam();
00103 
00104 
00105     if ($cfgRelation['commwork']) {
00106         $comments_map = PMA_getComments($db, $table);
00107 
00108         if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
00109             $mime_map = PMA_getMIME($db, $table, true);
00110         }
00111     }
00112 }
00113 
00114 $i         = 0;
00115 $aryFields = array();
00116 $checked   = (!empty($checkall) ? ' checked="checked"' : '');
00117 
00118 while ($row = PMA_mysql_fetch_array($fields_rs)) {
00119     $i++;
00120     $bgcolor          = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00121     $aryFields[]      = $row['Field'];
00122 
00123     $type             = $row['Type'];
00124     // reformat mysql query output - staybyte - 9. June 2001
00125     // loic1: set or enum types: slashes single quotes inside options
00126     if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
00127         $tmp[2]       = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
00128         $type         = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
00129         $type_nowrap  = '';
00130 
00131         $binary       = 0;
00132         $unsigned     = 0;
00133         $zerofill     = 0;
00134     } else {
00135         $type_nowrap  = ' nowrap="nowrap"';
00136         $type         = preg_replace('@BINARY@i', '', $type);
00137         $type         = preg_replace('@ZEROFILL@i', '', $type);
00138         $type         = preg_replace('@UNSIGNED@i', '', $type);
00139         if (empty($type)) {
00140             $type     = '&nbsp;';
00141         }
00142 
00143         $binary       = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');
00144         $unsigned     = stristr($row['Type'], 'unsigned');
00145         $zerofill     = stristr($row['Type'], 'zerofill');
00146     }
00147 
00148     // rabus: Devide charset from the rest of the type definition (MySQL >= 4.1)
00149     unset($field_charset);
00150     if (PMA_MYSQL_INT_VERSION >= 40100) {
00151         if ((substr($type, 0, 4) == 'char'
00152             || substr($type, 0, 7) == 'varchar'
00153             || substr($type, 0, 4) == 'text'
00154             || substr($type, 0, 8) == 'tinytext'
00155             || substr($type, 0, 10) == 'mediumtext'
00156             || substr($type, 0, 8) == 'longtext'
00157             || substr($type, 0, 3) == 'set'
00158             || substr($type, 0, 4) == 'enum'
00159             ) && !$binary) {
00160             if (strpos($type, ' character set ')) {
00161                 $type = substr($type, 0, strpos($type, ' character set '));
00162             }
00163             if (!empty($row['Collation'])) {
00164                 $field_charset = $row['Collation'];
00165             } else {
00166                 $field_charset = '';
00167             }
00168         } else {
00169             $field_charset = '';
00170         }
00171     }
00172 
00173     // garvin: Display basic mimetype [MIME]
00174     if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) {
00175         $type_mime = '<br />MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
00176     } else {
00177         $type_mime = '';
00178     }
00179 
00180     $strAttribute     = '&nbsp;';
00181     if ($binary) {
00182         $strAttribute = 'BINARY';
00183     }
00184     if ($unsigned) {
00185         $strAttribute = 'UNSIGNED';
00186     }
00187     if ($zerofill) {
00188         $strAttribute = 'UNSIGNED ZEROFILL';
00189     }
00190     if (!isset($row['Default'])) {
00191         if ($row['Null'] != '') {
00192             $row['Default'] = '<i>NULL</i>';
00193         }
00194     } else {
00195         $row['Default'] = htmlspecialchars($row['Default']);
00196     }
00197 
00198     $field_encoded = urlencode($row['Field']);
00199     $field_name    = htmlspecialchars($row['Field']);
00200 
00201     // garvin: underline commented fields and display a hover-title (CSS only)
00202 
00203     $comment_style = '';
00204     if (isset($comments_map[$row['Field']])) {
00205         $field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
00206     }
00207 
00208     if (isset($pk_array[$row['Field']])) {
00209         $field_name = '<u>' . $field_name . '</u>';
00210     }
00211     echo "\n";
00212 
00213     $titles = array();
00214     if ($cfg['PropertiesIconic'] == true) {
00215         // We need to copy the value or else the == 'both' check will always return true
00216         $propicon = (string)$cfg['PropertiesIconic'];
00217 
00218         if ($propicon == 'both') {
00219             $iconic_spacer = '<nobr>';
00220         } else {
00221             $iconic_spacer = '';
00222         }
00223 
00224         $titles['Change']        = $iconic_spacer . '<img hspace="7" width="12" height="13" src="images/button_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
00225         $titles['Drop']          = $iconic_spacer . '<img hspace="7" width="11" height="12" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
00226         $titles['NoDrop']        = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
00227         $titles['Primary']       = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
00228         $titles['Index']         = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
00229         $titles['Unique']        = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
00230         $titles['IdxFulltext']   = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_fulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
00231         $titles['NoPrimary']     = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noprimary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
00232         $titles['NoIndex']       = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_noindex.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
00233         $titles['NoUnique']      = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nounique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
00234         $titles['NoIdxFulltext'] = $iconic_spacer . '<img hspace="7" width="11" height="13" src="images/button_nofulltext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
00235 
00236         if ($propicon == 'both') {
00237             $titles['Change']        .= '&nbsp;' . $strChange . '</nobr>';
00238             $titles['Drop']          .= '&nbsp;' . $strDrop . '</nobr>';
00239             $titles['NoDrop']        .= '&nbsp;' . $strDrop . '</nobr>';
00240             $titles['Primary']       .= '&nbsp;' . $strPrimary . '</nobr>';
00241             $titles['Index']         .= '&nbsp;' . $strIndex . '</nobr>';
00242             $titles['Unique']        .= '&nbsp;' . $strUnique . '</nobr>';
00243             $titles['IdxFulltext'  ] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
00244             $titles['NoPrimary']     .= '&nbsp;' . $strPrimary . '</nobr>';
00245             $titles['NoIndex']       .= '&nbsp;' . $strIndex . '</nobr>';
00246             $titles['NoUnique']      .= '&nbsp;' . $strUnique . '</nobr>';
00247             $titles['NoIdxFulltext'] .= '&nbsp;' . $strIdxFulltext . '</nobr>';
00248         }
00249     } else {
00250         $titles['Change']        = $strChange;
00251         $titles['Drop']          = $strDrop;
00252         $titles['NoDrop']        = $strDrop;
00253         $titles['Primary']       = $strPrimary;
00254         $titles['Index']         = $strIndex;
00255         $titles['Unique']        = $strUnique;
00256         $titles['IdxFulltext']   = $strIdxFulltext;
00257         $titles['NoPrimary']     = $strPrimary;
00258         $titles['NoIndex']       = $strIndex;
00259         $titles['NoUnique']      = $strUnique;
00260         $titles['NoIdxFulltext'] = $strIdxFulltext;
00261     }
00262 
00263     ?>
00264 <tr>
00265     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00266         <input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
00267     </td>
00268     <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
00269     <td bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
00270 <?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" : '' ?>
00271     <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $strAttribute; ?></td>
00272     <td bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?>&nbsp;</td>
00273     <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
00274     <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
00275     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00276         <a href="tbl_alter.php?<?php echo $url_query; ?>&amp;field=<?php echo $field_encoded; ?>">
00277             <?php echo $titles['Change']; ?></a>
00278     </td>
00279     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00280         <?php
00281         // loic1: Drop field only if there is more than one field in the table
00282         if ($fields_cnt > 1) {
00283             echo "\n";
00284             ?>
00285         <a href="sql.php?<?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']))); ?>"
00286             onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
00287             <?php echo $titles['Drop']; ?></a>
00288             <?php
00289         } else {
00290             echo "\n" . '        ' . $titles['NoDrop'];
00291         }
00292         echo "\n";
00293         ?>
00294     </td>
00295     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00296         <?php
00297         if ($type == 'text' || $type == 'blob') {
00298             echo $titles['NoPrimary'] . "\n";
00299         } else {
00300             echo "\n";
00301             ?>
00302         <a href="sql.php?<?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']))); ?>"
00303             onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP PRIMARY KEY, ADD PRIMARY KEY(<?php echo PMA_jsFormat($row['Field']); ?>)')">
00304             <?php echo $titles['Primary']; ?></a>
00305             <?php
00306         }
00307         echo "\n";
00308         ?>
00309     </td>
00310     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00311         <?php
00312         if ($type == 'text' || $type == 'blob') {
00313             echo $titles['NoIndex'] . "\n";
00314         } else {
00315             echo "\n";
00316             ?>
00317         <a href="sql.php?<?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']))); ?>">
00318             <?php echo $titles['Index']; ?></a>
00319             <?php
00320         }
00321         echo "\n";
00322         ?>
00323     </td>
00324     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00325         <?php
00326         if ($type == 'text' || $type == 'blob') {
00327             echo $titles['NoUnique'] . "\n";
00328         } else {
00329             echo "\n";
00330             ?>
00331         <a href="sql.php?<?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']))); ?>">
00332             <?php echo $titles['Unique']; ?></a>
00333             <?php
00334         }
00335         echo "\n";
00336         ?>
00337     </td>
00338     <?php
00339         if ((!empty($tbl_type) && $tbl_type == 'MYISAM')
00340             && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'varchar'))) {
00341             echo "\n";
00342             ?>
00343     <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00344         <a href="sql.php?<?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']))); ?>">
00345             <?php echo $titles['IdxFulltext']; ?></a>
00346     </td>
00347             <?php
00348         } else {
00349             echo "\n";
00350         ?>
00351     <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00352         <?php echo $titles['NoIdxFulltext'] . "\n"; ?>
00353     </td>
00354         <?php
00355         } // end if... else...
00356     echo "\n"
00357     ?>
00358 </tr>
00359     <?php
00360     unset($field_charset);
00361 } // end while
00362 
00363 echo "\n";
00364 
00365 $checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
00366 ?>
00367 
00368 <tr>
00369     <td colspan="<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '14' : '13'; ?>">
00370         <table>
00371             <tr>
00372                 <td>
00373                     <img src="./images/arrow_<?php echo $text_dir; ?>.gif" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
00374         <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('fieldsForm', true); return false;">
00375             <?php echo $strCheckAll; ?></a>
00376         &nbsp;/&nbsp;
00377         <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('fieldsForm', false); return false;">
00378             <?php echo $strUncheckAll; ?></a>
00379         &nbsp;&nbsp;&nbsp;
00380         <i><?php echo $strWithChecked; ?></i>&nbsp;&nbsp;
00381                 </td>
00382                 <td>
00383                     <?php
00384 
00385 if ($cfg['PropertiesIconic']) {
00386     /* Opera has trouble with <input type="image"> */
00387     /* IE has trouble with <button> */
00388     if (PMA_USR_BROWSER_AGENT != 'IE') {
00389         echo '<button class="mult_submit" type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '">' . "\n"
00390            . '<img src="./images/button_edit.png" title="' . $strChange . '" alt="' . $strChange . '" width="12" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n"
00391            . '</button>' . "\n";
00392     } else {
00393         echo '                    <input type="image" name="submit_mult_change" value="' .$strChange . '" title="' . $strChange . '" src="./images/button_edit.png" />'  . (($propicon == 'both') ? '&nbsp;' . $strChange : '') . "\n";
00394     }
00395     // Drop button if there is at least two fields
00396     if ($fields_cnt > 1) {
00397         if (PMA_USR_BROWSER_AGENT != 'IE') {
00398             echo '                    <button class="mult_submit" type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '">' . "\n"
00399                . '<img src="./images/button_drop.png" title="' . $strDrop . '" alt="' . $strDrop . '" width="11" height="13" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n"
00400                . '</button>' . "\n";
00401         } else {
00402             echo '                    <input type="image" name="submit_mult_drop" value="' .$strDrop . '" title="' . $strDrop . '" src="./images/button_drop.png" />' . (($propicon == 'both') ? '&nbsp;' . $strDrop : '') . "\n";
00403         }
00404     }
00405 } else {
00406     echo '                    <input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
00407     // Drop button if there is at least two fields
00408     if ($fields_cnt > 1) {
00409         echo '                    &nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00410            . '                    <input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
00411     }
00412 }
00413 
00414 ?>
00415                 </td>
00416             </tr>
00417         </table>
00418     </td>
00419 </tr>
00420 </table>
00421 
00422 </form>
00423 
00424 
00425 <?php
00430 if ($fields_cnt > 20) {
00431     ?>
00432 <!-- Browse links -->
00433     <?php
00434     echo "\n";
00435     require('./tbl_properties_links.php');
00436 } // end if ($fields_cnt > 20)
00437 echo "\n\n";
00438 
00439 
00443 ?>
00444 <!-- Indexes, space usage and row statistics -->
00445 <br />
00446 <table border="0" cellspacing="0" cellpadding="0">
00447 <tr>
00448     <td valign="top">
00449 <?php
00450 define('PMA_IDX_INCLUDED', 1);
00451 require ('./tbl_indexes.php');
00452 ?>
00453     </td>
00454 
00455 <?php
00459 // BEGIN - Calc Table Space - staybyte - 9 June 2001
00460 // loic1, 22 feb. 2002: updated with patch from
00461 //                      Joshua Nye <josh at boxcarmedia.com> to get valid
00462 //                      statistics whatever is the table type
00463 if ($cfg['ShowStats']) {
00464     $nonisam     = FALSE;
00465     $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
00466     if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
00467         $nonisam = TRUE;
00468     }
00469     if ($nonisam == FALSE || $is_innodb) {
00470         // Gets some sizes
00471         $mergetable     = FALSE;
00472         if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
00473             $mergetable = TRUE;
00474         }
00475         list($data_size, $data_unit)         = PMA_formatByteDown($showtable['Data_length']);
00476         if ($mergetable == FALSE) {
00477             list($index_size, $index_unit)   = PMA_formatByteDown($showtable['Index_length']);
00478         }
00479         if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
00480             list($free_size, $free_unit)     = PMA_formatByteDown($showtable['Data_free']);
00481             list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
00482         } else {
00483             list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
00484         }
00485         list($tot_size, $tot_unit)           = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
00486         if ($table_info_num_rows > 0) {
00487             list($avg_size, $avg_unit)       = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
00488         }
00489 
00490         // Displays them
00491         ?>
00492 
00493     <!-- Space usage -->
00494     <td width="20">&nbsp;</td>
00495     <td valign="top">
00496         <?php echo $strSpaceUsage . '&nbsp;:' . "\n"; ?>
00497         <a name="showusage"></a>
00498         <table border="<?php echo $cfg['Border']; ?>">
00499         <tr>
00500             <th><?php echo $strType; ?></th>
00501             <th colspan="2" align="center"><?php echo $strUsage; ?></th>
00502         </tr>
00503         <tr>
00504             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strData; ?></td>
00505             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $data_size; ?></td>
00506             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $data_unit; ?></td>
00507         </tr>
00508         <?php
00509         if (isset($index_size)) {
00510             echo "\n";
00511             ?>
00512         <tr>
00513             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strIndex; ?></td>
00514             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $index_size; ?></td>
00515             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $index_unit; ?></td>
00516         </tr>
00517             <?php
00518         }
00519         if (isset($free_size)) {
00520             echo "\n";
00521             ?>
00522         <tr style="color: #bb0000">
00523             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strOverhead; ?></td>
00524             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $free_size; ?></td>
00525             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $free_unit; ?></td>
00526         </tr>
00527         <tr>
00528             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strEffective; ?></td>
00529             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $effect_size; ?></td>
00530             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $effect_unit; ?></td>
00531         </tr>
00532             <?php
00533         }
00534         if (isset($tot_size) && $mergetable == FALSE) {
00535             echo "\n";
00536         ?>
00537         <tr>
00538             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strTotalUC; ?></td>
00539             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $tot_size; ?></td>
00540             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $tot_unit; ?></td>
00541         </tr>
00542             <?php
00543         }
00544         // Optimize link if overhead
00545         if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
00546             echo "\n";
00547             ?>
00548         <tr>
00549             <td colspan="3" align="center">
00550                 [<a href="sql.php?<?php echo $url_query; ?>&amp;pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php echo $strOptimizeTable; ?></a>]
00551             </td>
00552         </tr>
00553             <?php
00554         }
00555         echo "\n";
00556         ?>
00557         </table>
00558     </td>
00559 
00560     <!-- Rows Statistic -->
00561     <td width="20">&nbsp;</td>
00562     <td valign="top">
00563         <?php echo $strRowsStatistic . '&nbsp;:' . "\n"; ?>
00564         <table border="<?php echo $cfg['Border']; ?>">
00565         <tr>
00566             <th><?php echo $strStatement; ?></th>
00567             <th align="center"><?php echo $strValue; ?></th>
00568         </tr>
00569         <?php
00570         $i = 0;
00571         if (isset($showtable['Row_format'])) {
00572             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00573             echo "\n";
00574             ?>
00575         <tr>
00576             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strFormat; ?></td>
00577             <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
00578             <?php
00579             echo '                ';
00580             if ($showtable['Row_format'] == 'Fixed') {
00581                 echo $strFixed;
00582             }
00583             else if ($showtable['Row_format'] == 'Dynamic') {
00584                 echo $strDynamic;
00585             }
00586             else {
00587                 echo $showtable['Row_format'];
00588             }
00589             echo "\n";
00590             ?>
00591             </td>
00592         </tr>
00593             <?php
00594         }
00595         if (PMA_MYSQL_INT_VERSION >= 40100) {
00596             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00597             ?>
00598         <tr>
00599             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCollation; ?></td>
00600             <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
00601             <?php
00602             echo '<dfn title="' . PMA_getCollationDescr($tbl_charset) . '">' . $tbl_charset . '</dfn>';
00603             ?>
00604             </td>
00605         </tr>
00606             <?php
00607         }
00608         if (!$is_innodb && isset($showtable['Rows'])) {
00609             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00610             echo "\n";
00611             ?>
00612         <tr>
00613             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRows; ?></td>
00614             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00615                 <?php echo number_format($showtable['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00616             </td>
00617         </tr>
00618             <?php
00619         }
00620         if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
00621             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00622             echo "\n";
00623             ?>
00624         <tr>
00625             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowLength; ?>&nbsp;&oslash;</td>
00626             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00627                 <?php echo number_format($showtable['Avg_row_length'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00628             </td>
00629         </tr>
00630             <?php
00631         }
00632         if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == FALSE) {
00633             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00634             echo "\n";
00635             ?>
00636         <tr>
00637             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowSize; ?>&nbsp;&oslash;</td>
00638             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00639                 <?php echo $avg_size . ' ' . $avg_unit . "\n"; ?>
00640             </td>
00641         </tr>
00642             <?php
00643         }
00644         if (isset($showtable['Auto_increment'])) {
00645             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00646             echo "\n";
00647             ?>
00648         <tr>
00649             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strNext; ?>&nbsp;Autoindex</td>
00650             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00651                 <?php echo number_format($showtable['Auto_increment'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00652             </td>
00653         </tr>
00654             <?php
00655         }
00656         echo "\n";
00657 
00658         if (isset($showtable['Create_time'])) {
00659             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00660             echo "\n";
00661             ?>
00662         <tr>
00663             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCreateTime; ?></td>
00664             <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00665                 <?php echo PMA_localisedDate(strtotime($showtable['Create_time'])) . "\n"; ?>
00666             </td>
00667         </tr>
00668                 <?php
00669         }
00670         echo "\n";
00671 
00672         if (isset($showtable['Update_time'])) {
00673             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00674             echo "\n";
00675             ?>
00676         <tr>
00677             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatUpdateTime; ?></td>
00678             <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00679                 <?php echo PMA_localisedDate(strtotime($showtable['Update_time'])) . "\n"; ?>
00680             </td>
00681         </tr>
00682                 <?php
00683         }
00684         echo "\n";
00685 
00686         if (isset($showtable['Check_time'])) {
00687             $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00688             echo "\n";
00689             ?>
00690         <tr>
00691             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCheckTime; ?></td>
00692             <td style="font-size: <?php echo $font_smaller; ?>" align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00693                 <?php echo PMA_localisedDate(strtotime($showtable['Check_time'])) . "\n"; ?>
00694             </td>
00695         </tr>
00696             <?php
00697         }
00698         echo "\n";
00699         ?>
00700         </table>
00701     </td>
00702         <?php
00703     }
00704 }
00705 // END - Calc Table Space
00706 echo "\n";
00707 ?>
00708 </tr>
00709 </table>
00710 <hr />
00711 
00712 
00713 <?php
00717 ?>
00718 <!-- TABLE WORK -->
00719 <ul>
00720 
00721     <!-- Printable view of the table -->
00722     <li>
00723         <div style="margin-bottom: 10px"><a href="tbl_printview.php?<?php echo $url_query; ?>"><?php echo $strPrintView; ?></a></div>
00724     </li>
00725 
00726     <!-- Add some new fields -->
00727     <li>
00728         <form method="post" action="tbl_addfield.php"
00729             onsubmit="return checkFormElementInRange(this, 'num_fields', 1)">
00730             <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00731             <?php echo $strAddNewField; ?>&nbsp;:
00732             <input type="text" name="num_fields" size="2" maxlength="2" value="1" class="textfield" style="vertical-align: middle" onfocus="this.select()" />
00733             <select name="after_field" style="vertical-align: middle">
00734                 <option value="--end--"><?php echo $strAtEndOfTable; ?></option>
00735                 <option value="--first--"><?php echo $strAtBeginningOfTable; ?></option>
00736 <?php
00737 foreach($aryFields AS $junk => $fieldname) {
00738     echo '                <option value="' . htmlspecialchars($fieldname) . '">' . sprintf($strAfter, htmlspecialchars($fieldname)) . '</option>' . "\n";
00739 }
00740 unset($aryFields);
00741 ?>
00742             </select>
00743             <input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
00744         </form>
00745     </li>
00746 
00747 <?php
00748 if ($cfg['Server']['relation']) {
00749     ?>
00750     <!-- Work on Relations -->
00751     <li>
00752         <div style="margin-bottom: 10px">
00753             <a href="tbl_relation.php?<?php echo $url_query; ?>"><?php echo $strRelationView; ?></a>
00754         </div>
00755     </li>
00756     <?php
00757 }
00758 echo "\n";
00759 ?>
00760 
00761     <!-- Let MySQL propose the optimal structure -->
00762     <li>
00763         <div style="margin-bottom: 10px">
00764         <a href="sql.php?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>">
00765             <?php echo $strStructPropose; ?></a>
00766         <?php echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n"; ?>
00767         </div>
00768     </li>
00769 
00770 <?php
00774 $goto = 'tbl_properties_structure.php';
00775 require('./tbl_query_box.php');
00776 ?>
00777 
00778 </ul>
00779 
00780 
00781 <?php
00785 require_once('./footer.inc.php');
00786 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6