コード例 #1
0
        extract($analyzed_sql_results);
        PMA_executeQueryAndSendQueryResponse($analyzed_sql_results, false, $db, $table, null, null, null, null, null, null, $goto, $pmaThemeImage, null, null, $query_type, $sql_query, $selected, null);
    } elseif (!$run_parts) {
        $GLOBALS['dbi']->selectDb($db);
        $result = $GLOBALS['dbi']->tryQuery($sql_query);
        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 = Message::error($GLOBALS['dbi']->getError());
        }
    }
    if ($query_type == 'drop_tbl' || $query_type == 'empty_tbl' || $query_type == 'row_delete') {
        PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check_value);
    }
    if ($rebuild_database_list) {
        // avoid a problem with the database list navigator
        // when dropping a db from server_databases
        $GLOBALS['pma']->databases->build();
    }
} else {
    if (isset($submit_mult) && ($submit_mult == 'sync_unique_columns_central_list' || $submit_mult == 'delete_unique_columns_central_list' || $submit_mult == 'add_to_central_columns' || $submit_mult == 'remove_from_central_columns' || $submit_mult == 'make_consistent_with_central_list')) {
        if (isset($centralColsError) && $centralColsError !== true) {
            $message = $centralColsError;
        } else {
            $message = Message::success(__('Success!'));
        }
    } else {
        $message = Message::success(__('No change'));
コード例 #2
0
ファイル: sql.lib.php プロジェクト: Devuiux/phpmyadmin
/**
 * Function to execute the query and send the response
 *
 * @param array      $analyzed_sql_results   analysed sql results
 * @param bool       $is_gotofile            whether goto file or not
 * @param string     $db                     current database
 * @param string     $table                  current table
 * @param bool|null  $find_real_end          whether to find real end or not
 * @param string     $sql_query_for_bookmark the sql query to be stored as bookmark
 * @param array|null $extra_data             extra data
 * @param string     $message_to_show        message to show
 * @param string     $message                message
 * @param array|null $sql_data               sql data
 * @param string     $goto                   goto page url
 * @param string     $pmaThemeImage          uri of the PMA theme image
 * @param string     $disp_query             display query
 * @param string     $disp_message           display message
 * @param string     $query_type             query type
 * @param string     $sql_query              sql query
 * @param array|null $selectedTables         array of table names selected from the
 *                                           database structure page, for an action
 *                                           like check table, optimize table,
 *                                           analyze table or repair table
 * @param string     $complete_query         complete query
 *
 * @return string html
 */
function PMA_executeQueryAndGetQueryResponse($analyzed_sql_results, $is_gotofile, $db, $table, $find_real_end, $sql_query_for_bookmark, $extra_data, $message_to_show, $message, $sql_data, $goto, $pmaThemeImage, $disp_query, $disp_message, $query_type, $sql_query, $selectedTables, $complete_query)
{
    // Handle disable/enable foreign key checks
    $default_fk_check = PMA\libraries\Util::handleDisableFKCheckInit();
    // Handle remembered sorting order, only for single table query.
    // Handling is not required when it's a union query
    // (the parser never sets the 'union' key to 0).
    // Handling is also not required if we came from the "Sort by key"
    // drop-down.
    if (PMA_isRememberSortingOrder($analyzed_sql_results) && empty($analyzed_sql_results['union']) && !isset($_REQUEST['sort_by_key'])) {
        if (!isset($_SESSION['sql_from_query_box'])) {
            PMA_handleSortOrder($db, $table, $analyzed_sql_results, $sql_query);
        } else {
            unset($_SESSION['sql_from_query_box']);
        }
    }
    $displayResultsObject = new PMA\libraries\DisplayResults($GLOBALS['db'], $GLOBALS['table'], $goto, $sql_query);
    $displayResultsObject->setConfigParamsForDisplayTable();
    // assign default full_sql_query
    $full_sql_query = $sql_query;
    // Do append a "LIMIT" clause?
    if (PMA_isAppendLimitClause($analyzed_sql_results)) {
        $full_sql_query = PMA_getSqlWithLimitClause($analyzed_sql_results);
    }
    $GLOBALS['reload'] = PMA_hasCurrentDbChanged($db);
    $GLOBALS['dbi']->selectDb($db);
    // Execute the query
    list($result, $num_rows, $unlim_num_rows, $profiling_results, $extra_data) = PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofile, $db, $table, isset($find_real_end) ? $find_real_end : null, isset($sql_query_for_bookmark) ? $sql_query_for_bookmark : null, isset($extra_data) ? $extra_data : null);
    // No rows returned -> move back to the calling page
    if (0 == $num_rows && 0 == $unlim_num_rows || $analyzed_sql_results['is_affected']) {
        $html_output = PMA_getQueryResponseForNoResultsReturned($analyzed_sql_results, $db, $table, isset($message_to_show) ? $message_to_show : null, $num_rows, $displayResultsObject, $extra_data, $pmaThemeImage, isset($result) ? $result : null, $sql_query, isset($complete_query) ? $complete_query : null);
    } else {
        // At least one row is returned -> displays a table with results
        $html_output = PMA_getQueryResponseForResultsReturned(isset($result) ? $result : null, $analyzed_sql_results, $db, $table, isset($message) ? $message : null, isset($sql_data) ? $sql_data : null, $displayResultsObject, $pmaThemeImage, $unlim_num_rows, $num_rows, isset($disp_query) ? $disp_query : null, isset($disp_message) ? $disp_message : null, $profiling_results, isset($query_type) ? $query_type : null, isset($selectedTables) ? $selectedTables : null, $sql_query, isset($complete_query) ? $complete_query : null);
    }
    // Handle disable/enable foreign key checks
    PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check);
    return $html_output;
}