numCols = $result->numCols; parent::__construct(new Emitter(function (callable $emit) use ($result, $fetch) { $count = 0; try { do { $next = new Coroutine($fetch()); // Request next result before current is consumed. ++$count; yield $emit($result->fetchRow(pq\Result::FETCH_ASSOC)); $result = yield $next; } while ($result instanceof pq\Result); } finally { $this->complete(); } return $count; })); } public function numFields(): int { return $this->numCols; } }