mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 23:01:04 +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:
parent
e3a48dde1d
commit
683df399e7
1 changed files with 2 additions and 14 deletions
|
@ -38,8 +38,6 @@ final class DifferentialRevisionQuery
|
||||||
private $needDrafts;
|
private $needDrafts;
|
||||||
private $needFlags;
|
private $needFlags;
|
||||||
|
|
||||||
private $buildingGlobalOrder;
|
|
||||||
|
|
||||||
|
|
||||||
/* -( Query Configuration )------------------------------------------------ */
|
/* -( Query Configuration )------------------------------------------------ */
|
||||||
|
|
||||||
|
@ -484,12 +482,11 @@ final class DifferentialRevisionQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($selects) > 1) {
|
if (count($selects) > 1) {
|
||||||
$this->buildingGlobalOrder = true;
|
|
||||||
$query = qsprintf(
|
$query = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'%Q %Q %Q',
|
'%Q %Q %Q',
|
||||||
implode(' UNION DISTINCT ', $selects),
|
implode(' UNION DISTINCT ', $selects),
|
||||||
$this->buildOrderClause($conn_r),
|
$this->buildOrderClause($conn_r, true),
|
||||||
$this->buildLimitClause($conn_r));
|
$this->buildLimitClause($conn_r));
|
||||||
} else {
|
} else {
|
||||||
$query = head($selects);
|
$query = head($selects);
|
||||||
|
@ -513,7 +510,6 @@ final class DifferentialRevisionQuery
|
||||||
$group_by = $this->buildGroupClause($conn_r);
|
$group_by = $this->buildGroupClause($conn_r);
|
||||||
$having = $this->buildHavingClause($conn_r);
|
$having = $this->buildHavingClause($conn_r);
|
||||||
|
|
||||||
$this->buildingGlobalOrder = false;
|
|
||||||
$order_by = $this->buildOrderClause($conn_r);
|
$order_by = $this->buildOrderClause($conn_r);
|
||||||
|
|
||||||
$limit = $this->buildLimitClause($conn_r);
|
$limit = $this->buildLimitClause($conn_r);
|
||||||
|
@ -758,17 +754,9 @@ final class DifferentialRevisionQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrderableColumns() {
|
public function getOrderableColumns() {
|
||||||
$primary = ($this->buildingGlobalOrder ? null : 'r');
|
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'id' => array(
|
|
||||||
'table' => $primary,
|
|
||||||
'column' => 'id',
|
|
||||||
'type' => 'int',
|
|
||||||
'unique' => true,
|
|
||||||
),
|
|
||||||
'updated' => array(
|
'updated' => array(
|
||||||
'table' => $primary,
|
'table' => $this->getPrimaryTableAlias(),
|
||||||
'column' => 'dateModified',
|
'column' => 'dateModified',
|
||||||
'type' => 'int',
|
'type' => 'int',
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue