Add prepare method to StatementPool
This commit is contained in:
parent
9b667bafdf
commit
04fc107cc0
@ -26,6 +26,16 @@ abstract class StatementPool implements Statement
|
|||||||
/** @var callable */
|
/** @var callable */
|
||||||
private $prepare;
|
private $prepare;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs any necessary actions to the statement to prepare it for execution, returning the same or a new
|
||||||
|
* Statement object if necessary.
|
||||||
|
*
|
||||||
|
* @param Statement $statement
|
||||||
|
*
|
||||||
|
* @return Statement
|
||||||
|
*/
|
||||||
|
abstract protected function prepare(Statement $statement): Statement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ResultSet $resultSet
|
* @param ResultSet $resultSet
|
||||||
* @param callable $release
|
* @param callable $release
|
||||||
@ -87,6 +97,7 @@ abstract class StatementPool implements Statement
|
|||||||
\assert($statement instanceof Statement);
|
\assert($statement instanceof Statement);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$statement = $this->prepare($statement);
|
||||||
$result = yield $statement->execute($params);
|
$result = yield $statement->execute($params);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->push($statement);
|
$this->push($statement);
|
||||||
|
Loading…
Reference in New Issue
Block a user