Extend PhabricatorPolicyQuery from PhabricatorOffsetPagedQuery

Summary:
A few goals here:

  - Slightly simplify the Query classtree -- it's now linear: `Query` -> `OffsetPagedQuery` (adds offset/limit) -> `PolicyQuery` (adds policy filtering) -> `CursorPagedPolicyQuery` (adds cursors).
  - Allow us to move from non-policy queries to policy queries without any backward compatibility breaks, e.g. Conduit methods which accept 'offset'.
  - Separate the client limit ("limit") from the datafetch hint limit ("rawresultlimit") so we can make the heurstic smarter in the future if we want. Some discussion inline.

Test Plan: Expanded unit tests to cover offset behaviors.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D3192
This commit is contained in:
epriestley
2012-08-08 12:15:58 -07:00
parent 8a4c08b01d
commit ab92242e00
5 changed files with 250 additions and 18 deletions

View File

@@ -53,8 +53,8 @@ abstract class PhabricatorCursorPagedPolicyQuery
}
final protected function buildLimitClause(AphrontDatabaseConnection $conn_r) {
if ($this->getLimit()) {
return qsprintf($conn_r, 'LIMIT %d', $this->getLimit());
if ($this->getRawResultLimit()) {
return qsprintf($conn_r, 'LIMIT %d', $this->getRawResultLimit());
} else {
return '';
}