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);
98 $transactional = (isset($transactional) && $transactional == '0') ?
'0' : '1';
99 $page_checksum = (isset($page_checksum)) ?
$page_checksum : '';
103 if (! empty($_REQUEST['tbl_collation'])
104 && $_REQUEST['tbl_collation'] !== $tbl_collation) {
105 $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']);
108 if (($is_myisam_or_maria ||
$is_isam)
109 && isset($_REQUEST['new_pack_keys'])
110 && $_REQUEST['new_pack_keys'] != (string)$pack_keys) {
111 $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys'];
114 $checksum = empty($checksum) ?
'0' : '1';
115 $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ?
'0' : '1';
116 if ($is_myisam_or_maria
117 && $_REQUEST['new_checksum'] !== $checksum) {
118 $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum'];
121 $_REQUEST['new_transactional'] = empty($_REQUEST['new_transactional']) ?
'0' : '1';
123 && $_REQUEST['new_transactional'] !== $transactional) {
124 $table_alters[] = 'TRANSACTIONAL = ' . $_REQUEST['new_transactional'];
127 $_REQUEST['new_page_checksum'] = empty($_REQUEST['new_page_checksum']) ?
'0' : '1';
129 && $_REQUEST['new_page_checksum'] !== $page_checksum) {
130 $table_alters[] = 'PAGE_CHECKSUM = ' . $_REQUEST['new_page_checksum'];
133 $delay_key_write = empty($delay_key_write) ?
'0' : '1';
134 $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ?
'0' : '1';
135 if ($is_myisam_or_maria
136 && $_REQUEST['new_delay_key_write'] !== $delay_key_write) {
137 $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write'];
140 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
141 && ! empty($_REQUEST['new_auto_increment'])
142 && (! isset($auto_increment) ||
$_REQUEST['new_auto_increment'] !== $auto_increment)) {
143 $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']);
146 if (($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)
147 && ! empty($_REQUEST['new_row_format'])
148 && (! isset($row_format) ||
strtolower($_REQUEST['new_row_format']) !== strtolower($row_format))) {
149 $table_alters[] = 'ROW_FORMAT = ' . PMA_sqlAddslashes($_REQUEST['new_row_format']);
152 if (count($table_alters) > 0) {
153 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']);
154 $sql_query .= "\r\n" . implode("\r\n", $table_alters);
155 $result .= PMA_DBI_query($sql_query) ?
true : false;
157 unset($table_alters);
158 foreach (PMA_DBI_get_warnings() as $warning) {
159 // In MariaDB 5.1.44, when altering a table from Maria to MyISAM
160 // and if TRANSACTIONAL was set, the system reports an error;
161 // I discussed with a Maria developer and he agrees that this
162 // should not be reported with a Level of Error, so here
163 // I just ignore it. But there are other 1478 messages
164 // that it's better to show.
165 if (! ($_REQUEST['new_tbl_type'] == 'MyISAM' && $warning['Code'] == '1478' && $warning['Level'] == 'Error')) {
166 $warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
167 . ' ' . $warning['Message'];
173 * Reordering the table has been requested by the user
175 if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
177 ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
178 ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
179 if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
180 $sql_query .= ' DESC';
182 $result = PMA_DBI_query($sql_query);
186 * A partition operation has been requested by the user
188 if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
189 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'];
190 $result = PMA_DBI_query($sql_query);
194 // to avoid showing the old value (for example the AUTO_INCREMENT) after
195 // a change, clear the cache
196 PMA_Table
::$cache = array();
197 $page_checksum = $checksum = $delay_key_write = 0;
198 require './libraries/tbl_info.inc.php';
203 * Displays top menu links
205 require_once './libraries/tbl_links.inc.php';
207 if (isset($result) && empty($zero_rows)) {
208 // set to success by default, because result set could be empty
209 // (for example, a table rename)
211 if (empty($_message)) {
212 $_message = $result ?
__('Your SQL query has been executed successfully') : __('Error');
213 // $result should exist, regardless of $_message
214 $_type = $result ?
'success' : 'error';
216 if (! empty($warning_messages)) {
217 $_message = new PMA_Message
;
218 $_message->addMessages($warning_messages);
219 $_message->isWarning(true);
220 unset($warning_messages);
222 PMA_showMessage($_message, $sql_query, $_type);
223 unset($_message, $_type);
226 $url_params['goto'] = 'tbl_operations.php';
227 $url_params['back'] = 'tbl_operations.php';
234 FROM ' . PMA_backquote($GLOBALS['table']) . '
235 FROM ' . PMA_backquote($GLOBALS['db']);
236 $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
243 <!-- Order the table
-->
244 <div id
="div_table_order">
245 <form method
="post" action
="tbl_operations.php">
246 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
247 <fieldset id
="fieldset_table_order">
248 <legend
><?php
echo __('Alter table order by'); ?
></legend
>
249 <select name
="order_field">
251 foreach ($columns as $fieldname) {
252 echo ' <option value="' . htmlspecialchars($fieldname) . '">'
253 . htmlspecialchars($fieldname) . '</option>' . "\n";
257 </select
> <?php
echo __('(singly)'); ?
>
258 <select name
="order_order">
259 <option value
="asc"><?php
echo __('Ascending'); ?
></option
>
260 <option value
="desc"><?php
echo __('Descending'); ?
></option
>
263 <fieldset
class="tblFooters">
264 <input type
="submit" name
="submitorderby" value
="<?php echo __('Go'); ?>" />
270 <div id
="div_table_rename">
271 <form method
="post" action
="tbl_move_copy.php"
272 onsubmit
="return emptyFormElements(this, 'new_name')">
273 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
274 <input type
="hidden" name
="reload" value
="1" />
275 <input type
="hidden" name
="what" value
="data" />
276 <fieldset id
="fieldset_table_rename">
277 <legend
><?php
echo __('Move table to (database<b>.</b>table):'); ?
></legend
>
278 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
280 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
284 <select name
="target_db">
285 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
290  
;<strong
>.</strong
> 
;
291 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
292 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
294 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
295 // next value but users can decide if they want it or not for the operation
297 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
298 <label
for="checkbox_auto_increment_mv"><?php
echo __('Add AUTO_INCREMENT value'); ?
></label
><br
/>
300 <fieldset
class="tblFooters">
301 <input type
="submit" name
="submit_move" value
="<?php echo __('Go'); ?>" />
307 if (strstr($show_comment, '; InnoDB free') === false) {
308 if (strstr($show_comment, 'InnoDB free') === false) {
309 // only user entered comment
310 $comment = $show_comment;
312 // here we have just InnoDB generated part
316 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
317 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
320 // PACK_KEYS: MyISAM or ISAM
321 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
322 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
324 // Here should be version check for InnoDB, however it is supported
325 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
329 <!-- Table options
-->
330 <div id
="div_table_options">
331 <form method
="post" action
="tbl_operations.php">
332 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
333 <input type
="hidden" name
="reload" value
="1" />
335 <legend
><?php
echo __('Table options'); ?
></legend
>
338 <!-- Change table name
-->
339 <tr
><td
><?php
echo __('Rename table to'); ?
></td
>
340 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
341 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
345 <!-- Table comments
-->
346 <tr
><td
><?php
echo __('Table comments'); ?
></td
>
347 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
348 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
349 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
353 <!-- Storage engine
-->
354 <tr
><td
><?php
echo __('Storage Engine'); ?
>
355 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
357 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
361 <!-- Table character set
-->
362 <tr
><td
><?php
echo __('Collation'); ?
></td
>
363 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
364 'tbl_collation', null, $tbl_collation, false, 3); ?
>
368 if ($is_myisam_or_maria ||
$is_isam) {
371 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
372 <td
><select name
="new_pack_keys" id
="new_pack_keys">
373 <option value
="DEFAULT"
374 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
377 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
380 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
386 } // end if (MYISAM|ISAM)
388 if ($is_myisam_or_maria) {
390 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
391 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
393 <?php
echo (isset($checksum) && $checksum == 1)
394 ?
' checked="checked"'
399 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
400 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
402 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
403 ?
' checked="checked"'
413 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
414 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
416 <?php
echo (isset($transactional) && $transactional == 1)
417 ?
' checked="checked"'
422 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
423 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
425 <?php
echo (isset($page_checksum) && $page_checksum == 1)
426 ?
' checked="checked"'
434 if (isset($auto_increment) && strlen($auto_increment) > 0
435 && ($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)) {
437 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
438 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
439 value
="<?php echo $auto_increment; ?>" /></td
>
442 } // end if (MYISAM|INNODB)
444 // the outer array is for engines, the inner array contains the dropdown
445 // option values as keys then the dropdown option labels
447 $possible_row_formats = array(
450 'DYNAMIC' => 'DYNAMIC',
455 'DYNAMIC' => 'DYNAMIC'
459 'DYNAMIC' => 'DYNAMIC'
462 'COMPACT' => 'COMPACT',
463 'REDUNDANT' => 'REDUNDANT')
466 $innodb_engine_plugin = PMA_StorageEngine
::getEngine('innodb');
467 $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
468 if (!empty($innodb_plugin_version)) {
469 $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
471 $innodb_file_format = '';
473 if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
474 $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
475 $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
477 unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
479 // for MYISAM there is also COMPRESSED but it can be set only by the
480 // myisampack utility, so don't offer here the choice because if we
481 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
482 // does not return a warning
483 // (if the table was compressed, it can be seen on the Structure page)
485 if (isset($possible_row_formats[$tbl_type])) {
486 $current_row_format = strtoupper($showtable['Row_format']);
487 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
489 echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format');
490 unset($possible_row_formats, $current_row_format);
497 <fieldset
class="tblFooters">
498 <input type
="submit" name
="submitoptions" value
="<?php echo __('Go'); ?>" />
504 <div id
="div_table_copy">
505 <form method
="post" action
="tbl_move_copy.php"
506 onsubmit
="return emptyFormElements(this, 'new_name')">
507 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
508 <input type
="hidden" name
="reload" value
="1" />
510 <legend
><?php
echo __('Copy table to (database<b>.</b>table):'); ?
></legend
>
511 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
513 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
517 <select name
="target_db">
518 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
523  
;<strong
>.</strong
> 
;
524 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>"/><br
/>
527 'structure' => __('Structure only'),
528 'data' => __('Structure and data'),
529 'dataonly' => __('Data only'));
530 PMA_display_html_radio('what', $choices, 'data', true);
534 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
535 <label
for="checkbox_drop"><?php
echo sprintf(__('Add %s'), 'DROP TABLE'); ?
></label
><br
/>
536 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
537 <label
for="checkbox_auto_increment_cp"><?php
echo __('Add AUTO_INCREMENT value'); ?
></label
><br
/>
539 // display "Add constraints" choice only if there are
541 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
543 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
544 <label
for="checkbox_constraints"><?php
echo __('Add constraints'); ?
></label
><br
/>
547 if (isset($_COOKIE['pma_switch_to_new'])
548 && $_COOKIE['pma_switch_to_new'] == 'true') {
549 $pma_switch_to_new = 'true';
552 <input type
="checkbox" name
="switch_to_new" value
="true"
553 id
="checkbox_switch"<?php
echo
554 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
555 ?
' checked="checked"'
557 <label
for="checkbox_switch"><?php
echo __('Switch to copied table'); ?
></label
>
559 <fieldset
class="tblFooters">
560 <input type
="submit" name
="submit_copy" value
="<?php echo __('Go'); ?>" />
565 <br
class="clearfloat"/>
567 <div id
="div_table_maintenance">
569 <legend
><?php
echo __('Table maintenance'); ?
></legend
>
573 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
574 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
575 if ($is_myisam_or_maria ||
$is_innodb) {
576 $this_url_params = array_merge($url_params,
577 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
579 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
580 <?php
echo __('Check table'); ?
></a
>
581 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
586 $this_url_params = array_merge($url_params,
587 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
589 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
590 <?php
echo __('Defragment table'); ?
></a
>
591 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
595 if ($is_myisam_or_maria ||
$is_berkeleydb) {
596 $this_url_params = array_merge($url_params,
597 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
599 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
600 <?php
echo __('Analyze table'); ?
></a
>
601 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
605 if ($is_myisam_or_maria) {
606 $this_url_params = array_merge($url_params,
607 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
609 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
610 <?php
echo __('Repair table'); ?
></a
>
611 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
615 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
616 $this_url_params = array_merge($url_params,
617 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
619 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
620 <?php
echo __('Optimize table'); ?
></a
>
621 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
625 } // end MYISAM or BERKELEYDB case
626 $this_url_params = array_merge($url_params,
628 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
629 'zero_rows' => sprintf(__('Table %s has been flushed'),
630 htmlspecialchars($GLOBALS['table'])),
634 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
635 <?php
echo __('Flush the table (FLUSH)'); ?
></a
>
636 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
641 <?php
if (PMA_Partition
::havePartitioning()) {
642 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
643 // show the Partition maintenance section only if we detect a partition
644 if (! is_null($partition_names[0])) {
646 <div id
="div_partition_maintenance">
647 <form method
="post" action
="tbl_operations.php">
648 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
650 <legend
><?php
echo __('Partition maintenance'); ?
></legend
>
652 $html_select = '<select name="partition_name">' . "\n";
653 foreach($partition_names as $one_partition) {
654 $one_partition = htmlspecialchars($one_partition);
655 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
657 $html_select .= '</select>' . "\n";
658 printf(__('Partition %s'), $html_select);
659 unset($partition_names, $one_partition, $html_select);
661 'ANALYZE' => __('Analyze'),
662 'CHECK' => __('Check'),
663 'OPTIMIZE' => __('Optimize'),
664 'REBUILD' => __('Rebuild'),
665 'REPAIR' => __('Repair'));
666 PMA_display_html_radio('partition_operation', $choices, '', false);
668 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
669 // I'm not sure of the best way to display that; this link does
670 // not depend on the Go button
671 $this_url_params = array_merge($url_params,
673 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
676 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
677 <?php
echo __('Remove partitioning'); ?
></a
>
679 <fieldset
class="tblFooters">
680 <input type
="submit" name
="submit_partition" value
="<?php echo __('Go'); ?>" />
688 // Referential integrity check
689 // The Referential integrity check was intended for the non-InnoDB
690 // tables for which the relations are defined in pmadb
691 // so I assume that if the current table is InnoDB, I don't display
692 // this choice (InnoDB maintains integrity by itself)
694 if ($cfgRelation['relwork'] && ! $is_innodb) {
695 PMA_DBI_select_db($GLOBALS['db']);
696 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
700 <!-- Referential integrity check
-->
701 <div id
="div_referential_integrity">
703 <legend
><?php
echo __('Check referential integrity:'); ?
></legend
>
707 foreach ($foreign AS $master => $arr) {
708 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
709 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
710 . PMA_backquote($arr['foreign_table']);
711 if ($arr['foreign_table'] == $GLOBALS['table']) {
712 $foreign_table = $GLOBALS['table'] . '1';
713 $join_query .= ' AS ' . PMA_backquote($foreign_table);
715 $foreign_table = $arr['foreign_table'];
717 $join_query .= ' ON '
718 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
719 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
721 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
723 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
725 $this_url_params = array_merge($url_params,
726 array('sql_query' => $join_query));
729 . PMA_generate_common_url($this_url_params)
730 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
731 . '</a></li>' . "\n";
732 } // foreach $foreign
733 unset($foreign_table, $join_query);
739 } // end if ($foreign)
741 } // end if (!empty($cfg['Server']['relation']))
745 * Displays the footer
747 require_once './libraries/footer.inc.php';
750 function PMA_set_global_variables_for_engine($tbl_type)
752 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
754 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
755 $upper_tbl_type = strtoupper($tbl_type);
757 //Options that apply to MYISAM usually apply to MARIA
758 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
759 $is_maria = ($upper_tbl_type == 'MARIA');
761 $is_isam = ($upper_tbl_type == 'ISAM');
762 $is_innodb = ($upper_tbl_type == 'INNODB');
763 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
764 $is_pbxt = ($upper_tbl_type == 'PBXT');