Changeset View
Changeset View
Standalone View
Standalone View
src/applications/nuance/query/NuanceQueueQuery.php
| Show All 12 Lines | final class NuanceQueueQuery | ||||
| public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
| $this->phids = $phids; | $this->phids = $phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | protected function loadPage() { | ||||
| $table = new NuanceQueue(); | $table = new NuanceQueue(); | ||||
| $conn_r = $table->establishConnection('r'); | $conn = $table->establishConnection('r'); | ||||
| $data = queryfx_all( | $data = queryfx_all( | ||||
| $conn_r, | $conn, | ||||
| 'SELECT FROM %T %Q %Q %Q', | '%Q FROM %T %Q %Q %Q', | ||||
| $this->buildSelectClause($conn), | |||||
| $table->getTableName(), | $table->getTableName(), | ||||
| $this->buildWhereClause($conn_r), | $this->buildWhereClause($conn), | ||||
| $this->buildOrderClause($conn_r), | $this->buildOrderClause($conn), | ||||
| $this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn)); | ||||
| return $table->loadAllFromArray($data); | return $table->loadAllFromArray($data); | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
| $where[] = $this->buildPagingClause($conn_r); | if ($this->ids !== null) { | ||||
| if ($this->ids) { | |||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids) { | if ($this->phids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'phid IN (%Ls)', | 'phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $where; | ||||
| } | } | ||||
| } | } | ||||