Documentation TYPO3 par Ameos

tbl_properties_structure.php

00001 <?php
00002 /* $Id: tbl_properties_structure.php,v 2.40 2005/07/23 12:02:37 lem9 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 } elseif (isset($submit_mult_drop_x)) {
00017     $submit_mult = $strDrop;
00018 } elseif (isset($submit_mult_primary_x)) {
00019     $submit_mult = $strPrimary;
00020 } elseif (isset($submit_mult_index_x)) {
00021     $submit_mult = $strIndex;
00022 } elseif (isset($submit_mult_unique_x)) {
00023     $submit_mult = $strUnique;
00024 } elseif (isset($submit_mult_fulltext_x)) {
00025     $submit_mult = $strIdxFulltext;
00026 }
00027 
00028 if ((!empty($submit_mult) && isset($selected_fld))
00029     || isset($mult_btn)) {
00030     $action = 'tbl_properties_structure.php';
00031     $err_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db, $table);
00032     require('./mult_submits.inc.php');
00033 }
00034 
00038 require('./tbl_properties_common.php');
00039 $url_query .= '&amp;goto=tbl_properties_structure.php&amp;back=tbl_properties_structure.php';
00040 
00048 require('./tbl_properties_table_info.php');
00049 
00053 if ((!empty($submit_mult) && isset($selected_fld))
00054     || isset($mult_btn)) {
00055     $message = $strSuccess;
00056 }
00057 
00061 require('./tbl_properties_links.php');
00062 
00063 // 2. Gets table keys and retains them
00064 $result      = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
00065 $primary     = '';
00066 $ret_keys    = array();
00067 $pk_array    = array(); // will be use to emphasis prim. keys in the table view
00068 while ($row = PMA_DBI_fetch_assoc($result)) {
00069     $ret_keys[]  = $row;
00070     // Backups the list of primary keys
00071     if ($row['Key_name'] == 'PRIMARY') {
00072         $primary .= $row['Column_name'] . ', ';
00073         $pk_array[$row['Column_name']] = 1;
00074     }
00075 } // end while
00076 PMA_DBI_free_result($result);
00077 
00078 // 3. Get fields
00079 $fields_rs   = PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', NULL, PMA_DBI_QUERY_STORE);
00080 $fields_cnt  = PMA_DBI_num_rows($fields_rs);
00081 
00082 // Get more complete field information
00083 // For now, this is done just for MySQL 4.1.2+ new TIMESTAMP options
00084 // but later, if the analyser returns more information, it
00085 // could be executed for any MySQL version and replace
00086 // the info given by SHOW FULL FIELDS FROM.
00087 
00088 if (PMA_MYSQL_INT_VERSION >= 40102) {
00089     $show_create_table_query = 'SHOW CREATE TABLE '
00090         . PMA_backquote($db) . '.' . PMA_backquote($table);
00091     $show_create_table_res = PMA_DBI_query($show_create_table_query);
00092     list(,$show_create_table) = PMA_DBI_fetch_row($show_create_table_res);
00093     PMA_DBI_free_result($show_create_table_res);
00094     unset($show_create_table_res, $show_create_table_query);
00095     $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
00096 }
00097 
00102 $i = 0;
00103 
00104 ?>
00105 
00106 <!-- TABLE INFORMATION -->
00107 
00108 <form method="post" action="tbl_properties_structure.php" name="fieldsForm">
00109     <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00110 <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
00111 <tr>
00112 <?php echo $tbl_is_view ? '' : '    <th id="th' . ++$i . '">&nbsp;</th>' . "\n"; ?>
00113     <th id="th<?php echo ++$i; ?>">&nbsp;<?php echo $strField; ?>&nbsp;</th>
00114     <th id="th<?php echo ++$i; ?>"><?php echo $strType; ?></th>
00115 <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <th id="th' . ++$i . '">' . $strCollation . '</th>' . "\n" : ''; ?>
00116     <th id="th<?php echo ++$i; ?>"><?php echo $strAttr; ?></th>
00117     <th id="th<?php echo ++$i; ?>"><?php echo $strNull; ?></th>
00118     <th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th>
00119     <th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th>
00120 <?php echo $tbl_is_view ? '' : '    <th colspan="6" id="th' . ++$i . '">' . $strAction . '</th>' . "\n"; ?>
00121 </tr>
00122 
00123 <?php
00124 unset($i);
00125 $comments_map = array();
00126 $mime_map = array();
00127 
00128 if ($GLOBALS['cfg']['ShowPropertyComments']) {
00129     require_once('./libraries/relation.lib.php');
00130     require_once('./libraries/transformations.lib.php');
00131 
00132     $cfgRelation = PMA_getRelationsParam();
00133 
00134 
00135     if ($cfgRelation['commwork']) {
00136         $comments_map = PMA_getComments($db, $table);
00137 
00138         if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
00139             $mime_map = PMA_getMIME($db, $table, true);
00140         }
00141     }
00142 }
00143 
00144 $i         = 0;
00145 $aryFields = array();
00146 $checked   = (!empty($checkall) ? ' checked="checked"' : '');
00147 $save_row  = array();
00148 
00149 while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
00150     $save_row[] = $row;
00151     $i++;
00152     $bgcolor          = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00153     $aryFields[]      = $row['Field'];
00154 
00155     if ($GLOBALS['cfg']['BrowsePointerEnable'] == TRUE) {
00156         $on_mouse = ' onmouseover="setPointer(this, ' . $i . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'
00157                   . ' onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
00158     } else {
00159         $on_mouse = '';
00160     }
00161     if ($GLOBALS['cfg']['BrowseMarkerEnable'] == TRUE) {
00162         $on_mouse .= ' onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"';
00163     }
00164 
00165     $click_mouse = ' onmousedown="document.getElementById(\'checkbox_row_' . $i . '\').checked = (document.getElementById(\'checkbox_row_' . $i . '\').checked ? false : true);" ';
00166 
00167     $type             = $row['Type'];
00168     // reformat mysql query output - staybyte - 9. June 2001
00169     // loic1: set or enum types: slashes single quotes inside options
00170     if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) {
00171         $tmp[2]       = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1);
00172         $type         = $tmp[1] . '(' . str_replace(',', ', ', $tmp[2]) . ')';
00173 
00174         // for the case ENUM('&#8211;','&ldquo;')
00175         $type         = htmlspecialchars($type);
00176         
00177         $type_nowrap  = '';
00178 
00179         $binary       = 0;
00180         $unsigned     = 0;
00181         $zerofill     = 0;
00182     } else {
00183         $type_nowrap  = ' nowrap="nowrap"';
00184         // strip the "BINARY" attribute, except if we find "BINARY(" because
00185         // this would be a BINARY or VARBINARY field type
00186         if (!preg_match('@BINARY[\(]@i', $type)) {
00187             $type         = preg_replace('@BINARY@i', '', $type);
00188         }
00189         $type         = preg_replace('@ZEROFILL@i', '', $type);
00190         $type         = preg_replace('@UNSIGNED@i', '', $type);
00191         if (empty($type)) {
00192             $type     = '&nbsp;';
00193         }
00194 
00195         if (!preg_match('@BINARY[\(]@i', $row['Type'])) {
00196             $binary           = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');
00197         } else {
00198             $binary           = FALSE;
00199         }
00200 
00201         $unsigned     = stristr($row['Type'], 'unsigned');
00202         $zerofill     = stristr($row['Type'], 'zerofill');
00203     }
00204 
00205     // rabus: Divide charset from the rest of the type definition (MySQL >= 4.1)
00206     unset($field_charset);
00207     if (PMA_MYSQL_INT_VERSION >= 40100) {
00208         if ((substr($type, 0, 4) == 'char'
00209             || substr($type, 0, 7) == 'varchar'
00210             || substr($type, 0, 4) == 'text'
00211             || substr($type, 0, 8) == 'tinytext'
00212             || substr($type, 0, 10) == 'mediumtext'
00213             || substr($type, 0, 8) == 'longtext'
00214             || substr($type, 0, 3) == 'set'
00215             || substr($type, 0, 4) == 'enum'
00216             ) && !$binary) {
00217             if (strpos($type, ' character set ')) {
00218                 $type = substr($type, 0, strpos($type, ' character set '));
00219             }
00220             if (!empty($row['Collation'])) {
00221                 $field_charset = $row['Collation'];
00222             } else {
00223                 $field_charset = '';
00224             }
00225         } else {
00226             $field_charset = '';
00227         }
00228     }
00229 
00230     // garvin: Display basic mimetype [MIME]
00231     if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) {
00232         $type_mime = '<br />MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
00233     } else {
00234         $type_mime = '';
00235     }
00236 
00237     $attribute     = '&nbsp;';
00238     if ($binary) {
00239         $attribute = 'BINARY';
00240     }
00241     if ($unsigned) {
00242         $attribute = 'UNSIGNED';
00243     }
00244     if ($zerofill) {
00245         $attribute = 'UNSIGNED ZEROFILL';
00246     }
00247     
00248     // MySQL 4.1.2+ TIMESTAMP options
00249     // (if on_update_current_timestamp is set, then it's TRUE)
00250     if (isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
00251         $attribute = 'ON UPDATE CURRENT_TIMESTAMP';
00252     }
00253 
00254     // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the 
00255     // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
00256     // the latter.
00257     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']) {
00258         $row['Null'] = '';
00259     }
00260 
00261 
00262     if (!isset($row['Default'])) {
00263         if ($row['Null'] == 'YES') {
00264             $row['Default'] = '<i>NULL</i>';
00265         }
00266     } else {
00267         $row['Default'] = htmlspecialchars($row['Default']);
00268     }
00269 
00270     $field_encoded = urlencode($row['Field']);
00271     $field_name    = htmlspecialchars($row['Field']);
00272 
00273     // garvin: underline commented fields and display a hover-title (CSS only)
00274 
00275     $comment_style = '';
00276     if (isset($comments_map[$row['Field']])) {
00277         $field_name = '<span style="border-bottom: 1px dashed black;" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
00278     }
00279 
00280     if (isset($pk_array[$row['Field']])) {
00281         $field_name = '<u>' . $field_name . '</u>';
00282     }
00283     echo "\n";
00284 
00285     $titles = array();
00286     if ($cfg['PropertiesIconic'] == true) {
00287         // We need to copy the value or else the == 'both' check will always return true
00288         $propicon = (string)$cfg['PropertiesIconic'];
00289 
00290         if ($propicon == 'both') {
00291             $iconic_spacer = '<div class="nowrap">';
00292         } else {
00293             $iconic_spacer = '';
00294         }
00295 
00296         // images replaced 2004-05-08 by mkkeck
00297         $titles['Change']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
00298         $titles['Drop']          = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
00299         $titles['NoDrop']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_drop.png" alt="' . $strDrop . '" title="' . $strDrop . '" border="0" />';
00300         $titles['Primary']       = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
00301         $titles['Index']         = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
00302         $titles['Unique']        = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
00303         $titles['IdxFulltext']   = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
00304         $titles['NoPrimary']     = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_primary.png" alt="' . $strPrimary . '" title="' . $strPrimary . '" border="0" />';
00305         $titles['NoIndex']       = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_index.png" alt="' . $strIndex . '" title="' . $strIndex . '" border="0" />';
00306         $titles['NoUnique']      = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_unique.png" alt="' . $strUnique . '" title="' . $strUnique . '" border="0" />';
00307         $titles['NoIdxFulltext'] = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'bd_ftext.png" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" border="0" />';
00308 
00309         if ($propicon == 'both') {
00310             $titles['Change']        .= '&nbsp;' . $strChange . '</div>';
00311             $titles['Drop']          .= '&nbsp;' . $strDrop . '</div>';
00312             $titles['NoDrop']        .= '&nbsp;' . $strDrop . '</div>';
00313             $titles['Primary']       .= '&nbsp;' . $strPrimary . '</div>';
00314             $titles['Index']         .= '&nbsp;' . $strIndex . '</div>';
00315             $titles['Unique']        .= '&nbsp;' . $strUnique . '</div>';
00316             $titles['IdxFulltext'  ] .= '&nbsp;' . $strIdxFulltext . '</div>';
00317             $titles['NoPrimary']     .= '&nbsp;' . $strPrimary . '</div>';
00318             $titles['NoIndex']       .= '&nbsp;' . $strIndex . '</div>';
00319             $titles['NoUnique']      .= '&nbsp;' . $strUnique . '</div>';
00320             $titles['NoIdxFulltext'] .= '&nbsp;' . $strIdxFulltext . '</div>';
00321         }
00322     } else {
00323         $titles['Change']        = $strChange;
00324         $titles['Drop']          = $strDrop;
00325         $titles['NoDrop']        = $strDrop;
00326         $titles['Primary']       = $strPrimary;
00327         $titles['Index']         = $strIndex;
00328         $titles['Unique']        = $strUnique;
00329         $titles['IdxFulltext']   = $strIdxFulltext;
00330         $titles['NoPrimary']     = $strPrimary;
00331         $titles['NoIndex']       = $strIndex;
00332         $titles['NoUnique']      = $strUnique;
00333         $titles['NoIdxFulltext'] = $strIdxFulltext;
00334     }
00335 
00336     ?>
00337 <tr <?php echo $on_mouse; ?>>
00338     <?php
00339     if (!$tbl_is_view) {
00340         ?>
00341     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00342         <input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
00343     </td>
00344         <?php
00345     }
00346     ?>
00347     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">&nbsp;<label onclick="return (document.getElementById('checkbox_row_<?php echo $i; ?>') ? false : true)" for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label>&nbsp;</td>
00348     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
00349 <?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '    <td bgcolor="' . $bgcolor . '" ' . $click_mouse . '>' . (empty($field_charset) ? '&nbsp;' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
00350     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap" style="font-size: <?php echo $font_smallest; ?>"><?php echo $attribute; ?></td>
00351     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == 'YES') ? $strYes : $strNo); ?>&nbsp;</td>
00352     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?>&nbsp;</td>
00353     <td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?>&nbsp;</td>
00354     <?php
00355     if (!$tbl_is_view) {
00356         ?>
00357     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00358         <a href="tbl_alter.php?<?php echo $url_query; ?>&amp;field=<?php echo $field_encoded; ?>">
00359             <?php echo $titles['Change']; ?></a>
00360     </td>
00361     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00362         <?php
00363         // loic1: Drop field only if there is more than one field in the table
00364         if ($fields_cnt > 1) {
00365             echo "\n";
00366             ?>
00367         <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']))); ?>"
00368             onclick="return confirmLink(this, 'ALTER TABLE <?php echo PMA_jsFormat($table); ?> DROP <?php echo PMA_jsFormat($row['Field']); ?>')">
00369             <?php echo $titles['Drop']; ?></a>
00370             <?php
00371         } else {
00372             echo "\n" . '        ' . $titles['NoDrop'];
00373         }
00374         echo "\n";
00375         ?>
00376     </td>
00377     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00378         <?php
00379         if ($type == 'text' || $type == 'blob') {
00380             echo $titles['NoPrimary'] . "\n";
00381         } else {
00382             echo "\n";
00383             ?>
00384         <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ( empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strAPrimaryKey, htmlspecialchars($row['Field']))); ?>"
00385             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']); ?>)')">
00386             <?php echo $titles['Primary']; ?></a>
00387             <?php
00388         }
00389         echo "\n";
00390         ?>
00391     </td>
00392     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00393         <?php
00394         if ($type == 'text' || $type == 'blob') {
00395             echo $titles['NoIndex'] . "\n";
00396         } else {
00397             echo "\n";
00398             ?>
00399         <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']))); ?>">
00400             <?php echo $titles['Index']; ?></a>
00401             <?php
00402         }
00403         echo "\n";
00404         ?>
00405     </td>
00406     <td align="center" bgcolor="<?php echo $bgcolor; ?>">
00407         <?php
00408         if ($type == 'text' || $type == 'blob') {
00409             echo $titles['NoUnique'] . "\n";
00410         } else {
00411             echo "\n";
00412             ?>
00413         <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']))); ?>">
00414             <?php echo $titles['Unique']; ?></a>
00415             <?php
00416         }
00417         echo "\n";
00418         ?>
00419     </td>
00420     <?php
00421         if ((!empty($tbl_type) && $tbl_type == 'MYISAM')
00422             && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'varchar'))) {
00423             echo "\n";
00424             ?>
00425     <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00426         <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']))); ?>">
00427             <?php echo $titles['IdxFulltext']; ?></a>
00428     </td>
00429             <?php
00430         } else {
00431             echo "\n";
00432         ?>
00433     <td align="center" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00434         <?php echo $titles['NoIdxFulltext'] . "\n"; ?>
00435     </td>
00436         <?php
00437         } // end if... else...
00438         echo "\n";
00439     } // end if (!$tbl_is_view)
00440     ?>
00441 </tr>
00442     <?php
00443     unset($field_charset);
00444 } // end while
00445 
00446 echo "\n";
00447 
00448 if (!$tbl_is_view) {
00449 
00450     $checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
00451     ?>
00452 
00453 <tr>
00454     <td colspan="<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '14' : '13'; ?>">
00455         <table>
00456             <tr>
00457                 <td>
00458                     <img src="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>" border="0" width="38" height="22" alt="<?php echo $strWithChecked; ?>" />
00459         <a href="<?php echo $checkall_url; ?>&amp;checkall=1" onclick="setCheckboxes('fieldsForm', true); return false;">
00460             <?php echo $strCheckAll; ?></a>
00461         &nbsp;/&nbsp;
00462         <a href="<?php echo $checkall_url; ?>" onclick="setCheckboxes('fieldsForm', false); return false;">
00463             <?php echo $strUncheckAll; ?></a>
00464         &nbsp;&nbsp;&nbsp;
00465         <i><?php echo $strWithChecked; ?></i>&nbsp;&nbsp;
00466                 </td>
00467                 <td>
00468                     <?php
00469 
00470     if ($cfg['PropertiesIconic']) {
00471         PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $strChange, 'b_edit.png');
00472         // Drop button if there is at least two fields
00473         if ($fields_cnt > 1) {
00474             PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', $strDrop, 'b_drop.png');
00475         }
00476         PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', $strPrimary, 'b_primary.png');
00477         PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', $strIndex, 'b_index.png');
00478         PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', $strUnique, 'b_unique.png');
00479         if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
00480             PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', $strIdxFulltext, 'b_ftext.png');
00481         }
00482     } else {
00483         echo '<input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
00484         // Drop button if there is at least two fields
00485         if ($fields_cnt > 1) {
00486             echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00487                . '<input type="submit" name="submit_mult" value="' . $strDrop . '" title="' . $strDrop . '" />' . "\n";
00488         }
00489         echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00490            . '<input type="submit" name="submit_mult" value="' . $strPrimary . '" title="' . $strPrimary . '" />' . "\n";
00491         echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00492            . '<input type="submit" name="submit_mult" value="' . $strIndex . '" title="' . $strIndex . '" />' . "\n";
00493         echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00494            . '<input type="submit" name="submit_mult" value="' . $strUnique . '" title="' . $strUnique . '" />' . "\n";
00495         if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
00496             echo '&nbsp;<i>' . $strOr . '</i>&nbsp;' . "\n"
00497                . '<input type="submit" name="submit_mult" value="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' . "\n";
00498         }
00499     }
00500 
00501     ?>
00502                 </td>
00503             </tr>
00504         </table>
00505     </td>
00506 </tr>
00507     <?php
00508 }
00509 ?>
00510 </table>
00511 </form>
00512 
00513 <hr />
00514 
00515 
00516 <?php
00517 if (!$tbl_is_view) {
00521     ?>
00522 <!-- TABLE WORK -->
00523 <!-- Printable view of the table -->
00524 <a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
00525     if ($cfg['PropertiesIconic']) {
00526         echo '<img src="' . $pmaThemeImage . 'b_print.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strPrintView . '"/>';
00527     }
00528     echo $strPrintView;
00529     ?></a>&nbsp;&nbsp;&nbsp;
00530 
00531     <?php
00532     // if internal relations are available, or the table type is INNODB
00533     // ($tbl_type comes from tbl_properties_table_info.php)
00534 
00535     if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
00536         ?>
00537 <!-- Work on Relations -->
00538 <a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
00539     if ($cfg['PropertiesIconic']) {
00540         echo '<img src="' . $pmaThemeImage . 'b_relations.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strRelationView . '"/>';
00541     }
00542     echo $strRelationView;
00543 ?></a>&nbsp;&nbsp;&nbsp;
00544         <?php
00545     }
00546     ?>
00547 <!-- Let MySQL propose the optimal structure -->
00548 <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()'); ?>"><?php
00549     if ($cfg['PropertiesIconic']) {
00550         echo '<img src="' . $pmaThemeImage . 'b_tblanalyse.png" border="0" hspace="2" align="middle" width="16" height="16" alt="' . $strStructPropose . '" />';
00551     }
00552     echo $strStructPropose;
00553 ?></a><?php
00554     echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
00555 ?><br />
00556 <!-- Add some new fields -->
00557 <form method="post" action="tbl_addfield.php"
00558     onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']); ?>', 1)">
00559     <?php
00560         echo PMA_generate_common_hidden_inputs($db, $table);
00561         if ($cfg['PropertiesIconic']) {
00562             echo '<img src="' . $pmaThemeImage . 'b_insrow.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strAddNewField . '"/>';
00563         }
00564         echo sprintf($strAddFields, '<input type="text" name="num_fields" size="2" maxlength="2" value="1" style="vertical-align: middle" onfocus="this.select()" />');
00565     ?>
00566     <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>
00567     <input type="radio" name="field_where" id="radio_field_where_first" value="first" /><label for="radio_field_where_first"><?php echo $strAtBeginningOfTable; ?></label>
00568     <input type="radio" name="field_where" id="radio_field_where_after" value="after" /><?php
00569         $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">';
00570         foreach ($aryFields AS $fieldname) {
00571             $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
00572         }
00573         unset($aryFields);
00574         $fieldOptions .= '</select><label for="radio_field_where_after">';
00575         echo str_replace('<label for="radio_field_where_after"></label>', '', '<label for="radio_field_where_after">' . sprintf($strAfter, $fieldOptions) . '</label>') . "\n";
00576         ?>
00577     <input type="submit" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
00578 </form>
00579 
00580 <hr />
00581 
00582     <?php
00583 }
00584 
00589 if ($fields_cnt > 20) {
00590     ?>
00591 <!-- Browse links -->
00592     <?php
00593     echo "\n";
00594     require('./tbl_properties_links.php');
00595 } // end if ($fields_cnt > 20)
00596 echo "\n\n";
00597 
00598 
00599 if (!$tbl_is_view) {
00603     ?>
00604 <!-- Indexes, space usage and row statistics -->
00605 <table border="0" cellspacing="0" cellpadding="0">
00606 <tr>
00607     <td valign="top">
00608     <?php
00609     define('PMA_IDX_INCLUDED', 1);
00610     require ('./tbl_indexes.php');
00611     ?>
00612     </td>
00613 
00614     <?php
00618     // BEGIN - Calc Table Space - staybyte - 9 June 2001
00619     // loic1, 22 feb. 2002: updated with patch from
00620     //                      Joshua Nye <josh at boxcarmedia.com> to get valid
00621     //                      statistics whatever is the table type
00622     if ($cfg['ShowStats']) {
00623         $nonisam     = FALSE;
00624         $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
00625         if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
00626             $nonisam = TRUE;
00627         }
00628         if ($nonisam == FALSE || $is_innodb) {
00629             // Gets some sizes
00630             $mergetable     = FALSE;
00631             if (isset($showtable['Type']) && $showtable['Type'] == 'MRG_MyISAM') {
00632                 $mergetable = TRUE;
00633             }
00634             list($data_size, $data_unit)         = PMA_formatByteDown($showtable['Data_length']);
00635             if ($mergetable == FALSE) {
00636                 list($index_size, $index_unit)   = PMA_formatByteDown($showtable['Index_length']);
00637             }
00638             if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
00639                 list($free_size, $free_unit)     = PMA_formatByteDown($showtable['Data_free']);
00640                 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free']);
00641             } else {
00642                 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
00643             }
00644             list($tot_size, $tot_unit)           = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length']);
00645             if ($table_info_num_rows > 0) {
00646                 list($avg_size, $avg_unit)       = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
00647             }
00648 
00649             // Displays them
00650             ?>
00651 
00652     <!-- Space usage -->
00653     <td width="20">&nbsp;</td>
00654     <td valign="top">
00655         <a name="showusage"></a>
00656         <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
00657         <tr><td class="tblHeaders" colspan="3"><?php echo $strSpaceUsage . ':&nbsp;' . "\n"; ?></td></tr>
00658         <tr>
00659             <th><?php echo $strType; ?></th>
00660             <th colspan="2" align="center"><?php echo $strUsage; ?></th>
00661         </tr>
00662         <tr>
00663             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strData; ?></td>
00664             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $data_size; ?></td>
00665             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $data_unit; ?></td>
00666         </tr>
00667             <?php
00668             if (isset($index_size)) {
00669                 echo "\n";
00670                 ?>
00671         <tr>
00672             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strIndex; ?></td>
00673             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $index_size; ?></td>
00674             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $index_unit; ?></td>
00675         </tr>
00676                 <?php
00677             }
00678             if (isset($free_size)) {
00679                 echo "\n";
00680                 ?>
00681         <tr style="color: #bb0000">
00682             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" style="padding-right: 10px"><?php echo $strOverhead; ?></td>
00683             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>" align="right" nowrap="nowrap"><?php echo $free_size; ?></td>
00684             <td bgcolor="<?php echo $cfg['BgcolorTwo']; ?>"><?php echo $free_unit; ?></td>
00685         </tr>
00686         <tr>
00687             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strEffective; ?></td>
00688             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $effect_size; ?></td>
00689             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $effect_unit; ?></td>
00690         </tr>
00691                 <?php
00692             }
00693             if (isset($tot_size) && $mergetable == FALSE) {
00694                 echo "\n";
00695             ?>
00696         <tr>
00697             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" style="padding-right: 10px"><?php echo $strTotalUC; ?></td>
00698             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" nowrap="nowrap"><?php echo $tot_size; ?></td>
00699             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><?php echo $tot_unit; ?></td>
00700         </tr>
00701                 <?php
00702             }
00703             // Optimize link if overhead
00704             if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'BDB')) {
00705                 echo "\n";
00706                 ?>
00707         <tr>
00708             <td colspan="3" align="center" bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
00709                 <a href="sql.php?<?php echo $url_query; ?>&pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php
00710                     if ($cfg['PropertiesIconic']) {
00711                        echo '<img src="' . $pmaThemeImage . 'b_tbloptimize.png" width="16" height="16" border="0" hspace="2" align="middle" alt="' . $strOptimizeTable. '" />';
00712                     }
00713                     echo $strOptimizeTable;
00714                 ?></a>
00715             </td>
00716         </tr>
00717                 <?php
00718             }
00719             echo "\n";
00720             ?>
00721         </table>
00722     </td>
00723 
00724     <!-- Rows Statistic -->
00725     <td width="20">&nbsp;</td>
00726     <td valign="top">
00727         <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
00728         <tr><td class="tblHeaders" colspan="2"><?php echo $strRowsStatistic . ':&nbsp;' . "\n"; ?></td></tr>
00729         <tr>
00730             <th><?php echo $strStatement; ?></th>
00731             <th align="center"><?php echo $strValue; ?></th>
00732         </tr>
00733             <?php
00734             $i = 0;
00735             if (isset($showtable['Row_format'])) {
00736                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00737                 echo "\n";
00738                 ?>
00739         <tr>
00740             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strFormat; ?></td>
00741             <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
00742                 <?php
00743                 echo '                ';
00744                 if ($showtable['Row_format'] == 'Fixed') {
00745                     echo $strFixed;
00746                 }
00747                 else if ($showtable['Row_format'] == 'Dynamic') {
00748                     echo $strDynamic;
00749                 }
00750                 else {
00751                     echo $showtable['Row_format'];
00752                 }
00753                 echo "\n";
00754                 ?>
00755             </td>
00756         </tr>
00757                 <?php
00758             }
00759             if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($tbl_collation)) {
00760                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00761                 ?>
00762         <tr>
00763             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strCollation; ?></td>
00764             <td bgcolor="<?php echo $bgcolor; ?>" align="<?php echo $cell_align_left; ?>" nowrap="nowrap">
00765                 <?php
00766                 echo '<dfn title="' . PMA_getCollationDescr($tbl_collation) . '">' . $tbl_collation . '</dfn>';
00767                 ?>
00768             </td>
00769         </tr>
00770                 <?php
00771             }
00772             if (!$is_innodb && isset($showtable['Rows'])) {
00773                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00774                 echo "\n";
00775                 ?>
00776         <tr>
00777             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRows; ?></td>
00778             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00779                 <?php echo number_format($showtable['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00780             </td>
00781         </tr>
00782                 <?php
00783             }
00784             if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
00785                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00786                 echo "\n";
00787                 ?>
00788         <tr>
00789             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowLength; ?>&nbsp;&oslash;</td>
00790             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00791                 <?php echo number_format($showtable['Avg_row_length'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00792             </td>
00793         </tr>
00794                 <?php
00795             }
00796             if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == FALSE) {
00797                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00798                 echo "\n";
00799                 ?>
00800         <tr>
00801             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strRowSize; ?>&nbsp;&oslash;</td>
00802             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00803                 <?php echo $avg_size . ' ' . $avg_unit . "\n"; ?>
00804             </td>
00805         </tr>
00806                 <?php
00807             }
00808             if (isset($showtable['Auto_increment'])) {
00809                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00810                 echo "\n";
00811                 ?>
00812         <tr>
00813             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strNext; ?>&nbsp;Autoindex</td>
00814             <td bgcolor="<?php echo $bgcolor; ?>" align="right" nowrap="nowrap">
00815                 <?php echo number_format($showtable['Auto_increment'], 0, $number_decimal_separator, $number_thousands_separator) . "\n"; ?>
00816             </td>
00817         </tr>
00818                 <?php
00819             }
00820             echo "\n";
00821 
00822             if (isset($showtable['Create_time'])) {
00823                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00824                 echo "\n";
00825                 ?>
00826         <tr>
00827             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCreateTime; ?></td>
00828             <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00829                 <?php echo PMA_localisedDate(strtotime($showtable['Create_time'])) . "\n"; ?>
00830             </td>
00831         </tr>
00832                 <?php
00833             }
00834             echo "\n";
00835 
00836             if (isset($showtable['Update_time'])) {
00837                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00838                 echo "\n";
00839                 ?>
00840         <tr>
00841             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatUpdateTime; ?></td>
00842             <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00843                 <?php echo PMA_localisedDate(strtotime($showtable['Update_time'])) . "\n"; ?>
00844             </td>
00845         </tr>
00846                 <?php
00847             }
00848             echo "\n";
00849 
00850             if (isset($showtable['Check_time'])) {
00851                 $bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
00852                 echo "\n";
00853                 ?>
00854         <tr>
00855             <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $strStatCheckTime; ?></td>
00856             <td<?php if($theme=='original' || $theme==''){ echo ' style="font-size:' . $font_smaller . '"'; } ?> align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00857                 <?php echo PMA_localisedDate(strtotime($showtable['Check_time'])) . "\n"; ?>
00858             </td>
00859         </tr>
00860                 <?php
00861             }
00862             echo "\n";
00863             ?>
00864         </table>
00865     </td>
00866             <?php
00867         }
00868     }
00869     // END - Calc Table Space
00870     echo "\n";
00871     ?>
00872 </tr>
00873 </table>
00874 <hr />
00875     <?php
00876 } // end if (!$tbl_is_view)
00877 
00881 $goto = 'tbl_properties_structure.php';
00882 require('./tbl_query_box.php');
00883 
00887 require_once('./footer.inc.php');
00888 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6