Beispiel #1
0
/**
 * 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 void
 */
function PMA_executeQueryAndSendQueryResponse($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)
{
    $html_output = 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);
    $response = PMA\libraries\Response::getInstance();
    $response->addHTML($html_output);
}
 /**
  * Function to display table browse for selected columns
  *
  * @param string $goto          goto page url
  * @param string $pmaThemeImage URI of the pma theme image
  *
  * @return void
  */
 protected function displayTableBrowseForSelectedColumns($goto, $pmaThemeImage)
 {
     $GLOBALS['active_page'] = 'sql.php';
     $fields = array();
     foreach ($_REQUEST['selected_fld'] as $sval) {
         $fields[] = PMA_Util::backquote($sval);
     }
     $sql_query = sprintf('SELECT %s FROM %s.%s', implode(', ', $fields), PMA_Util::backquote($this->db), PMA_Util::backquote($this->table));
     // Parse and analyze the query
     // @todo Refactor parse_analyze.inc to protected function
     $db =& $this->db;
     include_once 'libraries/parse_analyze.inc.php';
     include_once 'libraries/sql.lib.php';
     $this->response->addHTML(PMA_executeQueryAndGetQueryResponse(isset($analyzed_sql_results) ? $analyzed_sql_results : '', false, $this->db, $this->table, null, null, null, null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query, null, null));
 }
Beispiel #3
0
    foreach ($my_die as $key => $die) {
        PMA_Util::mysqlDie($die['error'], $die['sql'], false, $err_url, $error);
    }
}
if ($go_sql) {
    if (!empty($sql_data) && $sql_data['valid_queries'] > 1) {
        $_SESSION['is_multi_query'] = true;
        $sql_queries = $sql_data['valid_sql'];
    } else {
        $sql_queries = array($sql_query);
    }
    $html_output = '';
    foreach ($sql_queries as $sql_query) {
        // parse sql query
        include 'libraries/parse_analyze.inc.php';
        $html_output .= PMA_executeQueryAndGetQueryResponse($analyzed_sql_results, false, $db, $table, null, $sql_query, null, $analyzed_sql_results['is_affected'], null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query, null, null);
    }
    if (!isset($ajax_reload)) {
        $ajax_reload = array();
    }
    if (isset($table)) {
        $ajax_reload['table_name'] = $table;
    }
    $response = PMA_Response::getInstance();
    $response->addJSON('ajax_reload', $ajax_reload);
    $response->addHTML($html_output);
    exit;
} else {
    if ($result) {
        // Save a Bookmark with more than one queries (if Bookmark label given).
        if (!empty($_POST['bkm_label']) && !empty($import_text)) {
Beispiel #4
0
/**
 * 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 void
 */
function PMA_executeQueryAndSendQueryResponse($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)
{
    if ($analyzed_sql_results == null) {
        // Parse and analyze the query
        include_once 'libraries/parse_analyze.lib.php';
        list($analyzed_sql_results, $db, $table) = PMA_parseAnalyze($sql_query, $db);
        // @todo: possibly refactor
        extract($analyzed_sql_results);
    }
    $html_output = 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);
    $response = PMA\libraries\Response::getInstance();
    $response->addHTML($html_output);
}