From cbcdd5e17c8eabd5a3a578858a0484a17fc20fc9 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Wed, 22 Nov 2023 10:33:53 +0700 Subject: [PATCH] Do not call `CommandInterface::getRawSql()` if no `logger` or `profiler` --- src/Driver/Pdo/AbstractPdoCommand.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Driver/Pdo/AbstractPdoCommand.php b/src/Driver/Pdo/AbstractPdoCommand.php index bf3ae8252..dafd2227a 100644 --- a/src/Driver/Pdo/AbstractPdoCommand.php +++ b/src/Driver/Pdo/AbstractPdoCommand.php @@ -265,7 +265,12 @@ protected function logQuery(string $rawSql, string $category): void protected function queryInternal(int $queryMode): mixed { - $rawSql = $this->getRawSql(); + $rawSql = ''; + + if ($this->logger !== null || $this->profiler !== null) { + $rawSql = $this->getRawSql(); + } + $logCategory = self::class . '::' . $this->getQueryMode($queryMode); $this->logQuery($rawSql, $logCategory);