Merge pull request #527 from scnakandala/gsoc_2013_2

Bug Fix
This commit is contained in:
Marc Delisle 2013-07-19 10:16:49 -07:00
commit a961e21317
2 changed files with 20 additions and 14 deletions

View File

@ -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']
);
}
}

View File

@ -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 = '';