diff --git a/htdocs/sql/tbl_operations.php b/htdocs/sql/tbl_operations.php new file mode 100755 --- /dev/null +++ b/htdocs/sql/tbl_operations.php @@ -0,0 +1,540 @@ +rename($_REQUEST['new_name'])) { + $message .= $pma_table->getLastMessage(); + $GLOBALS['table'] = $pma_table->getName();; + $reread_info = true; + $reload = true; + } else { + $errors[] = $pma_table->getLastError(); + $message .= $pma_table->getLastError(); + } + } + if (isset($_REQUEST['comment']) + && urldecode($_REQUEST['prev_comment']) !== $_REQUEST['comment']) { + $table_alters[] = 'COMMENT = \'' . PMA_sqlAddslashes($_REQUEST['comment']) . '\''; + } + if (! empty($_REQUEST['new_tbl_type']) + && strtolower($_REQUEST['new_tbl_type']) !== strtolower($tbl_type)) { + $table_alters[] = PMA_ENGINE_KEYWORD . ' = ' . $_REQUEST['new_tbl_type']; + $tbl_type = $_REQUEST['new_tbl_type']; + } + + if (! empty($_REQUEST['tbl_collation']) + && $_REQUEST['tbl_collation'] !== $tbl_collation) { + $table_alters[] = 'DEFAULT ' . PMA_generateCharsetQueryPart($_REQUEST['tbl_collation']); + } + + $l_tbl_type = strtolower($tbl_type); + + if (($l_tbl_type === 'myisam' || $l_tbl_type === 'isam') + && isset($_REQUEST['new_pack_keys']) + && $_REQUEST['new_pack_keys'] != (string)$pack_keys) { + $table_alters[] = 'pack_keys = ' . $_REQUEST['new_pack_keys']; + } + + $checksum = empty($checksum) ? '0' : '1'; + $_REQUEST['new_checksum'] = empty($_REQUEST['new_checksum']) ? '0' : '1'; + if (($l_tbl_type === 'myisam') + && $_REQUEST['new_checksum'] !== $checksum) { + $table_alters[] = 'checksum = ' . $_REQUEST['new_checksum']; + } + + $delay_key_write = empty($delay_key_write) ? '0' : '1'; + $_REQUEST['new_delay_key_write'] = empty($_REQUEST['new_delay_key_write']) ? '0' : '1'; + if (($l_tbl_type === 'myisam') + && $_REQUEST['new_delay_key_write'] !== $delay_key_write) { + $table_alters[] = 'delay_key_write = ' . $_REQUEST['new_delay_key_write']; + } + + if (($l_tbl_type === 'myisam' || $l_tbl_type === 'innodb') + && ! empty($_REQUEST['new_auto_increment']) + && (! isset($auto_increment) || $_REQUEST['new_auto_increment'] !== $auto_increment)) { + $table_alters[] = 'auto_increment = ' . PMA_sqlAddslashes($_REQUEST['new_auto_increment']); + } + + if (count($table_alters) > 0) { + $sql_query = 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']); + $sql_query .= "\r\n" . implode("\r\n", $table_alters); + $message .= PMA_DBI_query($sql_query) ? $strSuccess : $strError; + $reread_info = true; + unset($table_alters); + } +} +/** + * Reordering the table has been requested by the user + */ +if (isset($_REQUEST['submitorderby']) && ! empty($_REQUEST['order_field'])) { + $sql_query = ' + ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' + ORDER BY ' . PMA_backquote(urldecode($_REQUEST['order_field'])); + if (isset($_REQUEST['order_order']) && $_REQUEST['order_order'] === 'desc') { + $sql_query .= ' DESC'; + } + $message = PMA_DBI_query($sql_query) ? $strSuccess : $strError; +} // end if + + +if ($reread_info) { + $checksum = $delay_key_write = 0; + require './libraries/tbl_info.inc.php'; +} +unset($reread_info); + +/** + * Displays top menu links + */ +require_once './libraries/tbl_links.inc.php'; + +$url_params['goto'] = 'tbl_operations.php'; +$url_params['back'] = 'tbl_operations.php'; + +/** + * Get columns names + */ +$local_query = ' + SHOW COLUMNS + FROM ' . PMA_backquote($GLOBALS['table']) . ' + FROM ' . PMA_backquote($GLOBALS['db']); +$columns = PMA_DBI_fetch_result($local_query, null, 'Field'); +unset($local_query); + +/** + * Displays the page + */ +?> + +
+
+ +
+ + + + +
+
+
+ + +
+
+ + + +
+ +count() > $GLOBALS['cfg']['MaxDbList']) { +?> + + + + +  .  +
+ + +
+
+
+ +
+
+
+ +5.0.4, >4.1.12 and >4.0.11, so I decided not to +// check for version +?> + + +
+
+ + +
+ + + + + + + + + + + + + + + + + + += 40100) { + ?> + + + + + + + + + + + + + + + + + + + 0 + && ($tbl_type == 'MYISAM' || $tbl_type == 'INNODB')) { + ?> + + + + +
+
+ +
+ + +
+
+
/> +
/> +
+
+
+ +
+
+
+ + +
+
+ + +
+ +count() > $GLOBALS['cfg']['MaxDbList']) { +?> + + + + +  .  +
+ + +
+ +
+ +
+ + +
+ +
+ + +
+ + /> + +
+
+ +
+
+
+ +
+ +

+ + + + + +