Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/query/PhabricatorNamedQueryQuery.php
| Show All 22 Lines | public function withEngineClassNames(array $engine_class_names) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withQueryKeys(array $query_keys) { | public function withQueryKeys(array $query_keys) { | ||||
| $this->queryKeys = $query_keys; | $this->queryKeys = $query_keys; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | public function newResultObject() { | ||||
| $table = new PhabricatorNamedQuery(); | return new PhabricatorNamedQuery(); | ||||
| $conn_r = $table->establishConnection('r'); | } | ||||
| $data = queryfx_all( | |||||
| $conn_r, | |||||
| 'SELECT * FROM %T %Q %Q %Q', | |||||
| $table->getTableName(), | |||||
| $this->buildWhereClause($conn_r), | |||||
| $this->buildOrderClause($conn_r), | |||||
| $this->buildLimitClause($conn_r)); | |||||
| return $table->loadAllFromArray($data); | protected function loadPage() { | ||||
| return $this->loadStandardPage($this->newResultObject()); | |||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
| if ($this->ids) { | if ($this->ids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->engineClassNames) { | if ($this->engineClassNames !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'engineClassName IN (%Ls)', | 'engineClassName IN (%Ls)', | ||||
| $this->engineClassNames); | $this->engineClassNames); | ||||
| } | } | ||||
| if ($this->userPHIDs) { | if ($this->userPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'userPHID IN (%Ls)', | 'userPHID IN (%Ls)', | ||||
| $this->userPHIDs); | $this->userPHIDs); | ||||
| } | } | ||||
| if ($this->queryKeys) { | if ($this->queryKeys !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'queryKey IN (%Ls)', | 'queryKey IN (%Ls)', | ||||
| $this->queryKeys); | $this->queryKeys); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | return $where; | ||||
| return $this->formatWhereClause($where); | |||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorSearchApplication'; | return 'PhabricatorSearchApplication'; | ||||
| } | } | ||||
| } | } | ||||