summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Logging/Statement.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/dbal/src/Logging/Statement.php')
-rw-r--r--vendor/doctrine/dbal/src/Logging/Statement.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Logging/Statement.php b/vendor/doctrine/dbal/src/Logging/Statement.php
new file mode 100644
index 0000000..ed1ca7f
--- /dev/null
+++ b/vendor/doctrine/dbal/src/Logging/Statement.php
@@ -0,0 +1,48 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Logging;
6
7use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware;
8use Doctrine\DBAL\Driver\Result as ResultInterface;
9use Doctrine\DBAL\Driver\Statement as StatementInterface;
10use Doctrine\DBAL\ParameterType;
11use Psr\Log\LoggerInterface;
12
13final class Statement extends AbstractStatementMiddleware
14{
15 /** @var array<int,mixed>|array<string,mixed> */
16 private array $params = [];
17
18 /** @var array<int,ParameterType>|array<string,ParameterType> */
19 private array $types = [];
20
21 /** @internal This statement can be only instantiated by its connection. */
22 public function __construct(
23 StatementInterface $statement,
24 private readonly LoggerInterface $logger,
25 private readonly string $sql,
26 ) {
27 parent::__construct($statement);
28 }
29
30 public function bindValue(int|string $param, mixed $value, ParameterType $type): void
31 {
32 $this->params[$param] = $value;
33 $this->types[$param] = $type;
34
35 parent::bindValue($param, $value, $type);
36 }
37
38 public function execute(): ResultInterface
39 {
40 $this->logger->debug('Executing statement: {sql} (parameters: {params}, types: {types})', [
41 'sql' => $this->sql,
42 'params' => $this->params,
43 'types' => $this->types,
44 ]);
45
46 return parent::execute();
47 }
48}