statement = $statement; $this->execute = $execute; $this->deallocate = $deallocate; $this->queue = new Internal\ReferenceQueue; } public function __destruct() { ($this->deallocate)($this->statement->name); $this->queue->unreference(); } /** * @return string */ public function getQuery(): string { return $this->statement->query; } /** * @param mixed ...$params * * @return \Amp\Promise<\Amp\Postgres\Result> * * @throws \Amp\Postgres\FailureException If executing the statement fails. */ public function execute(array $params = []): Promise { return ($this->execute)([$this->statement, "execAsync"], $params); } /** * @param callable $onDestruct */ public function onDestruct(callable $onDestruct) { $this->queue->onDestruct($onDestruct); } }