2 /* vim: set expandtab sw=4 ts=4 sts=4: */
11 require_once './libraries/common.inc.php';
12 require_once './libraries/Table.class.php';
14 $pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
19 require './libraries/tbl_common.php';
20 $url_query .= '&goto=tbl_operations.php&back=tbl_operations.php';
21 $url_params['goto'] = $url_params['back'] = 'tbl_operations.php';
24 * Gets relation settings
26 require_once './libraries/relation.lib.php';
27 $cfgRelation = PMA_getRelationsParam();
30 * Gets available MySQL charsets and storage engines
32 require_once './libraries/mysql_charsets.lib.php';
33 require_once './libraries/StorageEngine.class.php';
36 * Class for partition management
38 require_once './libraries/Partition.class.php';
40 // reselect current db (needed in some cases probably due to
41 // the calling of relation.lib.php)
42 PMA_DBI_select_db($GLOBALS['db']);
45 * Gets tables informations
48 require './libraries/tbl_info.inc.php';
50 // define some globals here, for improved syntax in the conditionals
51 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
52 // set initial value of these globals, based on the current table engine
53 PMA_set_global_variables_for_engine($tbl_type);
56 // the value for transactional can be implicit
57 // (no create option found, in this case it means 1)
58 // or explicit (option found with a value of 0 or 1)
59 // ($transactional may have been set by libraries/tbl_info.inc.php,
60 // from the $create_options)
61 $transactional = (isset($transactional) && $transactional == '0') ?
'0' : '1';
62 $page_checksum = (isset($page_checksum)) ?
$page_checksum : '';
66 $table_alters = array();
69 * Updates table comment, type and options if required
71 if (isset($_REQUEST['submitoptions'])) {
73 $warning_messages = array();
75 if (isset($_REQUEST['new_name'])) {
76 if ($pma_table->rename($_REQUEST['new_name'])) {
77 $_message .= $pma_table->getLastMessage();
79 $GLOBALS['table'] = $pma_table->getName();
83 $_message .= $pma_table->getLastError();
87 if (isset($_REQUEST['comment'])
88 && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']) {
89 $table_alters[] = 'COMMENT = \'' . PMA_sqlAddslashes($_REQUEST['comment']) . '\'';
91 if (! empty($_REQUEST['new_tbl_type'])
92 && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type)) {
93 $table_alters[] = 'ENGINE = ' . $_REQUEST['new_tbl_type'];
94 $tbl_type = $_REQUEST['new_tbl_type'];
95 // reset the globals for the new engine
96 PMA_set_global_variables_for_engine($tbl_type);
99 if (! empty($_REQUEST['tbl_collation'])
100 && $_REQUEST['tbl_collation'] !== $tbl_collation) {
101 $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);
104 if (($is_myisam_or_maria ||
$is_isam)
105 && isset($_REQUEST['new_pack_keys'])
106 && $_REQUEST['new_pack_keys'] != (string)$pack_keys) {
107 $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
110 $checksum = empty($checksum) ?
'0' : '1';
111 $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ?
'0' : '1';
112 if ($is_myisam_or_maria
113 && $_REQUEST['new_checksum'] !== $checksum) {
114 $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
117 $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ?
'0' : '1';
119 && $_REQUEST['new_transactional'] !== $transactional) {
120 $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional'];
123 $_REQUEST['new_page_checksum'] = empty($_REQUEST['new_page_checksum']) ?
'0' : '1';
125 && $_REQUEST['new_page_checksum'] !== $page_checksum) {
126 $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum'];
129 $delay_key_write = empty($delay_key_write) ?
'0' : '1';
130 $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ?
'0' : '1';
131 if ($is_myisam_or_maria
132 && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
133 $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
136 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
137 && ! empty($_REQUEST['new_auto_increment'])
138 && (! isset($auto_increment) ||
$_REQUEST['new_auto_increment'] !== $auto_increment)) {
139 $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
142 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
143 && ! empty($_REQUEST['new_row_format'])
144 && (! isset($row_format) ||
$_REQUEST['new_row_format'] !== $row_format)) {
145 $table_alters[] = 'ROW_FORMAT = ' . PMA_sqlAddslashes($_REQUEST['new_row_format']);
148 if (count($table_alters) > 0) {
149 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
150 $sql_query .= "\r\n" . implode("\r\n", $table_alters);
151 $result .= PMA_DBI_query($sql_query) ?
true : false;
153 unset($table_alters);
154 foreach (PMA_DBI_get_warnings() as $warning) {
155 $warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
156 . ' ' . $warning['Message'];
161 * Reordering the table has been requested by the user
163 if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
165 ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
166 ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
167 if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
168 $sql_query .= ' DESC';
170 $result = PMA_DBI_query($sql_query);
174 * A partition operation has been requested by the user
176 if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
177 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'];
178 $result = PMA_DBI_query($sql_query);
182 $page_checksum = $checksum = $delay_key_write = 0;
183 require './libraries/tbl_info.inc.php';
188 * Displays top menu links
190 require_once './libraries/tbl_links.inc.php';
192 if (isset($result)) {
193 // set to success by default, because result set could be empty
194 // (for example, a table rename)
196 if (empty($_message)) {
197 $_message = $result ?
$strSuccess : $strError;
198 // $result should exist, regardless of $_message
199 $_type = $result ?
'success' : 'error';
201 if (! empty($warning_messages)) {
202 $_message = new PMA_Message
;
203 $_message->addMessages($warning_messages);
204 $_message->isWarning(true);
205 unset($warning_messages);
207 PMA_showMessage($_message, $sql_query, $_type);
208 unset($_message, $_type);
211 $url_params['goto'] = 'tbl_operations.php';
212 $url_params['back'] = 'tbl_operations.php';
219 FROM ' . PMA_backquote($GLOBALS['table']) . '
220 FROM ' . PMA_backquote($GLOBALS['db']);
221 $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
228 <!-- Order the table
-->
229 <div id
="div_table_order">
230 <form method
="post" action
="tbl_operations.php">
231 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
232 <fieldset id
="fieldset_table_order">
233 <legend
><?php
echo $strAlterOrderBy; ?
></legend
>
234 <select name
="order_field">
236 foreach ($columns as $fieldname) {
237 echo ' <option value="' . htmlspecialchars($fieldname) . '">'
238 . htmlspecialchars($fieldname) . '</option>' . "\n";
242 </select
> <?php
echo $strSingly; ?
>
243 <select name
="order_order">
244 <option value
="asc"><?php
echo $strAscending; ?
></option
>
245 <option value
="desc"><?php
echo $strDescending; ?
></option
>
247 <input type
="submit" name
="submitorderby" value
="<?php echo $strGo; ?>" />
253 <div id
="div_table_rename">
254 <form method
="post" action
="tbl_move_copy.php"
255 onsubmit
="return emptyFormElements(this, 'new_name')">
256 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
257 <input type
="hidden" name
="reload" value
="1" />
258 <input type
="hidden" name
="what" value
="data" />
259 <fieldset id
="fieldset_table_rename">
260 <legend
><?php
echo $strMoveTable; ?
></legend
>
261 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
263 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
267 <select name
="target_db">
268 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
274 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
275 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
277 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
278 // next value but users can decide if they want it or not for the operation
280 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
281 <label
for="checkbox_auto_increment_mv"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
283 <fieldset
class="tblFooters">
284 <input type
="submit" name
="submit_move" value
="<?php echo $strGo; ?>" />
290 if (strstr($show_comment, '; InnoDB free') === false) {
291 if (strstr($show_comment, 'InnoDB free') === false) {
292 // only user entered comment
293 $comment = $show_comment;
295 // here we have just InnoDB generated part
299 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
300 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
303 // PACK_KEYS: MyISAM or ISAM
304 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
305 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
307 // nijel: Here should be version check for InnoDB, however it is supported
308 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
312 <!-- Table options
-->
313 <div id
="div_table_options">
314 <form method
="post" action
="tbl_operations.php">
315 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
316 <input type
="hidden" name
="reload" value
="1" />
318 <legend
><?php
echo $strTableOptions; ?
></legend
>
321 <!-- Change table name
-->
322 <tr
><td
><?php
echo $strRenameTable; ?
></td
>
323 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
324 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
328 <!-- Table comments
-->
329 <tr
><td
><?php
echo $strTableComments; ?
></td
>
330 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
331 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
332 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
336 <!-- Storage engine
-->
337 <tr
><td
><?php
echo $strStorageEngine; ?
>
338 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
340 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
344 <!-- Table character set
-->
345 <tr
><td
><?php
echo $strCollation; ?
></td
>
346 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
347 'tbl_collation', null, $tbl_collation, false, 3); ?
>
351 if ($is_myisam_or_maria ||
$is_isam) {
354 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
355 <td
><select name
="new_pack_keys" id
="new_pack_keys">
356 <option value
="DEFAULT"
357 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
360 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
363 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
369 } // end if (MYISAM|ISAM)
371 if ($is_myisam_or_maria) {
373 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
374 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
376 <?php
echo (isset($checksum) && $checksum == 1)
377 ?
' checked="checked"'
382 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
383 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
385 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
386 ?
' checked="checked"'
396 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
397 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
399 <?php
echo (isset($transactional) && $transactional == 1)
400 ?
' checked="checked"'
405 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
406 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
408 <?php
echo (isset($page_checksum) && $page_checksum == 1)
409 ?
' checked="checked"'
417 if (isset($auto_increment) && strlen($auto_increment) > 0
418 && ($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)) {
420 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
421 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
422 value
="<?php echo $auto_increment; ?>" /></td
>
425 } // end if (MYISAM|INNODB)
427 $possible_row_formats = array(
428 'MARIA' => array('FIXED','DYNAMIC','PAGE'),
429 'MYISAM' => array('FIXED','DYNAMIC'),
430 'PBXT' => array('FIXED','DYNAMIC'),
431 'INNODB' => array('COMPACT','REDUNDANT')
433 // for MYISAM there is also COMPRESSED but it can be set only by the
434 // myisampack utility, so don't offer here the choice because if we
435 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
436 // does not return a warning
437 // (if the table was compressed, it can be seen on the Structure page)
439 if (isset($possible_row_formats[$tbl_type])) {
440 $current_row_format = strtoupper($showtable['Row_format']);
441 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
443 PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format);
444 unset($possible_row_formats, $current_row_format);
451 <fieldset
class="tblFooters">
452 <input type
="submit" name
="submitoptions" value
="<?php echo $strGo; ?>" />
458 <div id
="div_table_copy">
459 <form method
="post" action
="tbl_move_copy.php"
460 onsubmit
="return emptyFormElements(this, 'new_name')">
461 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
462 <input type
="hidden" name
="reload" value
="1" />
464 <legend
><?php
echo $strCopyTable; ?
></legend
>
465 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
467 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
471 <select name
="target_db">
472 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
478 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" /><br
/>
481 'structure' => $strStrucOnly,
482 'data' => $strStrucData,
483 'dataonly' => $strDataOnly);
484 PMA_generate_html_radio('what', $choices, 'data', true);
488 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
489 <label
for="checkbox_drop"><?php
echo sprintf($strAddClause, 'DROP TABLE'); ?
></label
><br
/>
490 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
491 <label
for="checkbox_auto_increment_cp"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
493 // display "Add constraints" choice only if there are
495 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
497 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
498 <label
for="checkbox_constraints"><?php
echo $strAddConstraints; ?
></label
><br
/>
501 if (isset($_COOKIE['pma_switch_to_new'])
502 && $_COOKIE['pma_switch_to_new'] == 'true') {
503 $pma_switch_to_new = 'true';
506 <input type
="checkbox" name
="switch_to_new" value
="true"
507 id
="checkbox_switch"<?php
echo
508 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
509 ?
' checked="checked"'
511 <label
for="checkbox_switch"><?php
echo $strSwitchToTable; ?
></label
>
513 <fieldset
class="tblFooters">
514 <input type
="submit" name
="submit_copy" value
="<?php echo $strGo; ?>" />
519 <br
class="clearfloat"/>
521 <div id
="div_table_maintenance">
523 <legend
><?php
echo $strTableMaintenance; ?
></legend
>
527 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
528 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
529 if ($is_myisam_or_maria ||
$is_innodb) {
530 $this_url_params = array_merge($url_params,
531 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
533 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
534 <?php
echo $strCheckTable; ?
></a
>
535 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
540 $this_url_params = array_merge($url_params,
541 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
543 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
544 <?php
echo $strDefragment; ?
></a
>
545 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
549 if ($is_myisam_or_maria ||
$is_berkeleydb) {
550 $this_url_params = array_merge($url_params,
551 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
553 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
554 <?php
echo $strAnalyzeTable; ?
></a
>
555 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
559 if ($is_myisam_or_maria) {
560 $this_url_params = array_merge($url_params,
561 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
563 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
564 <?php
echo $strRepairTable; ?
></a
>
565 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
569 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
570 $this_url_params = array_merge($url_params,
571 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
573 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
574 <?php
echo $strOptimizeTable; ?
></a
>
575 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
579 } // end MYISAM or BERKELEYDB case
580 $this_url_params = array_merge($url_params,
582 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
583 'zero_rows' => sprintf($strTableHasBeenFlushed,
584 htmlspecialchars($GLOBALS['table'])),
588 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
589 <?php
echo $strFlushTable; ?
></a
>
590 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
595 <?php
if (PMA_Partition
::havePartitioning()) {
596 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
597 // show the Partition maintenance section only if we detect a partition
598 if (! is_null($partition_names[0])) {
600 <div id
="div_partition_maintenance">
601 <form method
="post" action
="tbl_operations.php">
602 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
604 <legend
><?php
echo $strPartitionMaintenance; ?
></legend
>
606 $html_select = '<select name="partition_name">' . "\n";
607 foreach($partition_names as $one_partition) {
608 $one_partition = htmlspecialchars($one_partition);
609 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
611 $html_select .= '</select>' . "\n";
612 printf($GLOBALS['strPartition'], $html_select);
613 unset($partition_names, $one_partition, $html_select);
615 'ANALYZE' => $strAnalyze,
616 'CHECK' => $strCheck,
617 'OPTIMIZE' => $strOptimize,
618 'REBUILD' => $strRebuild,
619 'REPAIR' => $strRepair);
620 PMA_generate_html_radio('partition_operation', $choices, '', false);
622 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
623 // I'm not sure of the best way to display that; this link does
624 // not depend on the Go button
625 $this_url_params = array_merge($url_params,
627 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
630 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
631 <?php
echo $strRemovePartitioning; ?
></a
>
633 <fieldset
class="tblFooters">
634 <input type
="submit" name
="submit_partition" value
="<?php echo $strGo; ?>" />
642 // Referential integrity check
643 // The Referential integrity check was intended for the non-InnoDB
644 // tables for which the relations are defined in pmadb
645 // so I assume that if the current table is InnoDB, I don't display
646 // this choice (InnoDB maintains integrity by itself)
648 if ($cfgRelation['relwork'] && ! $is_innodb) {
649 PMA_DBI_select_db($GLOBALS['db']);
650 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
654 <!-- Referential integrity check
-->
655 <div id
="div_referential_integrity">
657 <legend
><?php
echo $strReferentialIntegrity; ?
></legend
>
661 foreach ($foreign AS $master => $arr) {
662 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
663 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
664 . PMA_backquote($arr['foreign_table']);
665 if ($arr['foreign_table'] == $GLOBALS['table']) {
666 $foreign_table = $GLOBALS['table'] . '1';
667 $join_query .= ' AS ' . PMA_backquote($foreign_table);
669 $foreign_table = $arr['foreign_table'];
671 $join_query .= ' ON '
672 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
673 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
675 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
677 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
679 $this_url_params = array_merge($url_params,
680 array('sql_query' => $join_query));
683 . PMA_generate_common_url($this_url_params)
684 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
685 . '</a></li>' . "\n";
686 } // foreach $foreign
687 unset($foreign_table, $join_query);
693 } // end if ($foreign)
695 } // end if (!empty($cfg['Server']['relation']))
699 * Displays the footer
701 require_once './libraries/footer.inc.php';
704 function PMA_set_global_variables_for_engine($tbl_type)
706 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
708 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
709 $upper_tbl_type = strtoupper($tbl_type);
711 //Options that apply to MYISAM usually apply to MARIA
712 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
713 $is_maria = ($upper_tbl_type == 'MARIA');
715 $is_isam = ($upper_tbl_type == 'ISAM');
716 $is_innodb = ($upper_tbl_type == 'INNODB');
717 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
718 $is_pbxt = ($upper_tbl_type == 'PBXT');