From 04fc107cc00471a573e842959ecc71767e8113e1 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Wed, 26 Sep 2018 11:32:13 -0500 Subject: [PATCH] Add prepare method to StatementPool --- src/StatementPool.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/StatementPool.php b/src/StatementPool.php index f6b7800..55f1307 100644 --- a/src/StatementPool.php +++ b/src/StatementPool.php @@ -26,6 +26,16 @@ abstract class StatementPool implements Statement /** @var callable */ 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 callable $release @@ -87,6 +97,7 @@ abstract class StatementPool implements Statement \assert($statement instanceof Statement); try { + $statement = $this->prepare($statement); $result = yield $statement->execute($params); } catch (\Throwable $exception) { $this->push($statement);