2 /* vim: set expandtab sw=4 ts=4 sts=4: */
12 require_once './libraries/common.inc.php';
13 require_once './libraries/Table.class.php';
15 $pma_table = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
20 require './libraries/tbl_common.php';
21 $url_query .= '&goto=tbl_operations.php&back=tbl_operations.php';
22 $url_params['goto'] = $url_params['back'] = 'tbl_operations.php';
25 * Gets relation settings
27 require_once './libraries/relation.lib.php';
28 $cfgRelation = PMA_getRelationsParam();
31 * Gets available MySQL charsets and storage engines
33 require_once './libraries/mysql_charsets.lib.php';
34 require_once './libraries/StorageEngine.class.php';
37 * Class for partition management
39 require_once './libraries/Partition.class.php';
41 // reselect current db (needed in some cases probably due to
42 // the calling of relation.lib.php)
43 PMA_DBI_select_db($GLOBALS['db']);
46 * Gets tables informations
49 require './libraries/tbl_info.inc.php';
51 // define some globals here, for improved syntax in the conditionals
52 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
53 // set initial value of these globals, based on the current table engine
54 PMA_set_global_variables_for_engine($tbl_type);
57 // the value for transactional can be implicit
58 // (no create option found, in this case it means 1)
59 // or explicit (option found with a value of 0 or 1)
60 // ($transactional may have been set by libraries/tbl_info.inc.php,
61 // from the $create_options)
62 $transactional = (isset($transactional) && $transactional == '0') ?
'0' : '1';
63 $page_checksum = (isset($page_checksum)) ?
$page_checksum : '';
67 $table_alters = array();
70 * Updates table comment, type and options if required
72 if (isset($_REQUEST['submitoptions'])) {
74 $warning_messages = array();
76 if (isset($_REQUEST['new_name'])) {
77 if ($pma_table->rename($_REQUEST['new_name'])) {
78 $_message .= $pma_table->getLastMessage();
80 $GLOBALS['table'] = $pma_table->getName();
84 $_message .= $pma_table->getLastError();
88 if (isset($_REQUEST['comment'])
89 && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']) {
90 $table_alters[] = 'COMMENT = \'' . PMA_sqlAddslashes($_REQUEST['comment']) . '\'';
92 if (! empty($_REQUEST['new_tbl_type'])
93 && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type)) {
94 $table_alters[] = 'ENGINE = ' . $_REQUEST['new_tbl_type'];
95 $tbl_type = $_REQUEST['new_tbl_type'];
96 // reset the globals for the new engine
97 PMA_set_global_variables_for_engine($tbl_type);
100 if (! empty($_REQUEST['tbl_collation'])
101 && $_REQUEST['tbl_collation'] !== $tbl_collation) {
102 $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);
105 if (($is_myisam_or_maria ||
$is_isam)
106 && isset($_REQUEST['new_pack_keys'])
107 && $_REQUEST['new_pack_keys'] != (string)$pack_keys) {
108 $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
111 $checksum = empty($checksum) ?
'0' : '1';
112 $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ?
'0' : '1';
113 if ($is_myisam_or_maria
114 && $_REQUEST['new_checksum'] !== $checksum) {
115 $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
118 $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ?
'0' : '1';
120 && $_REQUEST['new_transactional'] !== $transactional) {
121 $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional'];
124 $_REQUEST['new_page_checksum'] = empty($_REQUEST['new_page_checksum']) ?
'0' : '1';
126 && $_REQUEST['new_page_checksum'] !== $page_checksum) {
127 $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum'];
130 $delay_key_write = empty($delay_key_write) ?
'0' : '1';
131 $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ?
'0' : '1';
132 if ($is_myisam_or_maria
133 && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
134 $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
137 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
138 && ! empty($_REQUEST['new_auto_increment'])
139 && (! isset($auto_increment) ||
$_REQUEST['new_auto_increment'] !== $auto_increment)) {
140 $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
143 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
144 && ! empty($_REQUEST['new_row_format'])
145 && (! isset($row_format) ||
strtolower($_REQUEST['new_row_format']) !== strtolower($row_format))) {
146 $table_alters[] = 'ROW_FORMAT = ' . PMA_sqlAddslashes($_REQUEST['new_row_format']);
149 if (count($table_alters) > 0) {
150 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
151 $sql_query .= "\r\n" . implode("\r\n", $table_alters);
152 $result .= PMA_DBI_query($sql_query) ?
true : false;
154 unset($table_alters);
155 foreach (PMA_DBI_get_warnings() as $warning) {
156 $warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
157 . ' ' . $warning['Message'];
162 * Reordering the table has been requested by the user
164 if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
166 ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
167 ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
168 if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
169 $sql_query .= ' DESC';
171 $result = PMA_DBI_query($sql_query);
175 * A partition operation has been requested by the user
177 if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
178 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'];
179 $result = PMA_DBI_query($sql_query);
183 // to avoid showing the old value (for example the AUTO_INCREMENT) after
184 // a change, clear the cache
185 PMA_Table
::$cache = array();
186 $page_checksum = $checksum = $delay_key_write = 0;
187 require './libraries/tbl_info.inc.php';
192 * Displays top menu links
194 require_once './libraries/tbl_links.inc.php';
196 if (isset($result)) {
197 // set to success by default, because result set could be empty
198 // (for example, a table rename)
200 if (empty($_message)) {
201 $_message = $result ?
$strSuccess : $strError;
202 // $result should exist, regardless of $_message
203 $_type = $result ?
'success' : 'error';
205 if (! empty($warning_messages)) {
206 $_message = new PMA_Message
;
207 $_message->addMessages($warning_messages);
208 $_message->isWarning(true);
209 unset($warning_messages);
211 PMA_showMessage($_message, $sql_query, $_type);
212 unset($_message, $_type);
215 $url_params['goto'] = 'tbl_operations.php';
216 $url_params['back'] = 'tbl_operations.php';
223 FROM ' . PMA_backquote($GLOBALS['table']) . '
224 FROM ' . PMA_backquote($GLOBALS['db']);
225 $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
232 <!-- Order the table
-->
233 <div id
="div_table_order">
234 <form method
="post" action
="tbl_operations.php">
235 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
236 <fieldset id
="fieldset_table_order">
237 <legend
><?php
echo $strAlterOrderBy; ?
></legend
>
238 <select name
="order_field">
240 foreach ($columns as $fieldname) {
241 echo ' <option value="' . htmlspecialchars($fieldname) . '">'
242 . htmlspecialchars($fieldname) . '</option>' . "\n";
246 </select
> <?php
echo $strSingly; ?
>
247 <select name
="order_order">
248 <option value
="asc"><?php
echo $strAscending; ?
></option
>
249 <option value
="desc"><?php
echo $strDescending; ?
></option
>
251 <input type
="submit" name
="submitorderby" value
="<?php echo $strGo; ?>" />
257 <div id
="div_table_rename">
258 <form method
="post" action
="tbl_move_copy.php"
259 onsubmit
="return emptyFormElements(this, 'new_name')">
260 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
261 <input type
="hidden" name
="reload" value
="1" />
262 <input type
="hidden" name
="what" value
="data" />
263 <fieldset id
="fieldset_table_rename">
264 <legend
><?php
echo $strMoveTable; ?
></legend
>
265 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
267 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
271 <select name
="target_db">
272 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
277  
;<strong
>.</strong
> 
;
278 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
279 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
281 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
282 // next value but users can decide if they want it or not for the operation
284 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
285 <label
for="checkbox_auto_increment_mv"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
287 <fieldset
class="tblFooters">
288 <input type
="submit" name
="submit_move" value
="<?php echo $strGo; ?>" />
294 if (strstr($show_comment, '; InnoDB free') === false) {
295 if (strstr($show_comment, 'InnoDB free') === false) {
296 // only user entered comment
297 $comment = $show_comment;
299 // here we have just InnoDB generated part
303 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
304 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
307 // PACK_KEYS: MyISAM or ISAM
308 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
309 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
311 // nijel: Here should be version check for InnoDB, however it is supported
312 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
316 <!-- Table options
-->
317 <div id
="div_table_options">
318 <form method
="post" action
="tbl_operations.php">
319 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
320 <input type
="hidden" name
="reload" value
="1" />
322 <legend
><?php
echo $strTableOptions; ?
></legend
>
325 <!-- Change table name
-->
326 <tr
><td
><?php
echo $strRenameTable; ?
></td
>
327 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
328 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
332 <!-- Table comments
-->
333 <tr
><td
><?php
echo $strTableComments; ?
></td
>
334 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
335 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
336 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
340 <!-- Storage engine
-->
341 <tr
><td
><?php
echo $strStorageEngine; ?
>
342 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
344 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
348 <!-- Table character set
-->
349 <tr
><td
><?php
echo $strCollation; ?
></td
>
350 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
351 'tbl_collation', null, $tbl_collation, false, 3); ?
>
355 if ($is_myisam_or_maria ||
$is_isam) {
358 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
359 <td
><select name
="new_pack_keys" id
="new_pack_keys">
360 <option value
="DEFAULT"
361 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
364 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
367 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
373 } // end if (MYISAM|ISAM)
375 if ($is_myisam_or_maria) {
377 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
378 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
380 <?php
echo (isset($checksum) && $checksum == 1)
381 ?
' checked="checked"'
386 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
387 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
389 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
390 ?
' checked="checked"'
400 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
401 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
403 <?php
echo (isset($transactional) && $transactional == 1)
404 ?
' checked="checked"'
409 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
410 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
412 <?php
echo (isset($page_checksum) && $page_checksum == 1)
413 ?
' checked="checked"'
421 if (isset($auto_increment) && strlen($auto_increment) > 0
422 && ($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)) {
424 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
425 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
426 value
="<?php echo $auto_increment; ?>" /></td
>
429 } // end if (MYISAM|INNODB)
431 $possible_row_formats = array(
432 'MARIA' => array('FIXED','DYNAMIC','PAGE'),
433 'MYISAM' => array('FIXED','DYNAMIC'),
434 'PBXT' => array('FIXED','DYNAMIC'),
435 'INNODB' => array('COMPACT','REDUNDANT')
437 // for MYISAM there is also COMPRESSED but it can be set only by the
438 // myisampack utility, so don't offer here the choice because if we
439 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
440 // does not return a warning
441 // (if the table was compressed, it can be seen on the Structure page)
443 if (isset($possible_row_formats[$tbl_type])) {
444 $current_row_format = strtoupper($showtable['Row_format']);
445 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
447 PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format);
448 unset($possible_row_formats, $current_row_format);
455 <fieldset
class="tblFooters">
456 <input type
="submit" name
="submitoptions" value
="<?php echo $strGo; ?>" />
462 <div id
="div_table_copy">
463 <form method
="post" action
="tbl_move_copy.php"
464 onsubmit
="return emptyFormElements(this, 'new_name')">
465 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
466 <input type
="hidden" name
="reload" value
="1" />
468 <legend
><?php
echo $strCopyTable; ?
></legend
>
469 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
471 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
475 <select name
="target_db">
476 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
481  
;<strong
>.</strong
> 
;
482 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" /><br
/>
485 'structure' => $strStrucOnly,
486 'data' => $strStrucData,
487 'dataonly' => $strDataOnly);
488 PMA_generate_html_radio('what', $choices, 'data', true);
492 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
493 <label
for="checkbox_drop"><?php
echo sprintf($strAddClause, 'DROP TABLE'); ?
></label
><br
/>
494 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
495 <label
for="checkbox_auto_increment_cp"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
497 // display "Add constraints" choice only if there are
499 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
501 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
502 <label
for="checkbox_constraints"><?php
echo $strAddConstraints; ?
></label
><br
/>
505 if (isset($_COOKIE['pma_switch_to_new'])
506 && $_COOKIE['pma_switch_to_new'] == 'true') {
507 $pma_switch_to_new = 'true';
510 <input type
="checkbox" name
="switch_to_new" value
="true"
511 id
="checkbox_switch"<?php
echo
512 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
513 ?
' checked="checked"'
515 <label
for="checkbox_switch"><?php
echo $strSwitchToTable; ?
></label
>
517 <fieldset
class="tblFooters">
518 <input type
="submit" name
="submit_copy" value
="<?php echo $strGo; ?>" />
523 <br
class="clearfloat"/>
525 <div id
="div_table_maintenance">
527 <legend
><?php
echo $strTableMaintenance; ?
></legend
>
531 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
532 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
533 if ($is_myisam_or_maria ||
$is_innodb) {
534 $this_url_params = array_merge($url_params,
535 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
537 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
538 <?php
echo $strCheckTable; ?
></a
>
539 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
544 $this_url_params = array_merge($url_params,
545 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
547 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
548 <?php
echo $strDefragment; ?
></a
>
549 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
553 if ($is_myisam_or_maria ||
$is_berkeleydb) {
554 $this_url_params = array_merge($url_params,
555 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
557 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
558 <?php
echo $strAnalyzeTable; ?
></a
>
559 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
563 if ($is_myisam_or_maria) {
564 $this_url_params = array_merge($url_params,
565 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
567 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
568 <?php
echo $strRepairTable; ?
></a
>
569 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
573 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
574 $this_url_params = array_merge($url_params,
575 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
577 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
578 <?php
echo $strOptimizeTable; ?
></a
>
579 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
583 } // end MYISAM or BERKELEYDB case
584 $this_url_params = array_merge($url_params,
586 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
587 'zero_rows' => sprintf($strTableHasBeenFlushed,
588 htmlspecialchars($GLOBALS['table'])),
592 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
593 <?php
echo $strFlushTable; ?
></a
>
594 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
599 <?php
if (PMA_Partition
::havePartitioning()) {
600 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
601 // show the Partition maintenance section only if we detect a partition
602 if (! is_null($partition_names[0])) {
604 <div id
="div_partition_maintenance">
605 <form method
="post" action
="tbl_operations.php">
606 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
608 <legend
><?php
echo $strPartitionMaintenance; ?
></legend
>
610 $html_select = '<select name="partition_name">' . "\n";
611 foreach($partition_names as $one_partition) {
612 $one_partition = htmlspecialchars($one_partition);
613 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
615 $html_select .= '</select>' . "\n";
616 printf($GLOBALS['strPartition'], $html_select);
617 unset($partition_names, $one_partition, $html_select);
619 'ANALYZE' => $strAnalyze,
620 'CHECK' => $strCheck,
621 'OPTIMIZE' => $strOptimize,
622 'REBUILD' => $strRebuild,
623 'REPAIR' => $strRepair);
624 PMA_generate_html_radio('partition_operation', $choices, '', false);
626 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
627 // I'm not sure of the best way to display that; this link does
628 // not depend on the Go button
629 $this_url_params = array_merge($url_params,
631 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
634 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
635 <?php
echo $strRemovePartitioning; ?
></a
>
637 <fieldset
class="tblFooters">
638 <input type
="submit" name
="submit_partition" value
="<?php echo $strGo; ?>" />
646 // Referential integrity check
647 // The Referential integrity check was intended for the non-InnoDB
648 // tables for which the relations are defined in pmadb
649 // so I assume that if the current table is InnoDB, I don't display
650 // this choice (InnoDB maintains integrity by itself)
652 if ($cfgRelation['relwork'] && ! $is_innodb) {
653 PMA_DBI_select_db($GLOBALS['db']);
654 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
658 <!-- Referential integrity check
-->
659 <div id
="div_referential_integrity">
661 <legend
><?php
echo $strReferentialIntegrity; ?
></legend
>
665 foreach ($foreign AS $master => $arr) {
666 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
667 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
668 . PMA_backquote($arr['foreign_table']);
669 if ($arr['foreign_table'] == $GLOBALS['table']) {
670 $foreign_table = $GLOBALS['table'] . '1';
671 $join_query .= ' AS ' . PMA_backquote($foreign_table);
673 $foreign_table = $arr['foreign_table'];
675 $join_query .= ' ON '
676 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
677 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
679 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
681 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
683 $this_url_params = array_merge($url_params,
684 array('sql_query' => $join_query));
687 . PMA_generate_common_url($this_url_params)
688 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
689 . '</a></li>' . "\n";
690 } // foreach $foreign
691 unset($foreign_table, $join_query);
697 } // end if ($foreign)
699 } // end if (!empty($cfg['Server']['relation']))
703 * Displays the footer
705 require_once './libraries/footer.inc.php';
708 function PMA_set_global_variables_for_engine($tbl_type)
710 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
712 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
713 $upper_tbl_type = strtoupper($tbl_type);
715 //Options that apply to MYISAM usually apply to MARIA
716 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
717 $is_maria = ($upper_tbl_type == 'MARIA');
719 $is_isam = ($upper_tbl_type == 'ISAM');
720 $is_innodb = ($upper_tbl_type == 'INNODB');
721 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
722 $is_pbxt = ($upper_tbl_type == 'PBXT');