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 // In MariaDB 5.1.44, when altering a table from Maria to MyISAM
161 // and if TRANSACTIONAL was set, the system reports an error;
162 // I discussed with a Maria developer and he agrees that this
163 // should not be reported with a Level of Error, so here
164 // I just ignore it. But there are other 1478 messages
165 // that it's better to show.
166 if (! ($_REQUEST['new_tbl_type'] == 'MyISAM' && $warning['Code'] == '1478' && $warning['Level'] == 'Error')) {
167 $warning_messages[] = $warning['Level'] . ': #' . $warning['Code']
168 . ' ' . $warning['Message'];
174 * Reordering the table has been requested by the user
176 if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) {
178 ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . '
179 ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field']));
180 if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') {
181 $sql_query .= ' DESC';
183 $result = PMA_DBI_query($sql_query);
187 * A partition operation has been requested by the user
189 if (isset($_REQUEST['submit_partition']) && ! empty($_REQUEST['partition_operation'])) {
190 $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ' . $_REQUEST['partition_operation'] . ' PARTITION ' . $_REQUEST['partition_name'];
191 $result = PMA_DBI_query($sql_query);
195 // to avoid showing the old value (for example the AUTO_INCREMENT) after
196 // a change, clear the cache
197 PMA_Table
::$cache = array();
198 $page_checksum = $checksum = $delay_key_write = 0;
199 require './libraries/tbl_info.inc.php';
204 * Displays top menu links
206 require_once './libraries/tbl_links.inc.php';
208 if (isset($result) && empty($zero_rows)) {
209 // set to success by default, because result set could be empty
210 // (for example, a table rename)
212 if (empty($_message)) {
213 $_message = $result ?
__('Your SQL query has been executed successfully') : __('Error');
214 // $result should exist, regardless of $_message
215 $_type = $result ?
'success' : 'error';
217 if (! empty($warning_messages)) {
218 $_message = new PMA_Message
;
219 $_message->addMessages($warning_messages);
220 $_message->isWarning(true);
221 unset($warning_messages);
223 PMA_showMessage($_message, $sql_query, $_type);
224 unset($_message, $_type);
227 $url_params['goto'] = 'tbl_operations.php';
228 $url_params['back'] = 'tbl_operations.php';
235 FROM ' . PMA_backquote($GLOBALS['table']) . '
236 FROM ' . PMA_backquote($GLOBALS['db']);
237 $columns = PMA_DBI_fetch_result($local_query, null, 'Field');
244 <!-- Order the table
-->
245 <div id
="div_table_order">
246 <form method
="post" action
="tbl_operations.php">
247 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
248 <fieldset id
="fieldset_table_order">
249 <legend
><?php
echo __('Alter table order by'); ?
></legend
>
250 <select name
="order_field">
252 foreach ($columns as $fieldname) {
253 echo ' <option value="' . htmlspecialchars($fieldname) . '">'
254 . htmlspecialchars($fieldname) . '</option>' . "\n";
258 </select
> <?php
echo __('(singly)'); ?
>
259 <select name
="order_order">
260 <option value
="asc"><?php
echo __('Ascending'); ?
></option
>
261 <option value
="desc"><?php
echo __('Descending'); ?
></option
>
264 <fieldset
class="tblFooters">
265 <input type
="submit" name
="submitorderby" value
="<?php echo __('Go'); ?>" />
271 <div id
="div_table_rename">
272 <form method
="post" action
="tbl_move_copy.php"
273 onsubmit
="return emptyFormElements(this, 'new_name')">
274 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
275 <input type
="hidden" name
="reload" value
="1" />
276 <input type
="hidden" name
="what" value
="data" />
277 <fieldset id
="fieldset_table_rename">
278 <legend
><?php
echo __('Move table to (database<b>.</b>table):'); ?
></legend
>
279 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
281 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
285 <select name
="target_db">
286 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
291  
;<strong
>.</strong
> 
;
292 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
293 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
295 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
296 // next value but users can decide if they want it or not for the operation
298 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
299 <label
for="checkbox_auto_increment_mv"><?php
echo __('Add AUTO_INCREMENT value'); ?
></label
><br
/>
301 <fieldset
class="tblFooters">
302 <input type
="submit" name
="submit_move" value
="<?php echo __('Go'); ?>" />
308 if (strstr($show_comment, '; InnoDB free') === false) {
309 if (strstr($show_comment, 'InnoDB free') === false) {
310 // only user entered comment
311 $comment = $show_comment;
313 // here we have just InnoDB generated part
317 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
318 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
321 // PACK_KEYS: MyISAM or ISAM
322 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
323 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
325 // Here should be version check for InnoDB, however it is supported
326 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
330 <!-- Table options
-->
331 <div id
="div_table_options">
332 <form method
="post" action
="tbl_operations.php">
333 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
334 <input type
="hidden" name
="reload" value
="1" />
336 <legend
><?php
echo __('Table options'); ?
></legend
>
339 <!-- Change table name
-->
340 <tr
><td
><?php
echo __('Rename table to'); ?
></td
>
341 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
342 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
346 <!-- Table comments
-->
347 <tr
><td
><?php
echo __('Table comments'); ?
></td
>
348 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
349 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
350 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
354 <!-- Storage engine
-->
355 <tr
><td
><?php
echo __('Storage Engine'); ?
>
356 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
358 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
362 <!-- Table character set
-->
363 <tr
><td
><?php
echo __('Collation'); ?
></td
>
364 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
365 'tbl_collation', null, $tbl_collation, false, 3); ?
>
369 if ($is_myisam_or_maria ||
$is_isam) {
372 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
373 <td
><select name
="new_pack_keys" id
="new_pack_keys">
374 <option value
="DEFAULT"
375 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
378 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
381 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
387 } // end if (MYISAM|ISAM)
389 if ($is_myisam_or_maria) {
391 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
392 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
394 <?php
echo (isset($checksum) && $checksum == 1)
395 ?
' checked="checked"'
400 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
401 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
403 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
404 ?
' checked="checked"'
414 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
415 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
417 <?php
echo (isset($transactional) && $transactional == 1)
418 ?
' checked="checked"'
423 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
424 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
426 <?php
echo (isset($page_checksum) && $page_checksum == 1)
427 ?
' checked="checked"'
435 if (isset($auto_increment) && strlen($auto_increment) > 0
436 && ($is_myisam_or_maria ||
$is_innodb ||
$is_pbxt)) {
438 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
439 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
440 value
="<?php echo $auto_increment; ?>" /></td
>
443 } // end if (MYISAM|INNODB)
445 // the outer array is for engines, the inner array contains the dropdown
446 // option values as keys then the dropdown option labels
448 $possible_row_formats = array(
451 'DYNAMIC' => 'DYNAMIC',
456 'DYNAMIC' => 'DYNAMIC'
460 'DYNAMIC' => 'DYNAMIC'
463 'COMPACT' => 'COMPACT',
464 'REDUNDANT' => 'REDUNDANT')
467 $innodb_engine_plugin = PMA_StorageEngine
::getEngine('innodb');
468 $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
469 if (!empty($innodb_plugin_version)) {
470 $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
472 $innodb_file_format = '';
474 if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
475 $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
476 $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
478 unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
480 // for MYISAM there is also COMPRESSED but it can be set only by the
481 // myisampack utility, so don't offer here the choice because if we
482 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
483 // does not return a warning
484 // (if the table was compressed, it can be seen on the Structure page)
486 if (isset($possible_row_formats[$tbl_type])) {
487 $current_row_format = strtoupper($showtable['Row_format']);
488 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
490 echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format');
491 unset($possible_row_formats, $current_row_format);
498 <fieldset
class="tblFooters">
499 <input type
="submit" name
="submitoptions" value
="<?php echo __('Go'); ?>" />
505 <div id
="div_table_copy">
506 <form method
="post" action
="tbl_move_copy.php"
507 onsubmit
="return emptyFormElements(this, 'new_name')">
508 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
509 <input type
="hidden" name
="reload" value
="1" />
511 <legend
><?php
echo __('Copy table to (database<b>.</b>table):'); ?
></legend
>
512 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
514 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
518 <select name
="target_db">
519 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
524  
;<strong
>.</strong
> 
;
525 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>"/><br
/>
528 'structure' => __('Structure only'),
529 'data' => __('Structure and data'),
530 'dataonly' => __('Data only'));
531 PMA_display_html_radio('what', $choices, 'data', true);
535 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
536 <label
for="checkbox_drop"><?php
echo sprintf(__('Add %s'), 'DROP TABLE'); ?
></label
><br
/>
537 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
538 <label
for="checkbox_auto_increment_cp"><?php
echo __('Add AUTO_INCREMENT value'); ?
></label
><br
/>
540 // display "Add constraints" choice only if there are
542 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
544 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
545 <label
for="checkbox_constraints"><?php
echo __('Add constraints'); ?
></label
><br
/>
548 if (isset($_COOKIE['pma_switch_to_new'])
549 && $_COOKIE['pma_switch_to_new'] == 'true') {
550 $pma_switch_to_new = 'true';
553 <input type
="checkbox" name
="switch_to_new" value
="true"
554 id
="checkbox_switch"<?php
echo
555 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
556 ?
' checked="checked"'
558 <label
for="checkbox_switch"><?php
echo __('Switch to copied table'); ?
></label
>
560 <fieldset
class="tblFooters">
561 <input type
="submit" name
="submit_copy" value
="<?php echo __('Go'); ?>" />
566 <br
class="clearfloat"/>
568 <div id
="div_table_maintenance">
570 <legend
><?php
echo __('Table maintenance'); ?
></legend
>
574 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
575 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
576 if ($is_myisam_or_maria ||
$is_innodb) {
577 $this_url_params = array_merge($url_params,
578 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
580 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
581 <?php
echo __('Check table'); ?
></a
>
582 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
587 $this_url_params = array_merge($url_params,
588 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
590 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
591 <?php
echo __('Defragment table'); ?
></a
>
592 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
596 if ($is_myisam_or_maria ||
$is_berkeleydb) {
597 $this_url_params = array_merge($url_params,
598 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
600 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
601 <?php
echo __('Analyze table'); ?
></a
>
602 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
606 if ($is_myisam_or_maria) {
607 $this_url_params = array_merge($url_params,
608 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
610 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
611 <?php
echo __('Repair table'); ?
></a
>
612 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
616 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
617 $this_url_params = array_merge($url_params,
618 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
620 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
621 <?php
echo __('Optimize table'); ?
></a
>
622 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
626 } // end MYISAM or BERKELEYDB case
627 $this_url_params = array_merge($url_params,
629 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
630 'zero_rows' => sprintf(__('Table %s has been flushed'),
631 htmlspecialchars($GLOBALS['table'])),
635 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
636 <?php
echo __('Flush the table (FLUSH)'); ?
></a
>
637 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
642 <?php
if (PMA_Partition
::havePartitioning()) {
643 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
644 // show the Partition maintenance section only if we detect a partition
645 if (! is_null($partition_names[0])) {
647 <div id
="div_partition_maintenance">
648 <form method
="post" action
="tbl_operations.php">
649 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
651 <legend
><?php
echo __('Partition maintenance'); ?
></legend
>
653 $html_select = '<select name="partition_name">' . "\n";
654 foreach($partition_names as $one_partition) {
655 $one_partition = htmlspecialchars($one_partition);
656 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
658 $html_select .= '</select>' . "\n";
659 printf(__('Partition %s'), $html_select);
660 unset($partition_names, $one_partition, $html_select);
662 'ANALYZE' => __('Analyze'),
663 'CHECK' => __('Check'),
664 'OPTIMIZE' => __('Optimize'),
665 'REBUILD' => __('Rebuild'),
666 'REPAIR' => __('Repair'));
667 PMA_display_html_radio('partition_operation', $choices, '', false);
669 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
670 // I'm not sure of the best way to display that; this link does
671 // not depend on the Go button
672 $this_url_params = array_merge($url_params,
674 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
677 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
678 <?php
echo __('Remove partitioning'); ?
></a
>
680 <fieldset
class="tblFooters">
681 <input type
="submit" name
="submit_partition" value
="<?php echo __('Go'); ?>" />
689 // Referential integrity check
690 // The Referential integrity check was intended for the non-InnoDB
691 // tables for which the relations are defined in pmadb
692 // so I assume that if the current table is InnoDB, I don't display
693 // this choice (InnoDB maintains integrity by itself)
695 if ($cfgRelation['relwork'] && ! $is_innodb) {
696 PMA_DBI_select_db($GLOBALS['db']);
697 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
701 <!-- Referential integrity check
-->
702 <div id
="div_referential_integrity">
704 <legend
><?php
echo __('Check referential integrity:'); ?
></legend
>
708 foreach ($foreign AS $master => $arr) {
709 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
710 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
711 . PMA_backquote($arr['foreign_table']);
712 if ($arr['foreign_table'] == $GLOBALS['table']) {
713 $foreign_table = $GLOBALS['table'] . '1';
714 $join_query .= ' AS ' . PMA_backquote($foreign_table);
716 $foreign_table = $arr['foreign_table'];
718 $join_query .= ' ON '
719 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
720 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
722 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
724 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
726 $this_url_params = array_merge($url_params,
727 array('sql_query' => $join_query));
730 . PMA_generate_common_url($this_url_params)
731 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
732 . '</a></li>' . "\n";
733 } // foreach $foreign
734 unset($foreign_table, $join_query);
740 } // end if ($foreign)
742 } // end if (!empty($cfg['Server']['relation']))
746 * Displays the footer
748 require_once './libraries/footer.inc.php';
751 function PMA_set_global_variables_for_engine($tbl_type)
753 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
755 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
756 $upper_tbl_type = strtoupper($tbl_type);
758 //Options that apply to MYISAM usually apply to MARIA
759 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
760 $is_maria = ($upper_tbl_type == 'MARIA');
762 $is_isam = ($upper_tbl_type == 'ISAM');
763 $is_innodb = ($upper_tbl_type == 'INNODB');
764 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
765 $is_pbxt = ($upper_tbl_type == 'PBXT');