/** * 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; }
public function __construct(Statement $statement) { try { $this->crit = $statement->getCriteria(); if ($this->crit instanceof Criteria) { if ($this->crit->action == 'insert') { $this->insert_id = $statement->getInsertID(); } elseif ($this->crit->action == 'select') { while ($row = $statement->fetch()) { $this->rows[] = new Row($row, $statement); } $this->max_ptr = count($this->rows); $this->int_ptr = 0; } elseif ($this->crit->action = 'count') { $value = $statement->fetch(); $this->max_ptr = $value['num_col']; } } } catch (\Exception $e) { throw $e; } }
/** * executeLogFindMany * * Voer een zoekacties op meerdere records uit in de log-tabellen. * @param Statement $stmt * @return KVDdom_DomainObjectLogCollection */ protected function executeLogFindMany($stmt) { $stmt->execute(); $domainObjects = array(); while ($row = $stmt->fetch(PDO::FETCH_OBJ)) { $logObject = $this->doLogLoad($row->id, $row); $domainObjects[] = $logObject; } return new KVDdom_DomainObjectLogCollection($domainObjects); }