1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Simplify UNION/ORDER query construction in DifferentialRevisionQuery

Summary: Ref T12680. Use the slightly sleeker construction from D18722 in Differential.

Test Plan: Viewed revision list, reordered by date modified.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T12680

Differential Revision: https://secure.phabricator.com/D18727
This commit is contained in:
epriestley 2017-10-23 14:59:32 -07:00
parent e3a48dde1d
commit 683df399e7

View file

@ -38,8 +38,6 @@ final class DifferentialRevisionQuery
private $needDrafts;
private $needFlags;
private $buildingGlobalOrder;
/* -( Query Configuration )------------------------------------------------ */
@ -484,12 +482,11 @@ final class DifferentialRevisionQuery
}
if (count($selects) > 1) {
$this->buildingGlobalOrder = true;
$query = qsprintf(
$conn_r,
'%Q %Q %Q',
implode(' UNION DISTINCT ', $selects),
$this->buildOrderClause($conn_r),
$this->buildOrderClause($conn_r, true),
$this->buildLimitClause($conn_r));
} else {
$query = head($selects);
@ -513,7 +510,6 @@ final class DifferentialRevisionQuery
$group_by = $this->buildGroupClause($conn_r);
$having = $this->buildHavingClause($conn_r);
$this->buildingGlobalOrder = false;
$order_by = $this->buildOrderClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
@ -758,17 +754,9 @@ final class DifferentialRevisionQuery
}
public function getOrderableColumns() {
$primary = ($this->buildingGlobalOrder ? null : 'r');
return array(
'id' => array(
'table' => $primary,
'column' => 'id',
'type' => 'int',
'unique' => true,
),
'updated' => array(
'table' => $primary,
'table' => $this->getPrimaryTableAlias(),
'column' => 'dateModified',
'type' => 'int',
),