Modernize Phrequent and Commit query ordering/paging

Summary: Ref T7803. Fixes T3870. Move these away from pagingColumn / reversePaging.

Test Plan:
  - Tested/paged audit query.
  - Poked at Phrequent. Didn't seem any more broken than before.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3870, T7803

Differential Revision: https://secure.phabricator.com/D12363
This commit is contained in:
epriestley
2015-04-11 20:50:57 -07:00
parent 51dabc5007
commit 9c7c13ffc8
3 changed files with 78 additions and 74 deletions

View File

@@ -570,18 +570,20 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
$table = idx($part, 'table');
$column = $part['column'];
if ($descending) {
if ($table !== null) {
$sql[] = qsprintf($conn, '%T.%T DESC', $table, $column);
} else {
$sql[] = qsprintf($conn, '%T DESC', $column);
}
if ($table !== null) {
$field = qsprintf($conn, '%T.%T', $table, $column);
} else {
if ($table !== null) {
$sql[] = qsprintf($conn, '%T.%T ASC', $table, $column);
} else {
$sql[] = qsprintf($conn, '%T ASC', $column);
}
$field = qsprintf($conn, '%T', $column);
}
if (idx($part, 'type') === 'null') {
$field = qsprintf($conn, '(%Q IS NULL)', $field);
}
if ($descending) {
$sql[] = qsprintf($conn, '%Q DESC', $field);
} else {
$sql[] = qsprintf($conn, '%Q ASC', $field);
}
}