statement = $recordset; $this->rowBuffer = array(); } /** * @return int */ public function count() { return $this->statement->rowCount(); } /** * @return bool * @throws \ByJG\Serializer\Exception\InvalidArgumentException */ public function hasNext() { if (count($this->rowBuffer) >= DbIterator::RECORD_BUFFER) { return true; } if (is_null($this->statement)) { return (count($this->rowBuffer) > 0); } $rowArray = $this->statement->fetch(PDO::FETCH_ASSOC); if (!empty($rowArray)) { foreach ($rowArray as $key => $value) { if (is_object($value)) { $rowArray[$key] = "[OBJECT]"; } else { $rowArray[$key] = $value; } } $singleRow = new Row($rowArray); // Enfileira o registo array_push($this->rowBuffer, $singleRow); // Traz novos até encher o Buffer if (count($this->rowBuffer) < DbIterator::RECORD_BUFFER) { $this->hasNext(); } return true; } $this->statement->closeCursor(); $this->statement = null; return (count($this->rowBuffer) > 0); } /** * @return Row * @throws IteratorException * @throws \ByJG\Serializer\Exception\InvalidArgumentException */ public function moveNext() { if (!$this->hasNext()) { throw new IteratorException("No more records. Did you used hasNext() before moveNext()?"); } else { $singleRow = array_shift($this->rowBuffer); $this->currentRow++; return $singleRow; } } public function key() { return $this->currentRow; } } __halt_compiler();----SIGNATURE:----xAOhEPuSL66oEe8k7kJylrNsix/S46tPG2cPjaV3JKvZu6ks/QMX8XMu6d7OL/NNFpDtm1INIVzUDvMniFANmp9xbpSWHfFYVfkGlIZK2AjgwyTYap4algxoa2rVX7yafduP26ryj94GtvOo0lESzglANgORIpLA9EBfq+dNGqBzLVQnE5eUD8MOECgi/nYTYj7riqNgtJ6DPAu+YtdwaXI2Sglp3n9mlfOYgiT22pmXUwh2kXp8uIqO61zZxA+h7E+fomh/+jGSpkMyZTrARx99ROxuTeAGoZcgTS5N/Fm4CMIq3TbpfqPMUkvg1R38H3OtGmWWGwxKEGkJk/AU7LHO3Ejs1dKUGIjwLSGCNodNHNRA58B04KiT6urcEnEdBPHpeMW72eS/BudV4ic21rs/4Kt3NmoLAeMSYZTQS/31KFQ0DsVW4eIBMXcfZRdZu4fSzZaCEz8uuinPkiJUu5T7Y7eWxp324wu/yC8slJDFDaHBCqq6e+Lt2SIZayeTZ3qTRAO4iUez5ve5bIVZL0mi3dOTAz3gWafidNNlhyORMJgTaPudp8uqBVVGMnh4JdC3XEwhA5VdSfVqJLr72ojcQDU4V/BUfF1pg/qVVsZSZv8/78acbUQZTsODzkX1I7+x/+rY2rqc2IcyZhYUz6PnTzoeCyV/pE7znMFSqjQ=----ATTACHMENT:----MTM4MDI3NTExNDc4NTEgMzYwNDA3NDM5MjA5Nzk4IDE5MDMzNTQwMzExODE4MA==