Ejemplo n.º 1
0
 /**
  * Rewinds the iterator.
  * For future iterations seeks if possible, clones otherwise.
  */
 public function rewind()
 {
     try {
         $count = count($this);
     } catch (DriverException $e) {
         $count = -1;
     }
     if ($this->row !== null && $count > 0) {
         try {
             $this->seek(0);
         } catch (DriverException $e) {
             $clone = clone $this->result;
             $this->result->__destruct();
             $this->result = $clone;
             $this->pointer = 0;
             $this->row = $this->result->fetch();
         }
     } else {
         $this->pointer = 0;
         $this->row = $this->result->fetch();
     }
 }