Documentation TYPO3 par Ameos

tbl_properties_operations.php

00001 <?php
00002 /* $Id: tbl_properties_operations.php,v 2.29 2005/06/28 10:59:39 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00008 require('./tbl_properties_common.php');
00009 //$err_url   = 'tbl_properties_operations.php' . $err_url;
00010 $url_query .= '&amp;goto=tbl_properties_operations.php&amp;back=tbl_properties_operations.php';
00011 
00012 
00016 require_once('./libraries/relation.lib.php');
00017 $cfgRelation = PMA_getRelationsParam();
00018 
00022 require_once('./libraries/mysql_charsets.lib.php');
00023 require_once('./libraries/storage_engines.lib.php');
00024 
00025 // reselect current db (needed in some cases probably due to
00026 // the calling of relation.lib.php)
00027 PMA_DBI_select_db($db);
00028 
00032 if (isset($submitcomment)) {
00033     if (empty($prev_comment) || urldecode($prev_comment) != $comment) {
00034         $sql_query = 'ALTER TABLE ' . PMA_backquote($table) . ' COMMENT = \'' . PMA_sqlAddslashes($comment) . '\'';
00035         $result    = PMA_DBI_query($sql_query);
00036         $message   = $strSuccess;
00037     }
00038 }
00039 if (isset($submittype)) {
00040     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table) . ' TYPE = ' . $new_tbl_type;
00041     $result        = PMA_DBI_query($sql_query);
00042     $message       = $strSuccess;
00043 }
00044 if (isset($submitcollation)) {
00045     // since something modifies $tbl_collation between the moment it is
00046     // set from $_POST and this point, need to restore it
00047     // (bug seen in MySQL 5.0.4)
00048     $tbl_collation = $_POST['tbl_collation'];
00049     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table) . ' DEFAULT' . PMA_generateCharsetQueryPart($tbl_collation);
00050     $result        = PMA_DBI_query($sql_query);
00051     $message       = $strSuccess;
00052     unset($tbl_collation);
00053 }
00054 if (isset($submitoptions)) {
00055     $sql_query     = 'ALTER TABLE ' . PMA_backquote($table)
00056                    . (isset($pack_keys) ? ' pack_keys=1': ' pack_keys=0')
00057                    . (isset($checksum) ? ' checksum=1': ' checksum=0')
00058                    . (isset($delay_key_write) ? ' delay_key_write=1': ' delay_key_write=0')
00059                    . (!empty($auto_increment) ? ' auto_increment=' . PMA_sqlAddslashes($auto_increment) : '');
00060     $result        = PMA_DBI_query($sql_query);
00061     $message       = $strSuccess;
00062 }
00063 
00067 if (isset($submitorderby) && !empty($order_field)) {
00068     $sql_query   = 'ALTER TABLE ' . PMA_backquote($table)
00069                  . ' ORDER BY ' . PMA_backquote(urldecode($order_field));
00070     if (isset($order_order) && $order_order == 'desc') {
00071         $sql_query .= ' DESC';
00072     }
00073     $result      = PMA_DBI_query($sql_query);
00074     $message     = $result ? $strSuccess : $strFailed;
00075 } // end if
00076 
00080 require('./tbl_properties_table_info.php');
00081 
00085 require('./tbl_properties_links.php');
00086 
00090 $local_query = 'SHOW COLUMNS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db);
00091 $result      = PMA_DBI_query($local_query);
00092 for ($i = 0; $row = PMA_DBI_fetch_assoc($result); $i++) {
00093         $columns[$i] = $row['Field'];
00094 }
00095 PMA_DBI_free_result($result);
00096 unset($result);
00097 ?>
00098 
00099 <table border="0" align="left" cellpadding="3" cellspacing="0">
00100 <?php
00101 
00106 if (PMA_MYSQL_INT_VERSION >= 32334) {
00107     ?>
00108     <!-- Order the table -->
00109 
00110     <form method="post" action="tbl_properties_operations.php">
00111         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00112         <tr>
00113             <th class="tblHeaders" colspan="2" align="left"><?php echo $strAlterOrderBy; ?>:&nbsp;</th></tr>
00114         <tr>
00115             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00116                 <select name="order_field" style="vertical-align: middle">
00117     <?php
00118     echo "\n";
00119     foreach ($columns AS $junk => $fieldname) {
00120         echo '                <option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
00121     }
00122     unset($columns);
00123     ?>
00124                 </select>&nbsp;<?php echo $strSingly . "\n"; ?>
00125                 <select name="order_order" style="vertical-align: middle">
00126                     <option value="asc"><?php echo $strAscending; ?></option>
00127                     <option value="desc"><?php echo $strDescending; ?></option>
00128                 </select>
00129             </td>
00130             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
00131                 <input type="submit" name="submitorderby" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
00132             </td>
00133         </tr>
00134     </form>
00135         <tr><td colspan="2" height="5"></td></tr>
00136     <?php
00137 }
00138 echo "\n";
00139 ?>
00140     <!-- Change table name -->
00141     <form method="post" action="tbl_rename.php" onsubmit="return emptyFormElements(this, 'new_name')">
00142         <tr>
00143             <th class="tblHeaders" colspan="2" align="left">
00144                 <?php echo $strRenameTable; ?>:&nbsp;
00145                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00146                 <input type="hidden" name="reload" value="1" />
00147             </th>
00148         </tr>
00149         <tr>
00150             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00151                 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />&nbsp;
00152             </td>
00153             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
00154                 <input type="submit" value="<?php echo $strGo; ?>" />
00155             </td>
00156         </tr>
00157     </form>
00158         <tr><td colspan="2" height="5"></td></tr>
00159     <!-- Move table -->
00160     <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
00161         <tr>
00162             <th class="tblHeaders" colspan="2" align="left">
00163                 <?php echo $strMoveTable . "\n"; ?>
00164                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00165                 <input type="hidden" name="reload" value="1" />
00166                 <input type="hidden" name="what" value="data" />
00167             </th>
00168         </tr>
00169         <tr>
00170             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" nowrap="nowrap">
00171                 <select name="target_db">
00172 <?php
00173 // The function used below is defined in "common.lib.php"
00174 PMA_availableDatabases('main.php?' . PMA_generate_common_url());
00175 for ($i = 0; $i < $num_dbs; $i++) {
00176     echo '                            ';
00177     echo '<option value="' . htmlspecialchars($dblist[$i]) . '">' . htmlspecialchars($dblist[$i]) . '</option>';
00178     echo "\n";
00179 } // end for
00180 ?>
00181                 </select>
00182                 &nbsp;<b>.</b>&nbsp;
00183                 <input type="text" size="20" name="new_name" value="<?php echo htmlspecialchars($table); ?>" class="textfield" onfocus="this.select()" />
00184             </td>
00185             <td align="<?php echo $cell_align_right; ?>" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00186                 <input type="submit" name="submit_move" value="<?php echo $strGo; ?>" />
00187             </td>
00188         </tr>
00189     </form>
00190         <tr><td colspan="2" height="5"></td></tr>
00191     <!-- Copy table -->
00192     <form method="post" action="tbl_move_copy.php" onsubmit="return emptyFormElements(this, 'new_name')">
00193         <tr>
00194             <th class="tblHeaders" colspan="2" align="left">
00195                 <?php echo $strCopyTable . "\n"; ?>
00196                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00197                 <input type="hidden" name="reload" value="1" />
00198             </th>
00199         </tr>
00200         <tr>
00201             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2" nowrap="nowrap">
00202                 <select name="target_db">
00203 <?php
00204 for ($i = 0; $i < $num_dbs; $i++) {
00205     echo '                    ';
00206     echo '<option value="' . htmlspecialchars($dblist[$i]) . '"';
00207     if ($dblist[$i] == $db) {
00208         echo ' selected="selected"';
00209     }
00210     echo '>' . htmlspecialchars($dblist[$i]) . '</option>';
00211     echo "\n";
00212 } // end for
00213 ?>
00214                 </select>
00215                 &nbsp;<b>.</b>&nbsp;
00216                 <input type="text" size="20" name="new_name" class="textfield" onfocus="this.select()" />
00217             </td>
00218         </tr>
00219         <tr>
00220             <td nowrap="nowrap" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00221                 <input type="radio" name="what" value="structure" id="radio_copy_structure" style="vertical-align: middle" /><label for="radio_copy_structure"><?php echo $strStrucOnly; ?></label>&nbsp;&nbsp;<br />
00222                 <input type="radio" name="what" value="data" id="radio_copy_data" checked="checked" style="vertical-align: middle" /><label for="radio_copy_data"><?php echo $strStrucData; ?></label>&nbsp;&nbsp;<br />
00223                 <input type="radio" name="what" value="dataonly" id="radio_copy_dataonly" style="vertical-align: middle" /><label for="radio_copy_dataonly"><?php echo $strDataOnly; ?></label>&nbsp;&nbsp;<br />
00224 
00225                 <input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" style="vertical-align: middle" /><label for="checkbox_drop"><?php echo $strStrucDrop; ?></label>&nbsp;&nbsp;<br />
00226                 <input type="checkbox" name="auto_increment" value="1" id="checkbox_auto_increment" style="vertical-align: middle" /><label for="checkbox_auto_increment"><?php echo $strAddAutoIncrement; ?></label><br />
00227                 <?php
00228                     // display "Add constraints" choice only if there are
00229                     // foreign keys
00230                     if (PMA_getForeigners($db, $table, '', 'innodb')) {
00231                 ?>
00232                 <input type="checkbox" name="constraints" value="1" id="checkbox_constraints" style="vertical-align: middle" /><label for="checkbox_constraints"><?php echo $strAddConstraints; ?></label><br />
00233                 <?php
00234                     } // endif
00235                     if (isset($_COOKIE) && isset($_COOKIE['pma_switch_to_new']) && $_COOKIE['pma_switch_to_new'] == 'true') {
00236                         $pma_switch_to_new = 'true';
00237                     }
00238                 ?>
00239                 <input type="checkbox" name="switch_to_new" value="true" id="checkbox_switch"<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?> style="vertical-align: middle" /><label for="checkbox_switch"><?php echo $strSwitchToTable; ?></label>&nbsp;&nbsp;
00240             </td>
00241             <td align="<?php echo $cell_align_right; ?>" valign="bottom" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00242                 <input type="submit" name="submit_copy" value="<?php echo $strGo; ?>" />
00243             </td>
00244         </tr>
00245     </form>
00246         <tr><td colspan="2" height="5"></td></tr>
00247 <?php
00248 
00252 ?>
00253     <!-- Table comments -->
00254     <form method="post" action="tbl_properties_operations.php">
00255         <tr>
00256             <th colspan="2" class="tblHeaders" align="left">
00257                 <?php
00258                 echo PMA_generate_common_hidden_inputs($db, $table);
00259                 echo $strTableComments . '&nbsp;';
00260                 if (strstr($show_comment, '; InnoDB free') === FALSE) {
00261                     if (strstr($show_comment, 'InnoDB free') === FALSE) {
00262                         // only user entered comment
00263                         $comment = $show_comment;
00264                     } else {
00265                         // here we have just InnoDB generated part
00266                         $comment = '';
00267                     }
00268                 } else {
00269                     // remove InnoDB comment from end, just the minimal part (*? is non greedy)
00270                     $comment = preg_replace('@; InnoDB free:.*?$@' , '', $show_comment);
00271                 }
00272                 ?>
00273                 <input type="hidden" name="prev_comment" value="<?php echo urlencode($comment); ?>" />&nbsp;
00274             </th>
00275         <tr>
00276             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00277                 <input type="text" name="comment" maxlength="60" size="30" value="<?php echo htmlspecialchars($comment); ?>" class="textfield" style="vertical-align: middle" onfocus="this.select()" />&nbsp;
00278             </td>
00279             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
00280                 <input type="submit" name="submitcomment" value="<?php echo $strGo; ?>" style="vertical-align: middle" />
00281             </td>
00282         </tr>
00283     </form>
00284         <tr><td colspan="2" height="5"></td></tr>
00285     <!-- Table type -->
00286     <?php
00287     // modify robbat2 code - staybyte - 11. June 2001
00288     $result = PMA_DBI_query('SHOW VARIABLES LIKE \'have_%\';');
00289     if ($result) {
00290         while ($tmp = PMA_DBI_fetch_assoc($result)) {
00291             if (isset($tmp['Variable_name'])) {
00292                 switch ($tmp['Variable_name']) {
00293                     case 'have_bdb':
00294                         if ($tmp['Value'] == 'YES') {
00295                             $tbl_bdb    = TRUE;
00296                         }
00297                         break;
00298                     case 'have_gemini':
00299                         if ($tmp['Value'] == 'YES') {
00300                             $tbl_gemini = TRUE;
00301                         }
00302                         break;
00303                     case 'have_innodb':
00304                         if ($tmp['Value'] == 'YES') {
00305                             $tbl_innodb = TRUE;
00306                         }
00307                         break;
00308                     case 'have_isam':
00309                         if ($tmp['Value'] == 'YES') {
00310                             $tbl_isam   = TRUE;
00311                         }
00312                         break;
00313                 } // end switch
00314             } // end if isset($tmp['Variable_name'])
00315         } // end while
00316     } // end if $result
00317 
00318     PMA_DBI_free_result($result);
00319     echo "\n";
00320     ?>
00321     <form method="post" action="tbl_properties_operations.php">
00322         <tr>
00323             <th colspan="2" class="tblHeaders" align="left">
00324                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00325                 <?php echo $strTableType; ?>:&nbsp;
00326                 <?php echo PMA_showMySQLDocu('Table_types', 'Table_types') . "\n"; ?>
00327             </th>
00328         </tr>
00329         <tr>
00330             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00331                 <?php echo PMA_generateEnginesDropdown('new_tbl_type', NULL, FALSE, $tbl_type, 4); ?>
00332             </td>
00333             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right">
00334                 <input type="submit" name="submittype" value="<?php echo $strGo; ?>" />
00335             </td>
00336         </tr>
00337     </form>
00338         <tr><td colspan="2" height="5"></td></tr>
00339     <?php
00340 
00341     if (PMA_MYSQL_INT_VERSION >= 40100) {
00342         echo "\n"
00343            . '<!-- Table character set -->' . "\n"
00344            . '    <form method="post" action="tbl_properties_operations.php">' . "\n"
00345            . '        <tr>' . "\n"
00346            . '            <th colspan="2" class="tblHeaders" align="left">' . "\n"
00347            . PMA_generate_common_hidden_inputs($db, $table, 3)
00348            . '            ' . $strCollation . ':&nbsp;' . "\n"
00349            . '            </th>' . "\n"
00350            . '        </tr>' . "\n"
00351            . '        <tr>' . "\n"
00352            . '            <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00353            . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, $tbl_collation, FALSE, 3)
00354            . '            </td>' . "\n"
00355            . '            <td bgcolor="' . $cfg['BgcolorOne'] . '" align="right">' . "\n"
00356            . '                <input type="submit" name="submitcollation" value="' . $strGo . '" style="vertical-align: middle" />' . "\n"
00357            . '        </td>' . "\n"
00358            . '        </tr>' . "\n"
00359            . '    </form>' . "\n"
00360            . '        <tr><td colspan="2" height="5"></td></tr>' . "\n";
00361     }
00362     // PACK_KEYS: MyISAM or ISAM
00363     // DELAY_KEY_WRITE, CHECKSUM, AUTO_INCREMENT: MyISAM only
00364 
00365     if ($tbl_type == 'MYISAM' || $tbl_type == 'ISAM') {
00366     ?>
00367     <!-- Table options -->
00368     <form method="post" action="tbl_properties_operations.php">
00369         <tr>
00370             <th colspan="2" class="tblHeaders" align="left">
00371                 <?php echo $strTableOptions; ?>:&nbsp;
00372                 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
00373             </th>
00374         </tr>
00375         <tr>
00376             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00377                 <input type="checkbox" name="pack_keys" id="pack_keys_opt"
00378                 <?php echo (isset($pack_keys) && $pack_keys == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="pack_keys_opt">pack_keys</label><br />
00379         <?php
00380         if ($tbl_type == 'MYISAM') {
00381         ?>
00382                 <input type="checkbox" name="checksum" id="checksum_opt"
00383                 <?php echo (isset($checksum) && $checksum == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="checksum_opt">checksum</label><br />
00384 
00385                 <input type="checkbox" name="delay_key_write" id="delay_key_write_opt"
00386                 <?php echo (isset($delay_key_write) && $delay_key_write == 1) ? ' checked="checked"' : ''; ?> style="vertical-align: middle" /><label for="delay_key_write_opt">delay_key_write</label><br />
00387 
00388                 <input type="text" name="auto_increment" id="auto_increment_opt" class="textfield"
00389                 <?php echo (isset($auto_increment) && !empty($auto_increment) ? ' value="' . $auto_increment . '"' : ''); ?> style="width: 30px; vertical-align: middle" />&nbsp;<label for="auto_increment_opt">auto_increment</label>
00390             </td>
00391         <?php
00392         } // end if (MYISAM)
00393         ?>
00394             <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" align="right" valign="bottom">
00395                 <input type="submit" name="submitoptions" value="<?php echo $strGo; ?>" />
00396             </td>
00397         </tr>
00398     </form>
00399 <?php
00400     } // end if (MYISAM or ISAM)
00401 ?>
00402 </table>
00403 <img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="25" height="1" border="0" align="left" />
00404 <!----->
00405 <table border="0" cellpadding="3" cellspacing="0">
00406     <tr>
00407         <th class="tblHeaders" colspan="2" align="left">
00408             <?php echo $strTableMaintenance; ?>
00409         </th>
00410     </tr>
00411 <?php
00412 if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB' || $tbl_type == 'INNODB') {
00413     echo "\n";
00414     if ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB') {
00415         ?>
00416     <tr>
00417         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00418             <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('CHECK TABLE ' . PMA_backquote($table)); ?>">
00419                 <?php echo $strCheckTable; ?></a>&nbsp;
00420         </td>
00421         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00422             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE') . "\n"; ?>
00423         </td>
00424     </tr>
00425         <?php
00426     }
00427     echo "\n";
00428     if ($tbl_type == 'INNODB') {
00429         ?>
00430     <tr>
00431         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00432             <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' TYPE=InnoDB'); ?>">
00433                 <?php echo $strDefragment; ?></a>&nbsp;
00434         </td>
00435         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00436             <?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting') . "\n"; ?>
00437         </td>
00438     </tr>
00439         <?php
00440     }
00441     echo "\n";
00442     if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
00443         ?>
00444     <tr>
00445         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00446             <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ANALYZE TABLE ' . PMA_backquote($table)); ?>">
00447                 <?php echo $strAnalyzeTable; ?></a>&nbsp;
00448         </td>
00449         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00450             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE') . "\n";?>
00451         </td>
00452     </tr>
00453         <?php
00454     }
00455     echo "\n";
00456     if ($tbl_type == 'MYISAM') {
00457         ?>
00458     <tr>
00459         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00460             <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('REPAIR TABLE ' . PMA_backquote($table)); ?>">
00461                 <?php echo $strRepairTable; ?></a>&nbsp;
00462         </td>
00463         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00464             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE') . "\n"; ?>
00465         </td>
00466     </tr>
00467         <?php
00468     }
00469     echo "\n";
00470     if ($tbl_type == 'MYISAM' || $tbl_type == 'BERKELEYDB') {
00471         ?>
00472     <tr>
00473         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00474             <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>">
00475                 <?php echo $strOptimizeTable; ?></a>&nbsp;
00476         </td>
00477         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00478             <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE') . "\n"; ?>
00479         </td>
00480     </tr>
00481         <?php
00482     }
00483     echo "\n";
00484     ?>
00485     <?php
00486 } // end MYISAM or BERKELEYDB case
00487 echo "\n";
00488 ?>
00489     <tr>
00490         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00491                 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('FLUSH TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenFlushed, htmlspecialchars($table))); if ($cfg['ShowTooltip']) echo '&amp;reload=1'; ?>">
00492                     <?php echo $strFlushTable; ?></a>&nbsp;
00493         </td>
00494         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00495                     <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH') . "\n"; ?>
00496         </td>
00497     </tr>
00498 
00499 <?php
00500 // Referential integrity check
00501 // The Referential integrity check was intended for the non-InnoDB
00502 // tables for which the relations are defined in pmadb
00503 // so I assume that if the current table is InnoDB, I don't display
00504 // this choice (InnoDB maintains integrity by itself)
00505 
00506 if ($cfgRelation['relwork'] && $tbl_type != "INNODB") {
00507 
00508     // we need this PMA_DBI_select_db if the user has access to more than one db
00509     // and $db is not the last of the list, because PMA_availableDatabases()
00510     // has made a PMA_DBI_select_db() on the last one
00511     PMA_DBI_select_db($db);
00512     $foreign = PMA_getForeigners($db, $table);
00513 
00514     if ($foreign) {
00515         ?>
00516     <!-- Referential integrity check -->
00517     <tr>
00518         <td bgcolor="<?php echo $cfg['BgcolorOne']; ?>" colspan="2">
00519                 <?php echo $strReferentialIntegrity; ?><br />
00520                 <?php
00521                 echo "\n";
00522                 foreach ($foreign AS $master => $arr) {
00523                     $join_query  = 'SELECT ' . PMA_backquote($table) . '.* FROM '
00524                                  . PMA_backquote($table) . ' LEFT JOIN '
00525                                  . PMA_backquote($arr['foreign_table']);
00526                     if ($arr['foreign_table'] == $table) {
00527                         $foreign_table = $table . '1';
00528                         $join_query .= ' AS ' . PMA_backquote($foreign_table);
00529                     } else {
00530                         $foreign_table = $arr['foreign_table'];
00531                     }
00532                     $join_query .= ' ON '
00533                                  . PMA_backquote($table) . '.' . PMA_backquote($master)
00534                                  . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
00535                                  . ' WHERE '
00536                                  . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
00537                                  . ' IS NULL AND '
00538                                  . PMA_backquote($table) . '.' . PMA_backquote($master)
00539                                  . ' IS NOT NULL';
00540                     echo '        '
00541                          . '<a href="sql.php?' . $url_query
00542                          . '&amp;sql_query='
00543                          . urlencode($join_query)
00544                          . '">' . $master . '&nbsp;->&nbsp;' . $arr['foreign_table'] . '.' . $arr['foreign_field']
00545                          . '</a><br />' . "\n";
00546                     unset($foreign_table);
00547                     unset($join_query);
00548                 } //  end while
00549                 ?>
00550         </td>
00551     </tr>
00552         <?php
00553     } // end if ($result)
00554     echo "\n";
00555 
00556 } // end  if (!empty($cfg['Server']['relation']))
00557 ?>
00558 </table>
00559 <?php
00560 
00564 echo "\n";
00565 require_once('./footer.inc.php');
00566 ?>


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