コード例 #1
0
 public function next()
 {
     $this->currentBatch->next();
     $this->next = $this->currentBatch->current();
     if (null === $this->next && $this->currentBatchSize >= $this->batchSize) {
         $entries = $this->fetchBatch($this->scn + 1);
         $this->currentBatchSize = count($entries);
         $this->currentBatch = new \ArrayIterator($entries);
         if ($this->currentBatch->valid()) {
             $this->next = $this->currentBatch->current();
             $this->scn = $this->next->getScn();
         }
     }
 }
コード例 #2
0
 /**
  * @return string
  */
 private function buildWhereClause()
 {
     if (null === $this->lastItem && empty($this->whereClause)) {
         return '';
     }
     $query = "WHERE ";
     if (null !== $this->lastItem) {
         $query .= "((e.timestamp > :timestamp) OR (e.timestamp = :timestamp AND e.scn > :scn) " . " OR (e.timestamp = :timestamp AND e.scn = :scn AND e.aggregateIdentifier > :aggregateIdentifier))";
         $this->parameters[':timestamp'] = $this->lastItem->getTimestamp();
         $this->parameters[':scn'] = $this->lastItem->getScn();
         $this->parameters[':aggregateIdentifier'] = $this->lastItem->getAggregateIdentifier();
     }
     if (null !== $this->whereClause && strlen($this->whereClause) > 0) {
         if (null !== $this->lastItem) {
             $query .= " AND (";
         }
         $query .= $this->whereClause;
         if (null !== $this->lastItem) {
             $query .= ")";
         }
     }
     return $query;
 }