1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 13:17:58 +02:00

Result::fetch() removed typehint (#257)

This commit is contained in:
Jan Pecha
2017-07-22 11:14:39 +02:00
committed by David Grudl
parent 2d5ac775bc
commit afe728d07a
2 changed files with 11 additions and 1 deletions

View File

@@ -162,8 +162,9 @@ class Result implements IDataSource
/** /**
* Fetches the row at current position, process optional type conversion. * Fetches the row at current position, process optional type conversion.
* and moves the internal cursor to the next position * and moves the internal cursor to the next position
* @return ?Row|array
*/ */
final public function fetch(): ?Row final public function fetch()
{ {
$row = $this->getResultDriver()->fetch(true); $row = $this->getResultDriver()->fetch(true);
if ($row === null) { if ($row === null) {

View File

@@ -52,6 +52,15 @@ Assert::equal([
], iterator_to_array($res)); ], iterator_to_array($res));
// fetch row by row as array
$res = $conn->query('SELECT * FROM [products] ORDER BY product_id')->setRowClass(null);
Assert::equal([
['product_id' => num(1), 'title' => 'Chair'],
['product_id' => num(2), 'title' => 'Table'],
['product_id' => num(3), 'title' => 'Computer'],
], iterator_to_array($res));
// fetch complete result set like association array // fetch complete result set like association array
$res = $conn->query('SELECT * FROM [products] ORDER BY product_id'); $res = $conn->query('SELECT * FROM [products] ORDER BY product_id');
Assert::equal([ Assert::equal([