/**
* 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
*
* @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);
}
$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'])) {
$html_output .= $displayResultsObject->getCreateViewQueryResultOp($analyzed_sql_results);
}
}
return $html_output;
}