getVirtualTables($db); /** * Displays the confirmation form if required */ if (!empty($submit_mult) && !empty($what)) { unset($message); if (strlen($table)) { include './libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_sql.php&back=tbl_sql.php'; include './libraries/tbl_info.inc.php'; } elseif (strlen($db)) { include './libraries/db_common.inc.php'; include './libraries/db_info.inc.php'; } else { include_once './libraries/server_common.inc.php'; } // Builds the query list($full_query, $reload, $full_query_views) = PMA_getQueryFromSelected( $what, $db, $table, $selected, $action, $views ); // Displays the confirmation form $_url_params = PMA_getUrlParams( $what, $reload, $action, $db, $table, $selected, $views, isset($original_sql_query)? $original_sql_query : null, isset($original_url_query)? $original_url_query : null ); if ($what == 'replace_prefix_tbl' || $what == 'copy_tbl_change_prefix') { echo PMA_getHtmlForReplacePrefixTable($what, $action, $_url_params); } elseif ($what == 'add_prefix_tbl') { echo PMA_getHtmlForAddPrefixTable($action, $_url_params); } else { echo PMA_getHtmlForOtherActions($what, $action, $_url_params, $full_query); } exit; } elseif (! empty($mult_btn) && $mult_btn == __('Yes')) { /** * Executes the query - dropping rows, columns/fields, tables or dbs */ if ($query_type == 'drop_db' || $query_type == 'drop_tbl' || $query_type == 'drop_fld' ) { include_once './libraries/relation_cleanup.lib.php'; } if ($query_type == 'primary_fld') { // 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); } list( $result, $rebuild_database_list, $reload_ret, $run_parts, $use_sql, $sql_query, $sql_query_views ) = PMA_getQueryStrFromSelected( $query_type, $selected, $db, $table, $views, isset($primary) ? $primary : null, isset($from_prefix) ? $from_prefix : null, isset($to_prefix) ? $to_prefix : null ); //update the existed variable if (isset($reload_ret)) { $reload = $reload_ret; } if ($query_type == 'drop_tbl') { $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)) { $sql_query = $sql_query_views . ';'; unset($sql_query_views); } } if ($use_sql) { /** * Parse and analyze the query */ include_once 'libraries/parse_analyze.inc.php'; PMA_executeQueryAndSendQueryResponse( $analyzed_sql_results, false, $db, $table, null, null, null, false, null, null, null, null, $goto, $pmaThemeImage, null, null, $query_type, $sql_query, $selected, null ); } elseif (!$run_parts) { $GLOBALS['dbi']->selectDb($db); // for disabling foreign key checks while dropping tables if (! isset($_REQUEST['fk_check']) && $query_type == 'drop_tbl') { $GLOBALS['dbi']->query('SET FOREIGN_KEY_CHECKS = 0;'); } $result = $GLOBALS['dbi']->tryQuery($sql_query); if (! isset($_REQUEST['fk_check']) && $query_type == 'drop_tbl' && $default_fk_check_value ) { $GLOBALS['dbi']->query('SET FOREIGN_KEY_CHECKS = 1;'); } if ($result && !empty($sql_query_views)) { $sql_query .= ' ' . $sql_query_views . ';'; $result = $GLOBALS['dbi']->tryQuery($sql_query_views); unset($sql_query_views); } if (! $result) { $message = PMA_Message::error($GLOBALS['dbi']->getError()); } } if ($rebuild_database_list) { // avoid a problem with the database list navigator // when dropping a db from server_databases $GLOBALS['pma']->databases->build(); } } else { $message = PMA_Message::success(__('No change')); } ?>