Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/query/PhabricatorOffsetPagedQuery.php
| Show All 21 Lines | abstract class PhabricatorOffsetPagedQuery extends PhabricatorQuery { | ||||
| final public function getOffset() { | final public function getOffset() { | ||||
| return $this->offset; | return $this->offset; | ||||
| } | } | ||||
| final public function getLimit() { | final public function getLimit() { | ||||
| return $this->limit; | return $this->limit; | ||||
| } | } | ||||
| protected function buildLimitClause(AphrontDatabaseConnection $conn_r) { | protected function buildLimitClause(AphrontDatabaseConnection $conn) { | ||||
| if ($this->limit && $this->offset) { | if ($this->limit && $this->offset) { | ||||
| return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, $this->limit); | return qsprintf($conn, 'LIMIT %d, %d', $this->offset, $this->limit); | ||||
| } else if ($this->limit) { | } else if ($this->limit) { | ||||
| return qsprintf($conn_r, 'LIMIT %d', $this->limit); | return qsprintf($conn, 'LIMIT %d', $this->limit); | ||||
| } else if ($this->offset) { | } else if ($this->offset) { | ||||
| return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX); | return qsprintf($conn, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX); | ||||
| } else { | } else { | ||||
| return ''; | return qsprintf($conn, ''); | ||||
amckinley: This is just required because `qsprintf` returns objects instead of strings now, right? | |||||
epriestleyAuthorUnsubmitted Done Inline ActionsYep, exactly. epriestley: Yep, exactly. | |||||
| } | } | ||||
| } | } | ||||
| final public function executeWithOffsetPager(PHUIPagerView $pager) { | final public function executeWithOffsetPager(PHUIPagerView $pager) { | ||||
| $this->setLimit($pager->getPageSize() + 1); | $this->setLimit($pager->getPageSize() + 1); | ||||
| $this->setOffset($pager->getOffset()); | $this->setOffset($pager->getOffset()); | ||||
| $results = $this->execute(); | $results = $this->execute(); | ||||
| return $pager->sliceResults($results); | return $pager->sliceResults($results); | ||||
| } | } | ||||
| } | } | ||||
This is just required because qsprintf returns objects instead of strings now, right?