modify plugin name

This commit is contained in:
2022-02-25 18:16:50 +08:00
parent 6febf0c20f
commit 1d809efda8
+12 -19
View File
@@ -183,16 +183,8 @@ class Connection extends Component
*/ */
public function beginTransaction(): static public function beginTransaction(): static
{ {
$this->connections()->beginTransaction([ $pdo = $this->masterInstance();
'cds' => $this->cds, $pdo->beginTransaction();
'username' => $this->username,
'password' => $this->password,
'attributes' => $this->attributes,
'connect_timeout' => $this->connect_timeout,
'read_timeout' => $this->read_timeout,
'dbname' => $this->database,
'pool' => $this->pool
]);
return $this; return $this;
} }
@@ -202,7 +194,8 @@ class Connection extends Component
*/ */
public function inTransaction(): bool|static public function inTransaction(): bool|static
{ {
return $this->connections()->inTransaction($this->cds); $pdo = $this->masterInstance();
return $pdo->inTransaction();
} }
/** /**
@@ -211,12 +204,12 @@ class Connection extends Component
*/ */
public function rollback() public function rollback()
{ {
$this->connections()->rollback($this->cds); $pdo = $this->masterInstance();
$pdo = Context::getContext($this->cds);
Context::remove($this->cds); Context::remove($this->cds);
if ($pdo instanceof PDO) { if ($pdo->inTransaction()) {
$this->release($pdo, $this->cds); $pdo->rollback();
} }
$this->release($pdo, $this->cds);
} }
/** /**
@@ -225,12 +218,12 @@ class Connection extends Component
*/ */
public function commit() public function commit()
{ {
$this->connections()->commit($this->cds); $pdo = $this->masterInstance();
$pdo = Context::getContext($this->cds);
Context::remove($this->cds); Context::remove($this->cds);
if ($pdo instanceof PDO) { if ($pdo->inTransaction()) {
$this->release($pdo, $this->cds); $pdo->commit();
} }
$this->release($pdo, $this->cds);
} }