diff --git a/Connection.php b/Connection.php index 6923f56..7bbe661 100644 --- a/Connection.php +++ b/Connection.php @@ -154,7 +154,7 @@ class Connection extends Component /** * @return string */ - private function getName(): string + public function getName(): string { return strtolower($this->driver) . '.' . $this->cds; } @@ -248,65 +248,65 @@ class Connection extends Component } - /** - * @throws - * 事务回滚 - */ - public function rollback(): void - { - $this->storey--; - if ($this->storey == 0) { - if (!Context::exists($this->cds)) { - return; - } - $pdo = $this->getTransactionClient(); - if ($pdo->inTransaction()) { - $pdo->rollback(); - } - $this->release($pdo); - Context::remove($this->cds); - } - } - - /** - * @throws - * 事务提交 - */ - public function commit(): void - { - $this->storey--; - if ($this->storey == 0) { - if (!Context::exists($this->cds)) { - return; - } - $pdo = $this->getTransactionClient(); - if ($pdo->inTransaction()) { - $pdo->commit(); - } - $this->release($pdo); - Context::remove($this->cds); - } - } - - - /** - * @return void - * @throws - */ - public function clear(): void - { - /** @var PDO $pdo */ - $pdo = Context::get($this->cds); - if ($pdo === null) { - return; - } - if ($this->inTransaction()) { - $pdo->rollback(); - } - $this->release($pdo); - Context::remove($this->cds); - $this->storey = 0; - } + /** + * @throws + * 事务回滚 + */ + public function rollback(): void + { + $this->storey--; + if ($this->storey == 0) { + if (!Context::exists($this->cds)) { + return; + } + $pdo = $this->getTransactionClient(); + if ($pdo->inTransaction()) { + $pdo->rollback(); + } + $this->release($pdo); + Context::remove($this->cds); + } + } + + /** + * @throws + * 事务提交 + */ + public function commit(): void + { + $this->storey--; + if ($this->storey == 0) { + if (!Context::exists($this->cds)) { + return; + } + $pdo = $this->getTransactionClient(); + if ($pdo->inTransaction()) { + $pdo->commit(); + } + $this->release($pdo); + Context::remove($this->cds); + } + } + + + /** + * @return void + * @throws + */ + public function clear(): void + { + /** @var PDO $pdo */ + $pdo = Context::get($this->cds); + if ($pdo === null) { + return; + } + if ($this->inTransaction()) { + $pdo->rollback(); + } + $this->release($pdo); + Context::remove($this->cds); + $this->storey = 0; + } /**