Add rowCount() to the Result interface

parent cc5bbd01
......@@ -48,11 +48,19 @@ class ArrayStatement implements IteratorAggregate, ResultStatement, Result
*/
public function closeCursor()
{
unset($this->data);
$this->data = [];
return true;
}
/**
* {@inheritdoc}
*/
public function rowCount()
{
return count($this->data);
}
/**
* {@inheritdoc}
*/
......
......@@ -63,6 +63,17 @@ interface Result
*/
public function fetchFirstColumn(): array;
/**
* Returns the number of rows affected by the DELETE, INSERT, or UPDATE statement that produced the result.
*
* If the statement executed a SELECT query or a similar platform-specific SQL (e.g. DESCRIBE, SHOW, etc.),
* some database drivers may return the number of rows returned by that query. However, this behaviour
* is not guaranteed for all drivers and should not be relied on in portable applications.
*
* @return int The number of rows.
*/
public function rowCount();
/**
* Returns the number of columns in the result
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment