<?php declare(strict_types=1);namespace Forrest79\PhPgSql\Db;class AsyncQuery{private Connection $connection;private ResultBuilder $resultBuilder;private AsyncHelper $asyncHelper;private Query $query;private string|null $preparedStatementName;public function __construct(Connection $connection,ResultBuilder $resultBuilder,AsyncHelper $asyncHelper,Query $query,string|null $preparedStatementName = null,){$this->connection = $connection;$this->resultBuilder = $resultBuilder;$this->asyncHelper = $asyncHelper;$this->query = $query;$this->preparedStatementName = $preparedStatementName;}public function getQuery(): Query{return $this->query;}/*** @throws Exceptions\QueryException*/public function getNextResult(): Result{$actualAsyncQuery = $this->asyncHelper->getAsyncQuery();$actualAsyncExecuteQuery = $this->asyncHelper->getAsyncExecuteQuery();if (($actualAsyncQuery === null) && ($actualAsyncExecuteQuery === null)) {throw Exceptions\ConnectionException::asyncNoQueryIsSent();} else if (($actualAsyncQuery !== $this) || ($actualAsyncExecuteQuery !== null)) {throw Exceptions\ConnectionException::anotherAsyncQueryIsRunning($this->getQuery()->sql,$actualAsyncExecuteQuery ?? $actualAsyncQuery->getQuery()->sql,);}$resource = \pg_get_result($this->connection->getResource());if ($resource === false) {$this->asyncHelper->clearQuery();throw Exceptions\ResultException::noOtherAsyncResult($this->getQuery());}if (!$this->asyncHelper::checkAsyncQueryResult($resource)) {if ($this->preparedStatementName === null) {throw Exceptions\QueryException::asyncQueryFailed($this->getQuery(), (string) \pg_result_error($resource));} else {throw Exceptions\QueryException::asyncPreparedStatementQueryFailed($this->preparedStatementName,$this->getQuery(),(string) \pg_result_error($resource),);}}return $this->resultBuilder->build($resource, $this->getQuery());}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。