Example #1
0
 /**
  * Returns an iterator for a select statement
  *
  * @param   rdbms.SQLExpression criteria or statement
  * @param   bool buffered default TRUE
  * @return  rdbms.ResultIterator
  * @see     xp://lang.XPIterator
  */
 public function iteratorFor(SQLExpression $criteria, $buffered = true)
 {
     $jp = $criteria->isJoin() ? new JoinProcessor($this) : null;
     $rs = $criteria->executeSelect($this->getConnection(), $this, $jp, $buffered);
     // if this is a projection, it does no matter if it's a join or not
     if ($criteria->isProjection()) {
         return new ResultIterator($rs, 'rdbms\\Record');
     }
     if ($criteria->isJoin()) {
         return $jp->getJoinIterator($rs);
     }
     return new ResultIterator($rs, $this->identifier);
 }