diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php
index a3fc79c8bb..b1d1b5c2d8 100644
--- a/libraries/mult_submits.inc.php
+++ b/libraries/mult_submits.inc.php
@@ -12,6 +12,7 @@ if (! defined('PHPMYADMIN')) {
require_once 'libraries/transformations.lib.php';
require_once 'libraries/bookmark.lib.php';
require_once 'libraries/sql.lib.php';
+require_once 'libraries/mult_submits.lib.php';
$request_params = array(
'clause_is_unique',
@@ -95,18 +96,7 @@ if (! empty($submit_mult)
break;
case 'primary':
// Gets table primary key
- $GLOBALS['dbi']->selectDb($db);
- $result = $GLOBALS['dbi']->query(
- 'SHOW KEYS FROM ' . PMA_Util::backquote($table) . ';'
- );
- $primary = '';
- while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
- // Backups the list of primary keys
- if ($row['Key_name'] == 'PRIMARY') {
- $primary .= $row['Column_name'] . ', ';
- }
- } // end while
- $GLOBALS['dbi']->freeResult($result);
+ $primary = PMA_getKeyForTablePrimary($db, $table);
if (empty($primary)) {
// no primary key, so we can safely create new
unset($submit_mult);
@@ -181,7 +171,8 @@ if (!empty($submit_mult) && !empty($what)) {
foreach ($selected as $idx => $sval) {
switch ($what) {
case 'row_delete':
- $full_query .= 'DELETE FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table)
+ $full_query .= 'DELETE FROM ' . PMA_Util::backquote($db)
+ . '.' . PMA_Util::backquote($table)
. ' WHERE ' . urldecode($sval) . ' LIMIT 1'
. ';
';
break;
@@ -285,97 +276,11 @@ if (!empty($submit_mult) && !empty($what)) {
}
}
if ($what == 'replace_prefix_tbl' || $what == 'copy_tbl_change_prefix') {
- echo '
';
+ echo PMA_getHtmlForReplacePrefixTable($what, $action, $_url_params);
} elseif ($what == 'add_prefix_tbl') {
- echo '';
+ echo PMA_getHtmlForAddPrefixTable($action, $_url_params);
} else {
- echo '';
- echo '';
+ echo PMA_getHtmlForOtherActions($what, $action, $_url_params, $full_query);
}
exit;
@@ -479,37 +384,51 @@ if (!empty($submit_mult) && !empty($what)) {
case 'drop_fld':
PMA_relationsCleanupColumn($db, $table, $selected[$i]);
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) : ',')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table)
+ : ',')
. ' DROP ' . PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ';' : '');
break;
case 'primary_fld':
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . (empty($primary) ? '' : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( ' : ', ')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table) . (empty($primary)
+ ? ''
+ : ' DROP PRIMARY KEY,') . ' ADD PRIMARY KEY( '
+ : ', ')
. PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'index_fld':
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD INDEX( ' : ', ')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD INDEX( '
+ : ', ')
. PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'unique_fld':
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD UNIQUE( ' : ', ')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD UNIQUE( '
+ : ', ')
. PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'spatial_fld':
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD SPATIAL( ' : ', ')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD SPATIAL( '
+ : ', ')
. PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'fulltext_fld':
- $sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD FULLTEXT( ' : ', ')
+ $sql_query .= (empty($sql_query)
+ ? 'ALTER TABLE ' . PMA_Util::backquote($table) . ' ADD FULLTEXT( '
+ : ', ')
. PMA_Util::backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
@@ -578,7 +497,9 @@ if (!empty($submit_mult) && !empty($what)) {
} // end for
if ($query_type == 'drop_tbl') {
- $default_fk_check_value = $GLOBALS['dbi']->fetchValue('SHOW VARIABLES LIKE \'foreign_key_checks\';', 0, 1) == 'ON';
+ $default_fk_check_value = $GLOBALS['dbi']->fetchValue(
+ 'SHOW VARIABLES LIKE \'foreign_key_checks\';', 0, 1
+ ) == 'ON';
if (!empty($sql_query)) {
$sql_query .= ';';
} elseif (!empty($sql_query_views)) {
@@ -591,7 +512,7 @@ if (!empty($submit_mult) && !empty($what)) {
/**
* Parse and analyze the query
*/
- require_once 'libraries/parse_analyze.inc.php';
+ include_once 'libraries/parse_analyze.inc.php';
PMA_executeQueryAndSendQueryResponse(
$analyzed_sql_results, false, $db, $table, null, null, null,
diff --git a/libraries/mult_submits.lib.php b/libraries/mult_submits.lib.php
new file mode 100644
index 0000000000..139e74e3e0
--- /dev/null
+++ b/libraries/mult_submits.lib.php
@@ -0,0 +1,177 @@
+selectDb($db);
+ $result = $GLOBALS['dbi']->query(
+ 'SHOW KEYS FROM ' . PMA_Util::backquote($table) . ';'
+ );
+ $primary = '';
+ while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
+ // Backups the list of primary keys
+ if ($row['Key_name'] == 'PRIMARY') {
+ $primary .= $row['Column_name'] . ', ';
+ }
+ } // end while
+ $GLOBALS['dbi']->freeResult($result);
+
+ return $primary;
+}
+
+/**
+ * Gets HTML for replace_prefix_tbl or copy_tbl_change_prefix
+ *
+ * @param string $what mult_submit type
+ * @param string $action action type
+ * @param array $_url_params URL params
+ *
+ * @return string
+ */
+function PMA_getHtmlForReplacePrefixTable($what, $action, $_url_params)
+{
+ $html = '';
+
+ return $html;
+}
+
+/**
+ * Gets HTML for add_prefix_tbl
+ *
+ * @param string $action action type
+ * @param array $_url_params URL params
+ *
+ * @return string
+ */
+function PMA_getHtmlForAddPrefixTable($action, $_url_params)
+{
+ $html = '';
+
+ return $html;
+}
+
+/**
+ * Gets HTML for other mult_submits actions
+ *
+ * @param string $what mult_submit type
+ * @param string $action action type
+ * @param array $_url_params URL params
+ * @param array $full_query full sql query string
+ *
+ * @return string
+ */
+function PMA_getHtmlForOtherActions($what, $action, $_url_params, $full_query)
+{
+ $html = '';
+ $html .= '';
+
+ return $html;
+}
+
+?>