commit
a961e21317
@ -217,34 +217,39 @@ function PMA_getTableHtmlForMultipleQueries(
|
||||
/**
|
||||
* Handle remembered sorting order, only for single table query
|
||||
*
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param array &$analyzed_sql the analyzed query
|
||||
* @param string &$full_sql_query SQL query
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param array &$analyzed_sql_results the analyzed query results
|
||||
* @param string &$full_sql_query SQL query
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function PMA_handleSortOrder($db, $table, &$analyzed_sql, &$full_sql_query)
|
||||
function PMA_handleSortOrder($db, $table, &$analyzed_sql_results, &$full_sql_query)
|
||||
{
|
||||
$pmatable = new PMA_Table($table, $db);
|
||||
if (empty($analyzed_sql[0]['order_by_clause'])) {
|
||||
if (empty($analyzed_sql_results['analyzed_sql'][0]['order_by_clause'])) {
|
||||
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
|
||||
if ($sorted_col) {
|
||||
// retrieve the remembered sorting order for current table
|
||||
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
|
||||
$full_sql_query = $analyzed_sql[0]['section_before_limit']
|
||||
. $sql_order_to_append . $analyzed_sql[0]['limit_clause']
|
||||
. ' ' . $analyzed_sql[0]['section_after_limit'];
|
||||
$full_sql_query
|
||||
= $analyzed_sql_results['analyzed_sql'][0]['section_before_limit']
|
||||
. $sql_order_to_append
|
||||
. $analyzed_sql_results['analyzed_sql'][0]['limit_clause']
|
||||
. ' '
|
||||
. $analyzed_sql_results['analyzed_sql'][0]['section_after_limit'];
|
||||
|
||||
// update the $analyzed_sql
|
||||
$analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;
|
||||
$analyzed_sql[0]['order_by_clause'] = $sorted_col;
|
||||
$analyzed_sql_results['analyzed_sql'][0]['section_before_limit']
|
||||
.= $sql_order_to_append;
|
||||
$analyzed_sql_results['analyzed_sql'][0]['order_by_clause']
|
||||
= $sorted_col;
|
||||
}
|
||||
} else {
|
||||
// store the remembered table into session
|
||||
$pmatable->setUiProp(
|
||||
PMA_Table::PROP_SORTED_COLUMN,
|
||||
$analyzed_sql[0]['order_by_clause']
|
||||
$analyzed_sql_results['analyzed_sql'][0]['order_by_clause']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
5
sql.php
5
sql.php
@ -172,7 +172,7 @@ $full_sql_query = $sql_query;
|
||||
|
||||
// Handle remembered sorting order, only for single table query
|
||||
if (PMA_isRememberSortingOrder($analyzed_sql_results)) {
|
||||
PMA_handleSortOrder($db, $table, $analyzed_sql, $full_sql_query);
|
||||
PMA_handleSortOrder($db, $table, $analyzed_sql_results, $full_sql_query);
|
||||
}
|
||||
|
||||
// Do append a "LIMIT" clause?
|
||||
@ -180,7 +180,8 @@ if (PMA_isAppendLimitClause($analyzed_sql_results)) {
|
||||
list($sql_limit_to_append,
|
||||
$full_sql_query, $analyzed_display_query, $display_query
|
||||
) = PMA_appendLimitClause(
|
||||
$full_sql_query, $analyzed_sql, isset($display_query)
|
||||
$full_sql_query, $analyzed_sql_results['analyzed_sql'],
|
||||
isset($display_query)
|
||||
);
|
||||
} else {
|
||||
$sql_limit_to_append = '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user