Skip to content

Commit

Permalink
Move methods from Command to AbstractPDOCmmand class (yiisoft#243)
Browse files Browse the repository at this point in the history
* Move methods from `Command` to `AbstractPdoCommand` class

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
Tigrov and StyleCIBot authored Nov 7, 2023
1 parent 5ecee24 commit e0bd00d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 0 additions & 44 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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;
}
}
}
}
}

0 comments on commit e0bd00d

Please sign in to comment.