Example #1
0
 /**
  * Move: Random access to a specific row in the recordset.
  * Some databases do not support
  * access to previous rows in the databases (no scrolling backwards).
  *
  * @param rowNumber is the row to move to (0-based)
  *
  * @return true if there still rows available,
  *         or false if there are no more rows (EOF).
  */
 public function move($rowNumber = 0)
 {
     $this->EOF = false;
     if ($this->numOfRows > 0 && $rowNumber >= $this->numOfRows) {
         $rowNumber = $this->numOfRows - 2;
         // Overflow to last record
     }
     if ($rowNumber == $this->currentRow) {
         return true;
     }
     if ($this->canSeek) {
         $fields = $this->statement->fetch($rowNumber);
     } else {
         if ($this->bufferedResults === null) {
             $this->bufferedResults = $this->statement->fetchAll();
         }
         $fields = $this->bufferedResults[$rowNumber];
     }
     if ($fields) {
         $this->fields = $fields;
         $this->currentRow = $rowNumber;
         return true;
     }
     $this->fields = false;
     $this->EOF = true;
     return false;
 }
Example #2
0
 /**
  * @param Statement $query
  */
 public function __construct(Statement $query)
 {
     $this->query = $query;
     $this->results = $query->fetchAll();
 }
Example #3
0
 /**
  * Constructor
  *
  * @param mixed $statement statement
  */
 public function __construct(Statement $statement)
 {
     $this->_data = $statement->fetchAll();
 }