Merge remote-tracking branch 'origin/QA_4_1' into QA_4_1
This commit is contained in:
commit
9757cce54c
@ -1012,17 +1012,7 @@ class PMA_Util
|
||||
$sql_query = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['db']) && isset($GLOBALS['table'])){
|
||||
// Parse and analyze the query
|
||||
$analyzed_sql_results = PMA_SQP_getParserAnalyzeMap(
|
||||
$sql_query, $GLOBALS['db']);
|
||||
|
||||
// Synchronize message(query) with table
|
||||
self::handleSortOrder($GLOBALS['db'], $GLOBALS['table'],
|
||||
$analyzed_sql_results, $sql_query);
|
||||
}
|
||||
|
||||
|
||||
if (isset($GLOBALS['using_bookmark_message'])) {
|
||||
$retval .= $GLOBALS['using_bookmark_message']->getDisplay();
|
||||
unset($GLOBALS['using_bookmark_message']);
|
||||
@ -4371,54 +4361,6 @@ class PMA_Util
|
||||
return $value . '.000000';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle remembered sorting order, only for single table 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
|
||||
*/
|
||||
public static function handleSortOrder(
|
||||
$db, $table, &$analyzed_sql_results, &$full_sql_query
|
||||
) {
|
||||
$pmatable = new PMA_Table($table, $db);
|
||||
if (empty($analyzed_sql_results['analyzed_sql'][0]['order_by_clause'])
|
||||
&& isset($GLOBALS['default_query']) && $GLOBALS['default_query']) {
|
||||
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
|
||||
if ($sorted_col) {
|
||||
//remove the tablename from retrieved preference
|
||||
//to get just the column name and the sort order
|
||||
$sorted_col = str_replace(
|
||||
PMA_Util::backquote($table) . '.', '', $sorted_col
|
||||
);
|
||||
// retrieve the remembered sorting order for current table
|
||||
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
|
||||
$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_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_results['analyzed_sql'][0]['order_by_clause']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -140,7 +140,7 @@ function PMA_getTableHtmlForMultipleQueries(
|
||||
&& isset($analyzed_sql[0]['queryflags']['select_from'])
|
||||
&& count($analyzed_sql[0]['table_ref']) == 1
|
||||
) {
|
||||
PMA_Util::handleSortOrder(
|
||||
PMA_handleSortOrder(
|
||||
$db,
|
||||
$table,
|
||||
$analyzed_sql,
|
||||
@ -214,6 +214,52 @@ function PMA_getTableHtmlForMultipleQueries(
|
||||
return $table_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle remembered sorting order, only for single table 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_results, &$full_sql_query
|
||||
) {
|
||||
$pmatable = new PMA_Table($table, $db);
|
||||
if (empty($analyzed_sql_results['analyzed_sql'][0]['order_by_clause'])) {
|
||||
$sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN);
|
||||
if ($sorted_col) {
|
||||
//remove the tablename from retrieved preference
|
||||
//to get just the column name and the sort order
|
||||
$sorted_col = str_replace(
|
||||
PMA_Util::backquote($table) . '.', '', $sorted_col
|
||||
);
|
||||
// retrieve the remembered sorting order for current table
|
||||
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
|
||||
$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_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_results['analyzed_sql'][0]['order_by_clause']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append limit clause to SQL query
|
||||
*
|
||||
@ -1125,7 +1171,6 @@ function PMA_appendLimitClause($full_sql_query, $analyzed_sql, $display_query)
|
||||
*/
|
||||
function PMA_getDefaultSqlQueryForBrowse($db, $table)
|
||||
{
|
||||
$GLOBALS['default_query'] = true;
|
||||
include_once 'libraries/bookmark.lib.php';
|
||||
$book_sql_query = PMA_Bookmark_get(
|
||||
$db,
|
||||
@ -2221,24 +2266,23 @@ function PMA_executeQueryAndSendQueryResponse($analyzed_sql_results,
|
||||
|
||||
include 'libraries/DisplayResults.class.php';
|
||||
|
||||
$displayResultsObject = new PMA_DisplayResults(
|
||||
$GLOBALS['db'], $GLOBALS['table'], $GLOBALS['goto'], $GLOBALS['sql_query']
|
||||
);
|
||||
|
||||
$displayResultsObject->setConfigParamsForDisplayTable();
|
||||
|
||||
// assign default full_sql_query
|
||||
$full_sql_query = $sql_query;
|
||||
|
||||
// Handle remembered sorting order, only for single table query
|
||||
// Handling is not required when it's a union query
|
||||
// (the parser never sets the 'union' key to 0)
|
||||
if (PMA_isRememberSortingOrder($analyzed_sql_results)
|
||||
&& ! isset($analyzed_sql_results['analyzed_sql'][0]['queryflags']['union'])
|
||||
) {
|
||||
PMA_Util::handleSortOrder($db, $table, $analyzed_sql_results, $full_sql_query);
|
||||
PMA_handleSortOrder($db, $table, $analyzed_sql_results, $sql_query);
|
||||
}
|
||||
|
||||
$displayResultsObject = new PMA_DisplayResults(
|
||||
$GLOBALS['db'], $GLOBALS['table'], $GLOBALS['goto'], $sql_query
|
||||
);
|
||||
$displayResultsObject->setConfigParamsForDisplayTable();
|
||||
|
||||
// assign default full_sql_query
|
||||
$full_sql_query = $sql_query;
|
||||
|
||||
// Do append a "LIMIT" clause?
|
||||
if (PMA_isAppendLimitClause($analyzed_sql_results)) {
|
||||
list($sql_limit_to_append,
|
||||
|
||||
@ -55,7 +55,6 @@ class PMA_Header_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['PMA_Config']->enableBc();
|
||||
$GLOBALS['cfg']['Server']['verbose'] = 'verbose host';
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = '';
|
||||
$GLOBALS['default_query'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -50,9 +50,6 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['text_dir'] = 'ltr';
|
||||
$GLOBALS['db'] = 'db';
|
||||
$GLOBALS['table'] = 'table';
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs';
|
||||
$GLOBALS['cfg']['Server']['user'] = 'user';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -51,13 +51,10 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['ShowSQL'] = true;
|
||||
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = 'pmadb';
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs';
|
||||
$GLOBALS['cfg']['Server']['user'] = 'user';
|
||||
|
||||
|
||||
$GLOBALS['table'] = "table";
|
||||
$GLOBALS['pmaThemeImage'] = 'image';
|
||||
|
||||
|
||||
//$_SESSION
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
@ -141,7 +138,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase
|
||||
$count = 3;
|
||||
|
||||
//expects functions
|
||||
$dbi->expects($this->exactly(2))->method('query')
|
||||
$dbi->expects($this->once())->method('query')
|
||||
->will($this->returnValue($result));
|
||||
|
||||
$dbi->expects($this->once())->method('numRows')
|
||||
|
||||
@ -65,8 +65,6 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['NavigationTreeDefaultTabTable'] = "db_structure.php";
|
||||
$GLOBALS['cfg']['Confirm'] = "Confirm";
|
||||
$GLOBALS['cfg']['ShowHint'] = true;
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs';
|
||||
$GLOBALS['cfg']['Server']['user'] = 'user';
|
||||
|
||||
$GLOBALS['cfgRelation'] = array();
|
||||
$GLOBALS['cfgRelation']['menuswork'] = false;
|
||||
@ -78,8 +76,6 @@ class PMA_ServerPrivileges_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['username'] = "username";
|
||||
$GLOBALS['collation_connection'] = "collation_connection";
|
||||
$GLOBALS['text_dir'] = "text_dir";
|
||||
$GLOBALS['default_query'] = true;
|
||||
|
||||
//$_POST
|
||||
$_POST['pred_password'] = 'none';
|
||||
//$_SESSION
|
||||
|
||||
Loading…
Reference in New Issue
Block a user