Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/query/ConpherenceParticipantQuery.php
| Show All 24 Lines | |||||
| * id(new ConpherenceParticipantQuery()) | * id(new ConpherenceParticipantQuery()) | ||||
| * ->withParticipantPHIDs(array($my_phid)) | * ->withParticipantPHIDs(array($my_phid)) | ||||
| * ->withParticipantCursor($bottom_participant) | * ->withParticipantCursor($bottom_participant) | ||||
| * ->setOrder(ConpherenceParticipantQuery::ORDER_OLDER) | * ->setOrder(ConpherenceParticipantQuery::ORDER_OLDER) | ||||
| * ->execute(); | * ->execute(); | ||||
| * | * | ||||
| * For counts of read, un-read, or all conpherences by participant, see | * For counts of read, un-read, or all conpherences by participant, see | ||||
| * @{class:ConpherenceParticipantCountQuery}. | * @{class:ConpherenceParticipantCountQuery}. | ||||
| * | |||||
| * @group conpherence | |||||
| */ | */ | ||||
| final class ConpherenceParticipantQuery | final class ConpherenceParticipantQuery extends PhabricatorOffsetPagedQuery { | ||||
| extends PhabricatorOffsetPagedQuery { | |||||
| const LIMIT = 100; | const LIMIT = 100; | ||||
| const ORDER_NEWER = 'newer'; | const ORDER_NEWER = 'newer'; | ||||
| const ORDER_OLDER = 'older'; | const ORDER_OLDER = 'older'; | ||||
| private $participantPHIDs; | private $participantPHIDs; | ||||
| private $participantCursor; | private $participantCursor; | ||||
| private $order = self::ORDER_OLDER; | private $order = self::ORDER_OLDER; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | if ($this->participantCursor) { | ||||
| $compare_id, | $compare_id, | ||||
| $id); | $id); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($where); | ||||
| } | } | ||||
| private function buildOrderClause(AphrontDatabaseConnection $conn_r) { | private function buildOrderClause(AphrontDatabaseConnection $conn_r) { | ||||
| $order_word = ($this->order == self::ORDER_OLDER) ? 'DESC' : 'ASC'; | $order_word = ($this->order == self::ORDER_OLDER) ? 'DESC' : 'ASC'; | ||||
| // if these are different direction we won't get as efficient a query | // if these are different direction we won't get as efficient a query | ||||
| // see http://dev.mysql.com/doc/refman/5.5/en/order-by-optimization.html | // see http://dev.mysql.com/doc/refman/5.5/en/order-by-optimization.html | ||||
| $order = qsprintf( | $order = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'ORDER BY dateTouched %Q, id %Q', | 'ORDER BY dateTouched %Q, id %Q', | ||||
| $order_word, | $order_word, | ||||
| $order_word); | $order_word); | ||||
| return $order; | return $order; | ||||
| } | } | ||||
| } | } | ||||