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);
99 $transactional = (isset($transactional) && $transactional == '0') ?
'0' : '1';
100 $page_checksum = (isset($page_checksum)) ?
$page_checksum : '';
104 if (! empty($_REQUEST['tbl_collation'])
105 && $_REQUEST['tbl_collation'] !== $tbl_collation) {
106 $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);
109 if (($is_myisam_or_maria ||
$is_isam)
110 && isset($_REQUEST['new_pack_keys'])
111 && $_REQUEST['new_pack_keys'] != (string)$pack_keys) {
112 $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
115 $checksum = empty($checksum) ?
'0' : '1';
116 $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ?
'0' : '1';
117 if ($is_myisam_or_maria
118 && $_REQUEST['new_checksum'] !== $checksum) {
119 $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
122 $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ?
'0' : '1';
124 && $_REQUEST['new_transactional'] !== $transactional) {
125 $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional'];
128 $_REQUEST['new_page_checksum'] = empty($_REQUEST['new_page_checksum']) ?
'0' : '1';
130 && $_REQUEST['new_page_checksum'] !== $page_checksum) {
131 $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum'];
134 $delay_key_write = empty($delay_key_write) ?
'0' : '1';
135 $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ?
'0' : '1';
136 if ($is_myisam_or_maria
137 && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
138 $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
141 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
142 && ! empty($_REQUEST['new_auto_increment'])
143 && (! isset($auto_increment) ||
$_REQUEST['new_auto_increment'] !== $auto_increment)) {
144 $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
147 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
148 && ! empty($_REQUEST['new_row_format'])
149 && (! isset($row_format) ||
strtolower($_REQUEST['new_row_format']) !== strtolower($row_format))) {
150 $table_alters[] = 'ROW_FORMAT = ' . PMA_sqlAddslashes($_REQUEST['new_row_format']);
153 if (count($table_alters) > 0) {
154 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
155 $sql_query .= "\r\n" . implode("\r\n", $table_alters);
156 $result .= PMA_DBI_query($sql_query) ?
true : false;
158 unset($table_alters);
159 foreach (PMA_DBI_get_warnings() as $warning) {
160 $warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
161 . ' ' . $warning['Message'];
166 * Reordering the table has been requested by the user
168 if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
170 ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
171 ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
172 if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
173 $sql_query .= ' DESC';
175 $result = PMA_DBI_query($sql_query);
179 * A partition operation has been requested by the user
181 if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
182 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'];
183 $result = PMA_DBI_query($sql_query);
187 // to avoid showing the old value (for example the AUTO_INCREMENT) after
188 // a change, clear the cache
189 PMA_Table
::$cache = array();
190 $page_checksum = $checksum = $delay_key_write = 0;
191 require './libraries/tbl_info.inc.php';
196 * Displays top menu links
198 require_once './libraries/tbl_links.inc.php';
200 if (isset($result) && empty($zero_rows)) {
201 // set to success by default, because result set could be empty
202 // (for example, a table rename)
204 if (empty($_message)) {
205 $_message = $result ?
$strSuccess : $strError;
206 // $result should exist, regardless of $_message
207 $_type = $result ?
'success' : 'error';
209 if (! empty($warning_messages)) {
210 $_message = new PMA_Message
;
211 $_message->addMessages($warning_messages);
212 $_message->isWarning(true);
213 unset($warning_messages);
215 PMA_showMessage($_message, $sql_query, $_type);
216 unset($_message, $_type);
219 $url_params['goto'] = 'tbl_operations.php';
220 $url_params['back'] = 'tbl_operations.php';
227 FROM ' . PMA_backquote($GLOBALS['table']) . '
228 FROM ' . PMA_backquote($GLOBALS['db']);
229 $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
236 <!-- Order the table
-->
237 <div id
="div_table_order">
238 <form method
="post" action
="tbl_operations.php">
239 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
240 <fieldset id
="fieldset_table_order">
241 <legend
><?php
echo $strAlterOrderBy; ?
></legend
>
242 <select name
="order_field">
244 foreach ($columns as $fieldname) {
245 echo ' <option value="' . htmlspecialchars($fieldname) . '">'
246 . htmlspecialchars($fieldname) . '</option>' . "\n";
250 </select
> <?php
echo $strSingly; ?
>
251 <select name
="order_order">
252 <option value
="asc"><?php
echo $strAscending; ?
></option
>
253 <option value
="desc"><?php
echo $strDescending; ?
></option
>
255 <input type
="submit" name
="submitorderby" value
="<?php echo $strGo; ?>" />
261 <div id
="div_table_rename">
262 <form method
="post" action
="tbl_move_copy.php"
263 onsubmit
="return emptyFormElements(this, 'new_name')">
264 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
265 <input type
="hidden" name
="reload" value
="1" />
266 <input type
="hidden" name
="what" value
="data" />
267 <fieldset id
="fieldset_table_rename">
268 <legend
><?php
echo $strMoveTable; ?
></legend
>
269 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
271 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
275 <select name
="target_db">
276 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
281  
;<strong
>.</strong
> 
;
282 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
283 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
285 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
286 // next value but users can decide if they want it or not for the operation
288 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
289 <label
for="checkbox_auto_increment_mv"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
291 <fieldset
class="tblFooters">
292 <input type
="submit" name
="submit_move" value
="<?php echo $strGo; ?>" />
298 if (strstr($show_comment, '; InnoDB free') === false) {
299 if (strstr($show_comment, 'InnoDB free') === false) {
300 // only user entered comment
301 $comment = $show_comment;
303 // here we have just InnoDB generated part
307 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
308 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
311 // PACK_KEYS: MyISAM or ISAM
312 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
313 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
315 // nijel: Here should be version check for InnoDB, however it is supported
316 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
320 <!-- Table options
-->
321 <div id
="div_table_options">
322 <form method
="post" action
="tbl_operations.php">
323 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
324 <input type
="hidden" name
="reload" value
="1" />
326 <legend
><?php
echo $strTableOptions; ?
></legend
>
329 <!-- Change table name
-->
330 <tr
><td
><?php
echo $strRenameTable; ?
></td
>
331 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
332 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
336 <!-- Table comments
-->
337 <tr
><td
><?php
echo $strTableComments; ?
></td
>
338 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
339 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
340 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
344 <!-- Storage engine
-->
345 <tr
><td
><?php
echo $strStorageEngine; ?
>
346 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
348 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
352 <!-- Table character set
-->
353 <tr
><td
><?php
echo $strCollation; ?
></td
>
354 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
355 'tbl_collation', null, $tbl_collation, false, 3); ?
>
359 if ($is_myisam_or_maria ||
$is_isam) {
362 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
363 <td
><select name
="new_pack_keys" id
="new_pack_keys">
364 <option value
="DEFAULT"
365 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
368 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
371 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
377 } // end if (MYISAM|ISAM)
379 if ($is_myisam_or_maria) {
381 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
382 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
384 <?php
echo (isset($checksum) && $checksum == 1)
385 ?
' checked="checked"'
390 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
391 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
393 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
394 ?
' checked="checked"'
404 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
405 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
407 <?php
echo (isset($transactional) && $transactional == 1)
408 ?
' checked="checked"'
413 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
414 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
416 <?php
echo (isset($page_checksum) && $page_checksum == 1)
417 ?
' checked="checked"'
425 if (isset($auto_increment) && strlen($auto_increment) > 0
426 && ($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)) {
428 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
429 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
430 value
="<?php echo $auto_increment; ?>" /></td
>
433 } // end if (MYISAM|INNODB)
435 // the outer array is for engines, the inner array contains the dropdown
436 // option values as keys then the dropdown option labels
438 $possible_row_formats = array(
441 'DYNAMIC' => 'DYNAMIC',
446 'DYNAMIC' => 'DYNAMIC'
450 'DYNAMIC' => 'DYNAMIC'
453 'COMPACT' => 'COMPACT',
454 'REDUNDANT' => 'REDUNDANT')
457 $innodb_engine_plugin = PMA_StorageEngine
::getEngine('innodb');
458 $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
459 if (!empty($innodb_plugin_version)) {
460 $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
462 $innodb_file_format = '';
464 if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
465 $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
466 $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
468 unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
470 // for MYISAM there is also COMPRESSED but it can be set only by the
471 // myisampack utility, so don't offer here the choice because if we
472 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
473 // does not return a warning
474 // (if the table was compressed, it can be seen on the Structure page)
476 if (isset($possible_row_formats[$tbl_type])) {
477 $current_row_format = strtoupper($showtable['Row_format']);
478 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
480 echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format');
481 unset($possible_row_formats, $current_row_format);
488 <fieldset
class="tblFooters">
489 <input type
="submit" name
="submitoptions" value
="<?php echo $strGo; ?>" />
495 <div id
="div_table_copy">
496 <form method
="post" action
="tbl_move_copy.php"
497 onsubmit
="return emptyFormElements(this, 'new_name')">
498 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
499 <input type
="hidden" name
="reload" value
="1" />
501 <legend
><?php
echo $strCopyTable; ?
></legend
>
502 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
504 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
508 <select name
="target_db">
509 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
514  
;<strong
>.</strong
> 
;
515 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" /><br
/>
518 'structure' => $strStrucOnly,
519 'data' => $strStrucData,
520 'dataonly' => $strDataOnly);
521 PMA_display_html_radio('what', $choices, 'data', true);
525 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
526 <label
for="checkbox_drop"><?php
echo sprintf($strAddClause, 'DROP TABLE'); ?
></label
><br
/>
527 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
528 <label
for="checkbox_auto_increment_cp"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
530 // display "Add constraints" choice only if there are
532 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
534 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
535 <label
for="checkbox_constraints"><?php
echo $strAddConstraints; ?
></label
><br
/>
538 if (isset($_COOKIE['pma_switch_to_new'])
539 && $_COOKIE['pma_switch_to_new'] == 'true') {
540 $pma_switch_to_new = 'true';
543 <input type
="checkbox" name
="switch_to_new" value
="true"
544 id
="checkbox_switch"<?php
echo
545 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
546 ?
' checked="checked"'
548 <label
for="checkbox_switch"><?php
echo $strSwitchToTable; ?
></label
>
550 <fieldset
class="tblFooters">
551 <input type
="submit" name
="submit_copy" value
="<?php echo $strGo; ?>" />
556 <br
class="clearfloat"/>
558 <div id
="div_table_maintenance">
560 <legend
><?php
echo $strTableMaintenance; ?
></legend
>
564 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
565 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
566 if ($is_myisam_or_maria ||
$is_innodb) {
567 $this_url_params = array_merge($url_params,
568 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
570 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
571 <?php
echo $strCheckTable; ?
></a
>
572 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
577 $this_url_params = array_merge($url_params,
578 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
580 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
581 <?php
echo $strDefragment; ?
></a
>
582 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
586 if ($is_myisam_or_maria ||
$is_berkeleydb) {
587 $this_url_params = array_merge($url_params,
588 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
590 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
591 <?php
echo $strAnalyzeTable; ?
></a
>
592 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
596 if ($is_myisam_or_maria) {
597 $this_url_params = array_merge($url_params,
598 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
600 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
601 <?php
echo $strRepairTable; ?
></a
>
602 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
606 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
607 $this_url_params = array_merge($url_params,
608 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
610 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
611 <?php
echo $strOptimizeTable; ?
></a
>
612 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
616 } // end MYISAM or BERKELEYDB case
617 $this_url_params = array_merge($url_params,
619 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
620 'zero_rows' => sprintf($strTableHasBeenFlushed,
621 htmlspecialchars($GLOBALS['table'])),
625 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
626 <?php
echo $strFlushTable; ?
></a
>
627 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
632 <?php
if (PMA_Partition
::havePartitioning()) {
633 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
634 // show the Partition maintenance section only if we detect a partition
635 if (! is_null($partition_names[0])) {
637 <div id
="div_partition_maintenance">
638 <form method
="post" action
="tbl_operations.php">
639 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
641 <legend
><?php
echo $strPartitionMaintenance; ?
></legend
>
643 $html_select = '<select name="partition_name">' . "\n";
644 foreach($partition_names as $one_partition) {
645 $one_partition = htmlspecialchars($one_partition);
646 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
648 $html_select .= '</select>' . "\n";
649 printf($GLOBALS['strPartition'], $html_select);
650 unset($partition_names, $one_partition, $html_select);
652 'ANALYZE' => $strAnalyze,
653 'CHECK' => $strCheck,
654 'OPTIMIZE' => $strOptimize,
655 'REBUILD' => $strRebuild,
656 'REPAIR' => $strRepair);
657 PMA_display_html_radio('partition_operation', $choices, '', false);
659 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
660 // I'm not sure of the best way to display that; this link does
661 // not depend on the Go button
662 $this_url_params = array_merge($url_params,
664 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
667 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
668 <?php
echo $strRemovePartitioning; ?
></a
>
670 <fieldset
class="tblFooters">
671 <input type
="submit" name
="submit_partition" value
="<?php echo $strGo; ?>" />
679 // Referential integrity check
680 // The Referential integrity check was intended for the non-InnoDB
681 // tables for which the relations are defined in pmadb
682 // so I assume that if the current table is InnoDB, I don't display
683 // this choice (InnoDB maintains integrity by itself)
685 if ($cfgRelation['relwork'] && ! $is_innodb) {
686 PMA_DBI_select_db($GLOBALS['db']);
687 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
691 <!-- Referential integrity check
-->
692 <div id
="div_referential_integrity">
694 <legend
><?php
echo $strReferentialIntegrity; ?
></legend
>
698 foreach ($foreign AS $master => $arr) {
699 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
700 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
701 . PMA_backquote($arr['foreign_table']);
702 if ($arr['foreign_table'] == $GLOBALS['table']) {
703 $foreign_table = $GLOBALS['table'] . '1';
704 $join_query .= ' AS ' . PMA_backquote($foreign_table);
706 $foreign_table = $arr['foreign_table'];
708 $join_query .= ' ON '
709 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
710 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
712 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
714 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
716 $this_url_params = array_merge($url_params,
717 array('sql_query' => $join_query));
720 . PMA_generate_common_url($this_url_params)
721 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
722 . '</a></li>' . "\n";
723 } // foreach $foreign
724 unset($foreign_table, $join_query);
730 } // end if ($foreign)
732 } // end if (!empty($cfg['Server']['relation']))
736 * Displays the footer
738 require_once './libraries/footer.inc.php';
741 function PMA_set_global_variables_for_engine($tbl_type)
743 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
745 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
746 $upper_tbl_type = strtoupper($tbl_type);
748 //Options that apply to MYISAM usually apply to MARIA
749 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
750 $is_maria = ($upper_tbl_type == 'MARIA');
752 $is_isam = ($upper_tbl_type == 'ISAM');
753 $is_innodb = ($upper_tbl_type == 'INNODB');
754 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
755 $is_pbxt = ($upper_tbl_type == 'PBXT');