Merge pull request #786 from smita786/QA_4_1

fix bug #3903 and retaing ORDER BY preference when query having ORDER BY...
This commit is contained in:
Marc Delisle 2013-12-13 02:40:05 -08:00
commit 8b11bef335
2 changed files with 8 additions and 2 deletions

View File

@ -1560,8 +1560,11 @@ class PMA_Table
if (isset($this->uiprefs[$property])) {
// check if the column name is exist in this table
$tmp = explode(' ', $this->uiprefs[$property]);
$colname = $tmp[0];
$avail_columns = $this->getColumns();
$colname = $tmp[0];
//remove backquoting from colname
$colname = str_replace('`', '', $colname);
//get the available column name without backquoting
$avail_columns = $this->getColumns(false);
foreach ($avail_columns as $each_col) {
// check if $each_col ends with $colname
if (substr_compare(

View File

@ -230,6 +230,9 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql_results, &$full_sql_que
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 backquoting and tablename from retrived preference to get just column name
$sorted_col = str_replace('`', '', $sorted_col);
$sorted_col = str_replace($table . '.', '', $sorted_col);
// retrieve the remembered sorting order for current table
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
$full_sql_query