Exemple #1
0
/**
 * Get HTML for display indexes
 *
 * @return string $html_output
 */
function PMA_getHtmlForDisplayIndexes()
{
    $html_output = '<div id="index_div" class="ajax" >';
    $html_output .= PMA\libraries\Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db']);
    $html_output .= '<fieldset class="tblFooters print_ignore" style="text-align: ' . 'left;"><form action="tbl_indexes.php" method="post">';
    $html_output .= URL::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $html_output .= sprintf(__('Create an index on &nbsp;%s&nbsp;columns'), '<input type="number" name="added_fields" value="1" ' . 'min="1" required="required" />');
    $html_output .= '<input type="hidden" name="create_index" value="1" />' . '<input class="add_index ajax"' . ' type="submit" value="' . __('Go') . '" />';
    $html_output .= '</form>' . '</fieldset>' . '</div>';
    return $html_output;
}
Exemple #2
0
            echo '</td>', "\n";
        }
        echo '    <td>';
        if (isset($comments[$column_name])) {
            echo htmlspecialchars($comments[$column_name]);
        }
        echo '</td>', "\n";
        if ($cfgRelation['mimework']) {
            $mime_map = PMA_getMIME($db, $table, true);
            echo '    <td>';
            if (isset($mime_map[$column_name])) {
                echo htmlspecialchars(str_replace('_', '/', $mime_map[$column_name]['mimetype']));
            }
            echo '</td>', "\n";
        }
        echo '</tr>';
    }
    // end foreach
    $count++;
    echo '</table>';
    // display indexes information
    if (count(PMA\libraries\Index::getFromTable($table, $db)) > 0) {
        echo PMA\libraries\Index::getHtmlForIndexes($table, $db, true);
    }
    echo '</div>';
}
//ends main while
/**
 * Displays the footer
 */
echo PMA\libraries\Util::getButton();
Exemple #3
0
/**
 * Function to handle all aspects relating to executing the query
 *
 * @param array   $analyzed_sql_results   analyzed sql results
 * @param String  $full_sql_query         full sql query
 * @param boolean $is_gotofile            whether to go to a file
 * @param String  $db                     current database
 * @param String  $table                  current table
 * @param boolean $find_real_end          whether to find the real end
 * @param String  $sql_query_for_bookmark sql query to be stored as bookmark
 * @param array   $extra_data             extra data
 *
 * @return mixed
 */
function PMA_executeTheQuery($analyzed_sql_results, $full_sql_query, $is_gotofile, $db, $table, $find_real_end, $sql_query_for_bookmark, $extra_data)
{
    $response = PMA\libraries\Response::getInstance();
    $response->getHeader()->getMenu()->setTable($table);
    // Only if we ask to see the php code
    if (isset($GLOBALS['show_as_php'])) {
        $result = null;
        $num_rows = 0;
        $unlim_num_rows = 0;
    } else {
        // If we don't ask to see the php code
        if (isset($_SESSION['profiling']) && PMA\libraries\Util::profilingSupported()) {
            $GLOBALS['dbi']->query('SET PROFILING=1;');
        }
        list($result, $GLOBALS['querytime']) = PMA_executeQueryAndMeasureTime($full_sql_query);
        // Displays an error message if required and stop parsing the script
        $error = $GLOBALS['dbi']->getError();
        if ($error && $GLOBALS['cfg']['IgnoreMultiSubmitErrors']) {
            $extra_data['error'] = $error;
        } elseif ($error) {
            PMA_handleQueryExecuteError($is_gotofile, $error, $full_sql_query);
        }
        // If there are no errors and bookmarklabel was given,
        // store the query as a bookmark
        if (!empty($_POST['bkm_label']) && !empty($sql_query_for_bookmark)) {
            $cfgBookmark = PMA_Bookmark_getParams();
            PMA_storeTheQueryAsBookmark($db, $cfgBookmark['user'], $sql_query_for_bookmark, $_POST['bkm_label'], isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null);
        }
        // end store bookmarks
        // Gets the number of rows affected/returned
        // (This must be done immediately after the query because
        // mysql_affected_rows() reports about the last query done)
        $num_rows = PMA_getNumberOfRowsAffectedOrChanged($analyzed_sql_results['is_affected'], $result);
        // Grabs the profiling results
        if (isset($_SESSION['profiling']) && PMA\libraries\Util::profilingSupported()) {
            $profiling_results = $GLOBALS['dbi']->fetchResult('SHOW PROFILE;');
        }
        $justBrowsing = PMA_isJustBrowsing($analyzed_sql_results, isset($find_real_end) ? $find_real_end : null);
        $unlim_num_rows = PMA_countQueryResults($num_rows, $justBrowsing, $db, $table, $analyzed_sql_results);
        PMA_cleanupRelations(isset($db) ? $db : '', isset($table) ? $table : '', isset($_REQUEST['dropped_column']) ? $_REQUEST['dropped_column'] : null, isset($_REQUEST['purge']) ? $_REQUEST['purge'] : null);
        if (isset($_REQUEST['dropped_column']) && mb_strlen($db) && mb_strlen($table)) {
            // to refresh the list of indexes (Ajax mode)
            $extra_data['indexes_list'] = PMA\libraries\Index::getHtmlForIndexes($table, $db);
        }
    }
    return array($result, $num_rows, $unlim_num_rows, isset($profiling_results) ? $profiling_results : null, $extra_data);
}