Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add some more doc blocks to BufferedStatement.

  • Loading branch information...
commit 081383590a3a7e57f84b23e6ddf067d215a71ce9 1 parent d90abb8
Mark Story markstory authored
Showing with 23 additions and 3 deletions.
  1. +23 −3 src/Database/Statement/BufferedStatement.php
26 src/Database/Statement/BufferedStatement.php
View
@@ -16,6 +16,12 @@
*/
namespace Cake\Database\Statement;
+/**
+ * A statement decorator that implements buffered results.
+ *
+ * This statement decorator will save fetched results in memory, allowing
+ * the iterator to be rewound and reused.
+ */
class BufferedStatement extends StatementDecorator {
protected $_count = 0;
@@ -38,14 +44,19 @@ public function __construct($statement = null, $driver = null) {
$this->_reset();
}
- /**
- * @param array $params list of values to be bound to query
- */
+/**
+ * Execute the statement and return the results.
+ *
+ * @param array $params list of values to be bound to query
+ */
public function execute($params = null) {
$this->_reset();
return parent::execute($params);
}
+/**
+ * {@inheritDoc}
+ */
public function fetch($type = 'num') {
if ($this->_allFetched) {
$row = ($this->_counter < $this->_count) ? $this->_records[$this->_counter++] : false;
@@ -67,6 +78,9 @@ public function fetch($type = 'num') {
return $this->_records[] = $record;
}
+/**
+ * {@inheritDoc}
+ */
public function fetchAll($type = 'num') {
if ($this->_allFetched) {
return $this->_records;
@@ -79,6 +93,9 @@ public function fetchAll($type = 'num') {
return $this->_records;
}
+/**
+ * {@inheritDoc}
+ */
public function rowCount() {
if (!$this->_allFetched) {
$counter = $this->_counter;
@@ -89,6 +106,9 @@ public function rowCount() {
return $this->_count;
}
+/**
+ * {@inheritDoc}
+ */
public function rewind() {
$this->_counter = 0;
}
Please sign in to comment.
Something went wrong with that request. Please try again.