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 ?
$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_maria ||
$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_maria) {
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_maria ||
$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'
458 'DYNAMIC' => 'DYNAMIC'
461 'COMPACT' => 'COMPACT',
462 'REDUNDANT' => 'REDUNDANT')
465 $innodb_engine_plugin = PMA_StorageEngine
::getEngine('innodb');
466 $innodb_plugin_version = $innodb_engine_plugin->getInnodbPluginVersion();
467 if (!empty($innodb_plugin_version)) {
468 $innodb_file_format = $innodb_engine_plugin->getInnodbFileFormat();
470 $innodb_file_format = '';
472 if ('Barracuda' == $innodb_file_format && $innodb_engine_plugin->supportsFilePerTable()) {
473 $possible_row_formats['INNODB']['DYNAMIC'] = 'DYNAMIC';
474 $possible_row_formats['INNODB']['COMPRESSED'] = 'COMPRESSED';
476 unset($innodb_engine_plugin, $innodb_plugin_version, $innodb_file_format);
478 // for MYISAM there is also COMPRESSED but it can be set only by the
479 // myisampack utility, so don't offer here the choice because if we
480 // try it inside an ALTER TABLE, MySQL (at least in 5.1.23-maria)
481 // does not return a warning
482 // (if the table was compressed, it can be seen on the Structure page)
484 if (isset($possible_row_formats[$tbl_type])) {
485 $current_row_format = strtoupper($showtable['Row_format']);
486 echo '<tr><td><label for="new_row_format">ROW_FORMAT</label></td>';
488 echo PMA_generate_html_dropdown('new_row_format', $possible_row_formats[$tbl_type], $current_row_format, 'new_row_format');
489 unset($possible_row_formats, $current_row_format);
496 <fieldset
class="tblFooters">
497 <input type
="submit" name
="submitoptions" value
="<?php echo $strGo; ?>" />
503 <div id
="div_table_copy">
504 <form method
="post" action
="tbl_move_copy.php"
505 onsubmit
="return emptyFormElements(this, 'new_name')">
506 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
507 <input type
="hidden" name
="reload" value
="1" />
509 <legend
><?php
echo $strCopyTable; ?
></legend
>
510 <?php
if (count($GLOBALS['pma']->databases
) > $GLOBALS['cfg']['MaxDbList']) {
512 <input type
="text" maxlength
="100" size
="30" name
="target_db" value
="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
516 <select name
="target_db">
517 <?php
echo $GLOBALS['pma']->databases
->getHtmlOptions(true, false); ?
>
522  
;<strong
>.</strong
> 
;
523 <input type
="text" size
="20" name
="new_name" onfocus
="this.select()" /><br
/>
526 'structure' => $strStrucOnly,
527 'data' => $strStrucData,
528 'dataonly' => $strDataOnly);
529 PMA_display_html_radio('what', $choices, 'data', true);
533 <input type
="checkbox" name
="drop_if_exists" value
="true" id
="checkbox_drop" />
534 <label
for="checkbox_drop"><?php
echo sprintf($strAddClause, 'DROP TABLE'); ?
></label
><br
/>
535 <input type
="checkbox" name
="sql_auto_increment" value
="1" id
="checkbox_auto_increment_cp" />
536 <label
for="checkbox_auto_increment_cp"><?php
echo $strAddAutoIncrement; ?
></label
><br
/>
538 // display "Add constraints" choice only if there are
540 if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
542 <input type
="checkbox" name
="add_constraints" value
="1" id
="checkbox_constraints" />
543 <label
for="checkbox_constraints"><?php
echo $strAddConstraints; ?
></label
><br
/>
546 if (isset($_COOKIE['pma_switch_to_new'])
547 && $_COOKIE['pma_switch_to_new'] == 'true') {
548 $pma_switch_to_new = 'true';
551 <input type
="checkbox" name
="switch_to_new" value
="true"
552 id
="checkbox_switch"<?php
echo
553 isset($pma_switch_to_new) && $pma_switch_to_new == 'true'
554 ?
' checked="checked"'
556 <label
for="checkbox_switch"><?php
echo $strSwitchToTable; ?
></label
>
558 <fieldset
class="tblFooters">
559 <input type
="submit" name
="submit_copy" value
="<?php echo $strGo; ?>" />
564 <br
class="clearfloat"/>
566 <div id
="div_table_maintenance">
568 <legend
><?php
echo $strTableMaintenance; ?
></legend
>
572 // Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
573 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
574 if ($is_myisam_or_maria ||
$is_innodb) {
575 $this_url_params = array_merge($url_params,
576 array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table'])));
578 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
579 <?php
echo $strCheckTable; ?
></a
>
580 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?
>
585 $this_url_params = array_merge($url_params,
586 array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
588 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
589 <?php
echo $strDefragment; ?
></a
>
590 <?php
echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?
>
594 if ($is_myisam_or_maria ||
$is_berkeleydb) {
595 $this_url_params = array_merge($url_params,
596 array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table'])));
598 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
599 <?php
echo $strAnalyzeTable; ?
></a
>
600 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?
>
604 if ($is_myisam_or_maria) {
605 $this_url_params = array_merge($url_params,
606 array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table'])));
608 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
609 <?php
echo $strRepairTable; ?
></a
>
610 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?
>
614 if ($is_myisam_or_maria ||
$is_innodb ||
$is_berkeleydb) {
615 $this_url_params = array_merge($url_params,
616 array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table'])));
618 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
619 <?php
echo $strOptimizeTable; ?
></a
>
620 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?
>
624 } // end MYISAM or BERKELEYDB case
625 $this_url_params = array_merge($url_params,
627 'sql_query' => 'FLUSH TABLE ' . PMA_backquote($GLOBALS['table']),
628 'zero_rows' => sprintf($strTableHasBeenFlushed,
629 htmlspecialchars($GLOBALS['table'])),
633 <li
><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
634 <?php
echo $strFlushTable; ?
></a
>
635 <?php
echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?
>
640 <?php
if (PMA_Partition
::havePartitioning()) {
641 $partition_names = PMA_Partition
::getPartitionNames($db, $table);
642 // show the Partition maintenance section only if we detect a partition
643 if (! is_null($partition_names[0])) {
645 <div id
="div_partition_maintenance">
646 <form method
="post" action
="tbl_operations.php">
647 <?php
echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?
>
649 <legend
><?php
echo $strPartitionMaintenance; ?
></legend
>
651 $html_select = '<select name="partition_name">' . "\n";
652 foreach($partition_names as $one_partition) {
653 $one_partition = htmlspecialchars($one_partition);
654 $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n";
656 $html_select .= '</select>' . "\n";
657 printf($GLOBALS['strPartition'], $html_select);
658 unset($partition_names, $one_partition, $html_select);
660 'ANALYZE' => $strAnalyze,
661 'CHECK' => $strCheck,
662 'OPTIMIZE' => $strOptimize,
663 'REBUILD' => $strRebuild,
664 'REPAIR' => $strRepair);
665 PMA_display_html_radio('partition_operation', $choices, '', false);
667 echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance');
668 // I'm not sure of the best way to display that; this link does
669 // not depend on the Go button
670 $this_url_params = array_merge($url_params,
672 'sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING'
675 <br
/><a href
="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
676 <?php
echo $strRemovePartitioning; ?
></a
>
678 <fieldset
class="tblFooters">
679 <input type
="submit" name
="submit_partition" value
="<?php echo $strGo; ?>" />
687 // Referential integrity check
688 // The Referential integrity check was intended for the non-InnoDB
689 // tables for which the relations are defined in pmadb
690 // so I assume that if the current table is InnoDB, I don't display
691 // this choice (InnoDB maintains integrity by itself)
693 if ($cfgRelation['relwork'] && ! $is_innodb) {
694 PMA_DBI_select_db($GLOBALS['db']);
695 $foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table']);
699 <!-- Referential integrity check
-->
700 <div id
="div_referential_integrity">
702 <legend
><?php
echo $strReferentialIntegrity; ?
></legend
>
706 foreach ($foreign AS $master => $arr) {
707 $join_query = 'SELECT ' . PMA_backquote($GLOBALS['table']) . '.* FROM '
708 . PMA_backquote($GLOBALS['table']) . ' LEFT JOIN '
709 . PMA_backquote($arr['foreign_table']);
710 if ($arr['foreign_table'] == $GLOBALS['table']) {
711 $foreign_table = $GLOBALS['table'] . '1';
712 $join_query .= ' AS ' . PMA_backquote($foreign_table);
714 $foreign_table = $arr['foreign_table'];
716 $join_query .= ' ON '
717 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
718 . ' = ' . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
720 . PMA_backquote($foreign_table) . '.' . PMA_backquote($arr['foreign_field'])
722 . PMA_backquote($GLOBALS['table']) . '.' . PMA_backquote($master)
724 $this_url_params = array_merge($url_params,
725 array('sql_query' => $join_query));
728 . PMA_generate_common_url($this_url_params)
729 . '">' . $master . ' -> ' . $arr['foreign_table'] . '.' . $arr['foreign_field']
730 . '</a></li>' . "\n";
731 } // foreach $foreign
732 unset($foreign_table, $join_query);
738 } // end if ($foreign)
740 } // end if (!empty($cfg['Server']['relation']))
744 * Displays the footer
746 require_once './libraries/footer.inc.php';
749 function PMA_set_global_variables_for_engine($tbl_type)
751 global $is_myisam_or_maria, $is_innodb, $is_isam, $is_berkeleydb, $is_maria, $is_pbxt;
753 $is_myisam_or_maria = $is_isam = $is_innodb = $is_berkeleydb = $is_maria = $is_pbxt = false;
754 $upper_tbl_type = strtoupper($tbl_type);
756 //Options that apply to MYISAM usually apply to MARIA
757 $is_myisam_or_maria = ($upper_tbl_type == 'MYISAM' ||
$upper_tbl_type == 'MARIA');
758 $is_maria = ($upper_tbl_type == 'MARIA');
760 $is_isam = ($upper_tbl_type == 'ISAM');
761 $is_innodb = ($upper_tbl_type == 'INNODB');
762 $is_berkeleydb = ($upper_tbl_type == 'BERKELEYDB');
763 $is_pbxt = ($upper_tbl_type == 'PBXT');