eee
This commit is contained in:
+5
-20
@@ -215,11 +215,7 @@ class Connection extends Component
|
|||||||
public function beginTransaction(): static
|
public function beginTransaction(): static
|
||||||
{
|
{
|
||||||
if ($this->storey == 0) {
|
if ($this->storey == 0) {
|
||||||
/** @var PDO $pdo */
|
$pdo = $this->getTransactionClient();
|
||||||
$pdo = Context::get($this->cds);
|
|
||||||
if ($pdo == null) {
|
|
||||||
$pdo = $this->getTransactionClient();
|
|
||||||
}
|
|
||||||
if (!$pdo->inTransaction()) {
|
if (!$pdo->inTransaction()) {
|
||||||
$pdo->beginTransaction();
|
$pdo->beginTransaction();
|
||||||
}
|
}
|
||||||
@@ -261,14 +257,8 @@ class Connection extends Component
|
|||||||
{
|
{
|
||||||
$this->storey--;
|
$this->storey--;
|
||||||
if ($this->storey == 0) {
|
if ($this->storey == 0) {
|
||||||
/** @var PDO $pdo */
|
$pdo = $this->getTransactionClient();
|
||||||
$pdo = Context::get($this->cds);
|
$pdo->rollback();
|
||||||
if ($pdo === null) {
|
|
||||||
throw new Exception(self::ERROR_MSG);
|
|
||||||
}
|
|
||||||
if ($this->inTransaction()) {
|
|
||||||
$pdo->rollback();
|
|
||||||
}
|
|
||||||
$this->release($pdo);
|
$this->release($pdo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,13 +271,8 @@ class Connection extends Component
|
|||||||
{
|
{
|
||||||
$this->storey--;
|
$this->storey--;
|
||||||
if ($this->storey == 0) {
|
if ($this->storey == 0) {
|
||||||
$pdo = Context::get($this->cds);
|
$pdo = $this->getTransactionClient();
|
||||||
if ($pdo === null) {
|
$pdo->commit();
|
||||||
throw new Exception(self::ERROR_MSG);
|
|
||||||
}
|
|
||||||
if ($this->inTransaction()) {
|
|
||||||
$pdo->commit();
|
|
||||||
}
|
|
||||||
$this->release($pdo);
|
$this->release($pdo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user