Skip to content

Commit 7d3ffb8

Browse files
authored
Remove result advance in constructor and correct getValue() hasRead checking
1 parent f1565dc commit 7d3ffb8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Result.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public function __construct(TypeConversionProvider $typeConversionProvider, int
5959
$this->rowCount = $rowCount;
6060
$this->results = $results;
6161
$this->results->rewind();
62-
$this->results->next();
6362
$row = $this->results->current();
6463
if (is_array($row))
6564
{
@@ -142,7 +141,7 @@ public function getNameOf(int $ordinal): string
142141
*/
143142
public function getValue(string|int $nameOrOrdinal, string $expectedType = 'mixed'): mixed
144143
{
145-
if ($this->hasRead()) throw new ResultNotReadException();
144+
if (!$this->hasRead()) throw new ResultNotReadException();
146145
$name = '';
147146
$ordinal = -1;
148147
$this->getNameAndOrdinal($nameOrOrdinal, $name, $ordinal);
@@ -190,4 +189,4 @@ private function hasRead(): bool
190189
{
191190
return $this->currentRow !== false;
192191
}
193-
}
192+
}

0 commit comments

Comments
 (0)