Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/query/HeraldTranscriptQuery.php
| Show All 24 Lines | final class HeraldTranscriptQuery | ||||
| public function needPartialRecords($need_partial) { | public function needPartialRecords($need_partial) { | ||||
| $this->needPartialRecords = $need_partial; | $this->needPartialRecords = $need_partial; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | protected function loadPage() { | ||||
| $transcript = new HeraldTranscript(); | $transcript = new HeraldTranscript(); | ||||
| $conn_r = $transcript->establishConnection('r'); | $conn = $transcript->establishConnection('r'); | ||||
| // NOTE: Transcripts include a potentially enormous amount of serialized | // NOTE: Transcripts include a potentially enormous amount of serialized | ||||
| // data, so we're loading only some of the fields here if the caller asked | // data, so we're loading only some of the fields here if the caller asked | ||||
| // for partial records. | // for partial records. | ||||
| if ($this->needPartialRecords) { | if ($this->needPartialRecords) { | ||||
| $fields = implode( | $fields = array( | ||||
| ', ', | |||||
| array( | |||||
| 'id', | 'id', | ||||
| 'phid', | 'phid', | ||||
| 'objectPHID', | 'objectPHID', | ||||
| 'time', | 'time', | ||||
| 'duration', | 'duration', | ||||
| 'dryRun', | 'dryRun', | ||||
| 'host', | 'host', | ||||
| )); | ); | ||||
| $fields = qsprintf($conn, '%LC', $fields); | |||||
| } else { | } else { | ||||
| $fields = '*'; | $fields = qsprintf($conn, '*'); | ||||
| } | } | ||||
| $rows = queryfx_all( | $rows = queryfx_all( | ||||
| $conn_r, | $conn, | ||||
| 'SELECT %Q FROM %T t %Q %Q %Q', | 'SELECT %Q FROM %T t %Q %Q %Q', | ||||
| $fields, | $fields, | ||||
| $transcript->getTableName(), | $transcript->getTableName(), | ||||
| $this->buildWhereClause($conn_r), | $this->buildWhereClause($conn), | ||||
| $this->buildOrderClause($conn_r), | $this->buildOrderClause($conn), | ||||
| $this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn)); | ||||
| $transcripts = $transcript->loadAllFromArray($rows); | $transcripts = $transcript->loadAllFromArray($rows); | ||||
| if ($this->needPartialRecords) { | if ($this->needPartialRecords) { | ||||
| // Make sure nothing tries to write these; they aren't complete. | // Make sure nothing tries to write these; they aren't complete. | ||||
| foreach ($transcripts as $transcript) { | foreach ($transcripts as $transcript) { | ||||
| $transcript->makeEphemeral(); | $transcript->makeEphemeral(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||