Cannot sort twice on a column when the table name contains accents

This commit is contained in:
Marc Delisle
2008-09-11 17:03:49 +00:00
parent 0a1a6c8bcc
commit b2a2454f20
3 changed files with 10 additions and 5 deletions

View File

@@ -82,6 +82,8 @@ danbarry
thanks to Charles Suh - cws125 thanks to Charles Suh - cws125
- bug #2080963 [charset] Clarify doc and improved code, thanks to - bug #2080963 [charset] Clarify doc and improved code, thanks to
Victor Volkov - hanut Victor Volkov - hanut
- bug [charset] Cannot sort twice on a column when the table name
contains accents
2.11.9.0 (2008-08-28) 2.11.9.0 (2008-08-28)
- bug #2031221 [auth] Links to version number on login screen - bug #2031221 [auth] Links to version number on login screen

View File

@@ -765,9 +765,9 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
// If it contains one, it's probably a function column // If it contains one, it's probably a function column
// like 'COUNT(`field`)' // like 'COUNT(`field`)'
if (strpos($name_to_use_in_sort, '(') !== false) { if (strpos($name_to_use_in_sort, '(') !== false) {
$sort_order = ' ORDER BY ' . $name_to_use_in_sort . ' '; $sort_order = 'ORDER BY ' . $name_to_use_in_sort . ' ';
} else { } else {
$sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' '; $sort_order = 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
} }
unset($name_to_use_in_sort); unset($name_to_use_in_sort);

View File

@@ -1589,9 +1589,12 @@ if (! defined('PMA_MINIMUM_COMMON')) {
} }
if ($seen_order) { if ($seen_order) {
$seen_order_by = TRUE; $seen_order_by = TRUE;
// here we assume that the ORDER BY keywords took // Here we assume that the ORDER BY keywords took
// exactly 8 characters // exactly 8 characters.
$unsorted_query = substr($arr['raw'], 0, $arr[$i]['pos'] - 8); // We use PMA_substr() to be charset-safe; otherwise
// if the table name contains accents, the unsorted
// query would be missing some characters.
$unsorted_query = PMA_substr($arr['raw'], 0, $arr[$i]['pos'] - 8);
$in_order_by = TRUE; $in_order_by = TRUE;
$order_by_clause = ''; $order_by_clause = '';
} }