1
0
mirror of https://github.com/danog/postgres.git synced 2024-12-16 03:17:14 +01:00
postgres/lib/Internal/PooledStatement.php

48 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace Amp\Postgres\Internal;
use Amp\Postgres\Connection;
use Amp\Postgres\Statement;
use Amp\Promise;
class PooledStatement implements Statement {
/** @var \Amp\Postgres\Connection */
private $connection;
/** @var \Amp\Postgres\Statement */
private $statement;
/** @var callable */
private $push;
/**
* @param \Amp\Postgres\Connection $connection
* @param \Amp\Postgres\Statement $statement
* @param callable $push
*/
public function __construct(Connection $connection, Statement $statement, callable $push) {
$this->connection = $connection;
$this->statement = $statement;
$this->push = $push;
}
public function __destruct() {
($this->push)($this->connection);
}
/**
* {@inheritdoc}
*/
public function execute(...$params): Promise {
return $this->statement->execute(...$params);
}
2017-11-06 01:18:01 +01:00
/**
* {@inheritdoc}
*/
public function getQuery(): string {
return $this->statement->getQuery();
}
}