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_aria = $is_isam = $is_innodb = $is_berkeleydb = $is_aria = $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_aria ||
$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_aria
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_aria
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_aria ||
$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_aria ||
$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 ?
$strSuccess : $strError;
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 $strAlterOrderBy; ?
></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 $strSingly; ?
>
259 <select name
="order_order">
260 <option value
="asc"><?php
echo $strAscending; ?
></option
>
261 <option value
="desc"><?php
echo $strDescending; ?
></option
>
263 <input type
="submit" name
="submitorderby" value
="<?php echo $strGo; ?>" />
269 <div id
="div_table_rename">
270 <form method
="post" action
="tbl_move_copy.php"
271 onsubmit
="return emptyFormElements(this, 'new_name')">
272 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
273 <input type
="hidden" name
="reload" value
="1" />
274 <input type
="hidden" name
="what" value
="data" />
275 <fieldset id
="fieldset_table_rename">
276 <legend
><?php
echo $strMoveTable; ?
></legend
>
277 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
279 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
283 <select name
="target_db">
284 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
289  
;<strong
>.</strong
> 
;
290 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
291 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" /><br
/>
293 // starting with MySQL 5.0.24, SHOW CREATE TABLE includes the AUTO_INCREMENT
294 // next value but users can decide if they want it or not for the operation
296 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_mv" checked
="checked" />
297 <label
for="checkbox_auto_increment_mv"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
299 <fieldset
class="tblFooters">
300 <input type
="submit" name
="submit_move" value
="<?php echo $strGo; ?>" />
306 if (strstr($show_comment, '; InnoDB free') === false) {
307 if (strstr($show_comment, 'InnoDB free') === false) {
308 // only user entered comment
309 $comment = $show_comment;
311 // here we have just InnoDB generated part
315 // remove InnoDB comment from end, just the minimal part (*? is non greedy)
316 $comment = preg_replace('@; InnoDB free:.*?$@', '', $show_comment);
319 // PACK_KEYS: MyISAM or ISAM
320 // DELAY_KEY_WRITE, CHECKSUM, : MyISAM only
321 // AUTO_INCREMENT: MyISAM and InnoDB since 5.0.3, PBXT
323 // nijel: Here should be version check for InnoDB, however it is supported
324 // in >5.0.4, >4.1.12 and >4.0.11, so I decided not to
328 <!-- Table options
-->
329 <div id
="div_table_options">
330 <form method
="post" action
="tbl_operations.php">
331 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
332 <input type
="hidden" name
="reload" value
="1" />
334 <legend
><?php
echo $strTableOptions; ?
></legend
>
337 <!-- Change table name
-->
338 <tr
><td
><?php
echo $strRenameTable; ?
></td
>
339 <td
><input type
="text" size
="20" name
="new_name" onfocus
="this.select()"
340 value
="<?php echo htmlspecialchars($GLOBALS['table']); ?>" />
344 <!-- Table comments
-->
345 <tr
><td
><?php
echo $strTableComments; ?
></td
>
346 <td
><input type
="text" name
="comment" maxlength
="60" size
="30"
347 value
="<?php echo htmlspecialchars($comment); ?>" onfocus
="this.select()" />
348 <input type
="hidden" name
="prev_comment" value
="<?php echo htmlspecialchars($comment); ?>" />
352 <!-- Storage engine
-->
353 <tr
><td
><?php
echo $strStorageEngine; ?
>
354 <?php
echo PMA_showMySQLDocu('Storage_engines', 'Storage_engines'); ?
>
356 <td
><?php
echo PMA_StorageEngine
::getHtmlSelect('new_tbl_type', null, $tbl_type); ?
>
360 <!-- Table character set
-->
361 <tr
><td
><?php
echo $strCollation; ?
></td
>
362 <td
><?php
echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION
,
363 'tbl_collation', null, $tbl_collation, false, 3); ?
>
367 if ($is_myisam_or_aria ||
$is_isam) {
370 <td
><label
for="new_pack_keys">PACK_KEYS
</label
></td
>
371 <td
><select name
="new_pack_keys" id
="new_pack_keys">
372 <option value
="DEFAULT"
373 <?php
if ($pack_keys == 'DEFAULT') echo 'selected="selected"'; ?
>
376 <?php
if ($pack_keys == '0') echo 'selected="selected"'; ?
>
379 <?php
if ($pack_keys == '1') echo 'selected="selected"'; ?
>
385 } // end if (MYISAM|ISAM)
387 if ($is_myisam_or_aria) {
389 <tr
><td
><label
for="new_checksum">CHECKSUM
</label
></td
>
390 <td
><input type
="checkbox" name
="new_checksum" id
="new_checksum"
392 <?php
echo (isset($checksum) && $checksum == 1)
393 ?
' checked="checked"'
398 <tr
><td
><label
for="new_delay_key_write">DELAY_KEY_WRITE
</label
></td
>
399 <td
><input type
="checkbox" name
="new_delay_key_write" id
="new_delay_key_write"
401 <?php
echo (isset($delay_key_write) && $delay_key_write == 1)
402 ?
' checked="checked"'
412 <tr
><td
><label
for="new_transactional">TRANSACTIONAL
</label
></td
>
413 <td
><input type
="checkbox" name
="new_transactional" id
="new_transactional"
415 <?php
echo (isset($transactional) && $transactional == 1)
416 ?
' checked="checked"'
421 <tr
><td
><label
for="new_page_checksum">PAGE_CHECKSUM
</label
></td
>
422 <td
><input type
="checkbox" name
="new_page_checksum" id
="new_page_checksum"
424 <?php
echo (isset($page_checksum) && $page_checksum == 1)
425 ?
' checked="checked"'
433 if (isset($auto_increment) && strlen($auto_increment) > 0
434 && ($is_myisam_or_aria ||
$is_innodb ||
$is_pbxt)) {
436 <tr
><td
><label
for="auto_increment_opt">AUTO_INCREMENT
</label
></td
>
437 <td
><input type
="text" name
="new_auto_increment" id
="auto_increment_opt"
438 value
="<?php echo $auto_increment; ?>" /></td
>
441 } // end if (MYISAM|INNODB)
443 // the outer array is for engines, the inner array contains the dropdown
444 // option values as keys then the dropdown option labels
446 $possible_row_formats = array(
449 'DYNAMIC' => 'DYNAMIC',
454 'DYNAMIC' => 'DYNAMIC',
459 'DYNAMIC' => 'DYNAMIC'
463 'DYNAMIC' => 'DYNAMIC'
466 'COMPACT' => 'COMPACT',
467 'REDUNDANT' => 'REDUNDANT')
470 $innodb_engine_plugin = PMA_StorageEngine
::getEngine('innodb');
471 $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
472 if (!empty($innodb_plugin_version)) {
473 $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
475 $innodb_file_format = '';
477 if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
478 $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
479 $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
481 unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
483 // for MYISAM there is also COMPRESSED but it can be set only by the
484 // myisampack utility, so don't offer here the choice because if we
485 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
486 // does not return a warning
487 // (if the table was compressed, it can be seen on the Structure page)
489 if (isset($possible_row_formats[$tbl_type])) {
490 $current_row_format = strtoupper($showtable['Row_format']);
491 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
493 echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format');
494 unset($possible_row_formats, $current_row_format);
501 <fieldset
class="tblFooters">
502 <input type
="submit" name
="submitoptions" value
="<?php echo $strGo; ?>" />
508 <div id
="div_table_copy">
509 <form method
="post" action
="tbl_move_copy.php"
510 onsubmit
="return emptyFormElements(this, 'new_name')">
511 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
512 <input type
="hidden" name
="reload" value
="1" />
514 <legend
><?php
echo $strCopyTable; ?
></legend
>
515 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
517 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
521 <select name
="target_db">
522 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
527  
;<strong
>.</strong
> 
;
528 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" /><br
/>
531 'structure' => $strStrucOnly,
532 'data' => $strStrucData,
533 'dataonly' => $strDataOnly);
534 PMA_display_html_radio('what', $choices, 'data', true);
538 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
539 <label
for="checkbox_drop"><?php
echo sprintf($strAddClause, 'DROP TABLE'); ?
></label
><br
/>
540 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
541 <label
for="checkbox_auto_increment_cp"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
543 // display "Add constraints" choice only if there are
545 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
547 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
548 <label
for="checkbox_constraints"><?php
echo $strAddConstraints; ?
></label
><br
/>
551 if (isset($_COOKIE['pma_switch_to_new'])
552 && $_COOKIE['pma_switch_to_new'] == 'true') {
553 $pma_switch_to_new = 'true';
556 <input type
="checkbox" name
="switch_to_new" value
="true"
557 id
="checkbox_switch"<?php
echo
558 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
559 ?
' checked="checked"'
561 <label
for="checkbox_switch"><?php
echo $strSwitchToTable; ?
></label
>
563 <fieldset
class="tblFooters">
564 <input type
="submit" name
="submit_copy" value
="<?php echo $strGo; ?>" />
569 <br
class="clearfloat"/>
571 <div id
="div_table_maintenance">
573 <legend
><?php
echo $strTableMaintenance; ?
></legend
>
577 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
578 if ($is_myisam_or_aria ||
$is_innodb ||
$is_berkeleydb) {
579 if ($is_myisam_or_aria ||
$is_innodb) {
580 $this_url_params = array_merge($url_params,
581 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
583 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
584 <?php
echo $strCheckTable; ?
></a
>
585 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
590 $this_url_params = array_merge($url_params,
591 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
593 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
594 <?php
echo $strDefragment; ?
></a
>
595 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
599 if ($is_myisam_or_aria ||
$is_berkeleydb) {
600 $this_url_params = array_merge($url_params,
601 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
603 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
604 <?php
echo $strAnalyzeTable; ?
></a
>
605 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
609 if ($is_myisam_or_aria) {
610 $this_url_params = array_merge($url_params,
611 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
613 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
614 <?php
echo $strRepairTable; ?
></a
>
615 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
619 if ($is_myisam_or_aria ||
$is_innodb ||
$is_berkeleydb) {
620 $this_url_params = array_merge($url_params,
621 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
623 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
624 <?php
echo $strOptimizeTable; ?
></a
>
625 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
629 } // end MYISAM or BERKELEYDB case
630 $this_url_params = array_merge($url_params,
632 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
633 'zero_rows' => sprintf($strTableHasBeenFlushed,
634 htmlspecialchars($GLOBALS['table'])),
638 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
639 <?php
echo $strFlushTable; ?
></a
>
640 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
645 <?php
if (PMA_Partition
::havePartitioning()) {
646 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
647 // show the Partition maintenance section only if we detect a partition
648 if (! is_null($partition_names[0])) {
650 <div id
="div_partition_maintenance">
651 <form method
="post" action
="tbl_operations.php">
652 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
654 <legend
><?php
echo $strPartitionMaintenance; ?
></legend
>
656 $html_select = '<select name="partition_name">' . "\n";
657 foreach($partition_names as $one_partition) {
658 $one_partition = htmlspecialchars($one_partition);
659 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
661 $html_select .= '</select>' . "\n";
662 printf($GLOBALS['strPartition'], $html_select);
663 unset($partition_names, $one_partition, $html_select);
665 'ANALYZE' => $strAnalyze,
666 'CHECK' => $strCheck,
667 'OPTIMIZE' => $strOptimize,
668 'REBUILD' => $strRebuild,
669 'REPAIR' => $strRepair);
670 PMA_display_html_radio('partition_operation', $choices, '', false);
672 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
673 // I'm not sure of the best way to display that; this link does
674 // not depend on the Go button
675 $this_url_params = array_merge($url_params,
677 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
680 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
681 <?php
echo $strRemovePartitioning; ?
></a
>
683 <fieldset
class="tblFooters">
684 <input type
="submit" name
="submit_partition" value
="<?php echo $strGo; ?>" />
692 // Referential integrity check
693 // The Referential integrity check was intended for the non-InnoDB
694 // tables for which the relations are defined in pmadb
695 // so I assume that if the current table is InnoDB, I don't display
696 // this choice (InnoDB maintains integrity by itself)
698 if ($cfgRelation['relwork'] && ! $is_innodb) {
699 PMA_DBI_select_db($GLOBALS['db']);
700 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
704 <!-- Referential integrity check
-->
705 <div id
="div_referential_integrity">
707 <legend
><?php
echo $strReferentialIntegrity; ?
></legend
>
711 foreach ($foreign AS $master => $arr) {
712 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
713 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
714 . PMA_backquote($arr['foreign_table']);
715 if ($arr['foreign_table'] == $GLOBALS['table']) {
716 $foreign_table = $GLOBALS['table'] . '1';
717 $join_query .= ' AS ' . PMA_backquote($foreign_table);
719 $foreign_table = $arr['foreign_table'];
721 $join_query .= ' ON '
722 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
723 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
725 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
727 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
729 $this_url_params = array_merge($url_params,
730 array('sql_query' => $join_query));
733 . PMA_generate_common_url($this_url_params)
734 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
735 . '</a></li>' . "\n";
736 } // foreach $foreign
737 unset($foreign_table, $join_query);
743 } // end if ($foreign)
745 } // end if (!empty($cfg['Server']['relation']))
749 * Displays the footer
751 require_once './libraries/footer.inc.php';
754 function PMA_set_global_variables_for_engine($tbl_type)
756 global $is_myisam_or_aria, $is_innodb, $is_isam, $is_berkeleydb, $is_aria, $is_pbxt;
758 $is_myisam_or_aria = $is_isam = $is_innodb = $is_berkeleydb = $is_aria = $is_pbxt = false;
759 $upper_tbl_type = strtoupper($tbl_type);
761 //Options that apply to MYISAM usually apply to ARIA
762 $is_myisam_or_aria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'ARIA' ||
$upper_tbl_type == 'MARIA');
763 $is_aria = ($upper_tbl_type == 'ARIA');
765 $is_isam = ($upper_tbl_type == 'ISAM');
766 $is_innodb = ($upper_tbl_type == 'INNODB');
767 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
768 $is_pbxt = ($upper_tbl_type == 'PBXT');