From e0bd00d7c73c7cf0130d168e06d7c614747e09f6 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Tue, 7 Nov 2023 17:47:57 +0700 Subject: [PATCH] Move methods from `Command` to `AbstractPDOCmmand` class (#243) * Move methods from `Command` to `AbstractPdoCommand` class --------- Co-authored-by: StyleCI Bot --- CHANGELOG.md | 1 + src/Command.php | 44 -------------------------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b94a65..aec8b33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Bug #233: Refactor `DMLQueryBuilder`, related with yiisoft/db#746 (@Tigrov) - Enh #230: Improve column type #230 (@Tigrov) - Bug #240: Remove `RECURSIVE` expression from CTE queries (@Tigrov) +- Enh #243: Move methods from `Command` to `AbstractPdoCommand` class (@Tigrov) ## 1.1.0 July 24, 2023 diff --git a/src/Command.php b/src/Command.php index 5b809a2..549f2c1 100644 --- a/src/Command.php +++ b/src/Command.php @@ -5,12 +5,8 @@ namespace Yiisoft\Db\Oracle; use PDO; -use PDOException; -use Throwable; use Yiisoft\Db\Driver\Pdo\AbstractPdoCommand; -use Yiisoft\Db\Exception\ConvertException; use Yiisoft\Db\QueryBuilder\AbstractQueryBuilder; -use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; use Yiisoft\Db\Schema\SchemaInterface; use function array_keys; @@ -91,11 +87,6 @@ public function showDatabases(): array return $this->setSql($sql)->queryColumn(); } - protected function getQueryBuilder(): QueryBuilderInterface - { - return $this->db->getQueryBuilder(); - } - protected function bindPendingParams(): void { $paramsPassedByReference = []; @@ -117,39 +108,4 @@ protected function bindPendingParams(): void } } } - - /** - * @psalm-suppress UnusedClosureParam - * - * @throws Throwable - */ - protected function internalExecute(?string $rawSql): void - { - $attempt = 0; - - while (true) { - try { - if ( - ++$attempt === 1 - && $this->isolationLevel !== null - && $this->db->getTransaction() === null - ) { - $this->db->transaction( - fn () => $this->internalExecute($rawSql), - $this->isolationLevel - ); - } else { - $this->pdoStatement?->execute(); - } - break; - } catch (PDOException $e) { - $rawSql = $rawSql ?: $this->getRawSql(); - $e = (new ConvertException($e, $rawSql))->run(); - - if ($this->retryHandler === null || !($this->retryHandler)($e, $attempt)) { - throw $e; - } - } - } - } }