Example #1
0
/**
 * Function to respond back when the query returns zero rows
 * This method is called
 * 1-> When browsing an empty table
 * 2-> When executing a query on a non empty table which returns zero results
 * 3-> When executing a query on an empty table
 * 4-> When executing an INSERT, UPDATE, DELETE query from the SQL tab
 * 5-> When deleting a row from BROWSE tab
 * 6-> When searching using the SEARCH tab which returns zero results
 * 7-> When changing the structure of the table except change operation
 *
 * @param array          $analyzed_sql_results analyzed sql results
 * @param string         $db                   current database
 * @param string         $table                current table
 * @param string         $message_to_show      message to show
 * @param int            $num_rows             number of rows
 * @param DisplayResults $displayResultsObject DisplayResult instance
 * @param array          $extra_data           extra data
 * @param string         $pmaThemeImage        uri of the theme image
 * @param object         $result               executed query results
 * @param string         $sql_query            sql query
 * @param string         $complete_query       complete sql query
 *
 * @return string html
 */
function PMA_getQueryResponseForNoResultsReturned($analyzed_sql_results, $db, $table, $message_to_show, $num_rows, $displayResultsObject, $extra_data, $pmaThemeImage, $result, $sql_query, $complete_query)
{
    if (PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
        PMA_deleteTransformationInfo($db, $table, $analyzed_sql_results);
    }
    if (isset($extra_data['error'])) {
        $message = PMA\libraries\Message::rawError($extra_data['error']);
    } else {
        $message = PMA_getMessageForNoRowsReturned(isset($message_to_show) ? $message_to_show : null, $analyzed_sql_results, $num_rows);
    }
    $html_output = '';
    if (!isset($GLOBALS['show_as_php'])) {
        if (!empty($GLOBALS['reload'])) {
            $extra_data['reload'] = 1;
            $extra_data['db'] = $GLOBALS['db'];
        }
        $html_message = PMA\libraries\Util::getMessage($message, $GLOBALS['sql_query'], 'success');
        $html_output .= $html_message;
        // For ajax requests add message and sql_query as JSON
        if (empty($_REQUEST['ajax_page_request'])) {
            $extra_data['message'] = $message;
            if ($GLOBALS['cfg']['ShowSQL']) {
                $extra_data['sql_query'] = $html_message;
            }
        }
        $response = PMA\libraries\Response::getInstance();
        $response->addJSON(isset($extra_data) ? $extra_data : array());
        if (!empty($analyzed_sql_results['is_select']) && !isset($extra_data['error'])) {
            $url_query = isset($url_query) ? $url_query : null;
            $displayParts = array('edit_lnk' => null, 'del_lnk' => null, 'sort_lnk' => '1', 'nav_bar' => '0', 'bkm_form' => '1', 'text_btn' => '1', 'pview_lnk' => '1');
            $html_output .= PMA_getHtmlForSqlQueryResultsTable($displayResultsObject, $pmaThemeImage, $url_query, $displayParts, false, 0, $num_rows, true, $result, $analyzed_sql_results, true);
            $html_output .= $displayResultsObject->getCreateViewQueryResultOp($analyzed_sql_results);
            $cfgBookmark = PMA_Bookmark_getParams();
            if ($cfgBookmark) {
                $html_output .= PMA_getHtmlForBookmark($displayParts, $cfgBookmark, $sql_query, $db, $table, isset($complete_query) ? $complete_query : $sql_query, $cfgBookmark['user']);
            }
        }
    }
    return $html_output;
}
Example #2
0
/**
 * Function to respond back when the query returns zero rows
 * This method is called
 * 1-> When browsing an empty table
 * 2-> When executing a query on a non empty table which returns zero results
 * 3-> When executing a query on an empty table
 * 4-> When executing an INSERT, UPDATE, DELETE query from the SQL tab
 * 5-> When deleting a row from BROWSE tab
 * 6-> When searching using the SEARCH tab which returns zero results
 * 7-> When changing the structure of the table except change operation
 *
 * @param array  $analyzed_sql_results analyzed sql results
 * @param string $db                   current database
 * @param string $table                current table
 * @param string $message_to_show      message to show
 * @param int    $num_rows             number of rows
 * @param object $displayResultsObject DisplayResult instance
 * @param array  $extra_data           extra data
 *
 * @return void
 */
function PMA_sendQueryResponseForNoResultsReturned($analyzed_sql_results, $db, $table, $message_to_show, $num_rows, $displayResultsObject, $extra_data)
{
    if (PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
        PMA_deleteTransformationInfo($db, $table, $analyzed_sql_results['analyzed_sql']);
    }
    $message = PMA_getMessageForNoRowsReturned(isset($message_to_show) ? $message_to_show : null, $analyzed_sql_results, $num_rows);
    if (!isset($GLOBALS['show_as_php'])) {
        PMA_sendAjaxResponseForNoResultsReturned($message, $analyzed_sql_results['analyzed_sql'], $displayResultsObject, isset($extra_data) ? $extra_data : null);
    }
    exit;
}
Example #3
0
/**
 * Function to respond back when the query returns zero rows
 * This method is called
 * 1-> When browsing an empty table
 * 2-> When executing a query on a non empty table which returns zero results
 * 3-> When executing a query on an empty table
 * 4-> When executing an INSERT, UPDATE, DELETE query from the SQL tab
 * 5-> When deleting a row from BROWSE tab
 * 6-> When searching using the SEARCH tab which returns zero results
 * 7-> When changing the structure of the table except change operation
 *
 * @param array              $analyzed_sql_results analyzed sql results
 * @param string             $db                   current database
 * @param string             $table                current table
 * @param string             $message_to_show      message to show
 * @param int                $num_rows             number of rows
 * @param PMA_DisplayResults $displayResultsObject DisplayResult instance
 * @param array              $extra_data           extra data
 *
 * @return string html
 */
function PMA_getQueryResponseForNoResultsReturned($analyzed_sql_results, $db, $table, $message_to_show, $num_rows, $displayResultsObject, $extra_data)
{
    if (PMA_isDeleteTransformationInfo($analyzed_sql_results)) {
        PMA_deleteTransformationInfo($db, $table, $analyzed_sql_results['analyzed_sql']);
    }
    $message = PMA_getMessageForNoRowsReturned(isset($message_to_show) ? $message_to_show : null, $analyzed_sql_results, $num_rows);
    $html_output = '';
    if (!isset($GLOBALS['show_as_php'])) {
        if (isset($GLOBALS['reload']) && $GLOBALS['reload'] == 1) {
            $extra_data['reload'] = 1;
            $extra_data['db'] = $GLOBALS['db'];
        }
        $html_message = PMA_Util::getMessage($message, $GLOBALS['sql_query'], 'success');
        $html_output .= $html_message;
        // For ajax requests add message and sql_query as JSON
        if (empty($_REQUEST['ajax_page_request'])) {
            $extra_data['message'] = $message;
            if ($GLOBALS['cfg']['ShowSQL']) {
                $extra_data['sql_query'] = $html_message;
            }
        }
        $response = PMA_Response::getInstance();
        $response->addJSON(isset($extra_data) ? $extra_data : array());
        $query_type = PMA_DisplayResults::QUERY_TYPE_SELECT;
        if ($analyzed_sql_results['analyzed_sql'][0]['querytype'] == $query_type) {
            $html_output .= $displayResultsObject->getCreateViewQueryResultOp($analyzed_sql_results['analyzed_sql']);
        }
    }
    return $html_output;
}