/**
 * Find the matching rows for UPDATE/DELETE query.
 *
 * @param array $analyzed_sql_results Analyzed SQL results from parser.
 *
 * @return mixed
 */
function PMA_getMatchedRows($analyzed_sql_results = array())
{
    // Get the query type.
    $query_type = isset($analyzed_sql_results['analyzed_sql'][0]['querytype']) ? $analyzed_sql_results['analyzed_sql'][0]['querytype'] : '';
    $matched_row_query = '';
    if ($query_type == 'DELETE') {
        $matched_row_query = PMA_getSimulatedDeleteQuery($analyzed_sql_results);
    } else {
        if ($query_type == 'UPDATE') {
            $matched_row_query = PMA_getSimulatedUpdateQuery($analyzed_sql_results);
        }
    }
    // Execute the query and get the number of matched rows.
    $matched_rows = PMA_executeMatchedRowQuery($matched_row_query);
    // URL to matched rows.
    $_url_params = array('db' => $GLOBALS['db'], 'sql_query' => $matched_row_query);
    $matched_rows_url = 'sql.php' . PMA_URL_getCommon($_url_params);
    return array('sql_query' => PMA_Util::formatSql($analyzed_sql_results['parsed_sql']['raw']), 'matched_rows' => $matched_rows, 'matched_rows_url' => $matched_rows_url);
}
/**
 * Find the matching rows for UPDATE/DELETE query.
 *
 * @param array $analyzed_sql_results Analyzed SQL results from parser.
 *
 * @return mixed
 */
function PMA_getMatchedRows($analyzed_sql_results = array())
{
    $statement = $analyzed_sql_results['statement'];
    $matched_row_query = '';
    if ($statement instanceof SqlParser\Statements\DeleteStatement) {
        $matched_row_query = PMA_getSimulatedDeleteQuery($analyzed_sql_results);
    } elseif ($statement instanceof SqlParser\Statements\UpdateStatement) {
        $matched_row_query = PMA_getSimulatedUpdateQuery($analyzed_sql_results);
    }
    // Execute the query and get the number of matched rows.
    $matched_rows = PMA_executeMatchedRowQuery($matched_row_query);
    // URL to matched rows.
    $_url_params = array('db' => $GLOBALS['db'], 'sql_query' => $matched_row_query);
    $matched_rows_url = 'sql.php' . PMA_URL_getCommon($_url_params);
    return array('sql_query' => PMA_Util::formatSql($analyzed_sql_results['query']), 'matched_rows' => $matched_rows, 'matched_rows_url' => $matched_rows_url);
}