typo3/ext/phpmyadmin/modsub/phpmyadmin-2.6.2/tbl_properties_operations.php

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

Generated on Wed Aug 10 07:56:01 2005 for TYPO3 3.8.0 by  doxygen 1.4.3-20050530