Skip to content

Commit

Permalink
Move methods from Command to AbstractPdoCommand class
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Nov 5, 2023
1 parent 11f981b commit 0b6c162
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public function showDatabases(): array
return $this->setSql($sql)->queryColumn();
}

protected function getQueryBuilder(): QueryBuilderInterface
{
return $this->db->getQueryBuilder();
}

/**
* Executes the SQL statement.
*
Expand Down Expand Up @@ -105,43 +100,6 @@ public function execute(): int
return $result;
}

/**
* @psalm-suppress UnusedClosureParam
*
* @throws Throwable
*/
protected function internalExecute(string|null $rawSql): void
{
$attempt = 0;

while (true) {
try {
if (
++$attempt === 1
&& $this->isolationLevel !== null
&& $this->db->getTransaction() === null
) {
$this->db->transaction(
function () use ($rawSql): void {
$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;
}
}
}
}

/**
* Performs the actual DB query of an SQL statement.
*
Expand Down

0 comments on commit 0b6c162

Please sign in to comment.