diff --git a/ChangeLog b/ChangeLog index fd337ce030..886894b0a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ phpMyAdmin - ChangeLog + rfe #1475 Inline query box vertical resize 4.1.7.0 (not yet released) +- bug #4245 initial Browse query does not match sorting order 4.1.6.0 (2014-01-26) - bug #4232 User not found after creating the user diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 483329226b..7e2ed186e4 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -1010,7 +1010,17 @@ 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 + PMA_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']); diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index ea89312339..1973ad5c54 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -227,7 +227,8 @@ function PMA_getTableHtmlForMultipleQueries( 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'])) { + 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 @@ -1165,6 +1166,7 @@ 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, diff --git a/test/classes/PMA_Header_test.php b/test/classes/PMA_Header_test.php index 04f194b390..78ae08ce4a 100644 --- a/test/classes/PMA_Header_test.php +++ b/test/classes/PMA_Header_test.php @@ -55,6 +55,7 @@ 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; } /** diff --git a/test/libraries/PMA_insert_edit_test.php b/test/libraries/PMA_insert_edit_test.php index ef99264f8b..c0d5d9f141 100644 --- a/test/libraries/PMA_insert_edit_test.php +++ b/test/libraries/PMA_insert_edit_test.php @@ -51,6 +51,9 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase $GLOBALS['db'] = 'db'; $GLOBALS['table'] = 'table'; $GLOBALS['PMA_Types'] = new PMA_Types_MySQL(); + $GLOBALS['cfg']['Server']['pmadb'] = 'pmadb'; + $GLOBALS['cfg']['Server']['table_uiprefs'] = 'table_uiprefs'; + $GLOBALS['cfg']['Server']['user'] = 'user'; } /** diff --git a/test/libraries/PMA_server_binlog_test.php b/test/libraries/PMA_server_binlog_test.php index 81349e1bb5..3006219965 100644 --- a/test/libraries/PMA_server_binlog_test.php +++ b/test/libraries/PMA_server_binlog_test.php @@ -51,10 +51,13 @@ 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(); @@ -134,7 +137,7 @@ class PMA_ServerBinlog_Test extends PHPUnit_Framework_TestCase $count = 3; //expects functions - $dbi->expects($this->once())->method('query') + $dbi->expects($this->exactly(2))->method('query') ->will($this->returnValue($result)); $dbi->expects($this->once())->method('numRows') diff --git a/test/libraries/PMA_server_privileges_test.php b/test/libraries/PMA_server_privileges_test.php index fd272d1d8e..e86f3f85ab 100644 --- a/test/libraries/PMA_server_privileges_test.php +++ b/test/libraries/PMA_server_privileges_test.php @@ -65,6 +65,8 @@ 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; @@ -76,6 +78,7 @@ 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';