eee
This commit is contained in:
+60
-60
@@ -154,7 +154,7 @@ class Connection extends Component
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return strtolower($this->driver) . '.' . $this->cds;
|
return strtolower($this->driver) . '.' . $this->cds;
|
||||||
}
|
}
|
||||||
@@ -248,65 +248,65 @@ class Connection extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws
|
* @throws
|
||||||
* 事务回滚
|
* 事务回滚
|
||||||
*/
|
*/
|
||||||
public function rollback(): void
|
public function rollback(): void
|
||||||
{
|
{
|
||||||
$this->storey--;
|
$this->storey--;
|
||||||
if ($this->storey == 0) {
|
if ($this->storey == 0) {
|
||||||
if (!Context::exists($this->cds)) {
|
if (!Context::exists($this->cds)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$pdo = $this->getTransactionClient();
|
$pdo = $this->getTransactionClient();
|
||||||
if ($pdo->inTransaction()) {
|
if ($pdo->inTransaction()) {
|
||||||
$pdo->rollback();
|
$pdo->rollback();
|
||||||
}
|
}
|
||||||
$this->release($pdo);
|
$this->release($pdo);
|
||||||
Context::remove($this->cds);
|
Context::remove($this->cds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws
|
* @throws
|
||||||
* 事务提交
|
* 事务提交
|
||||||
*/
|
*/
|
||||||
public function commit(): void
|
public function commit(): void
|
||||||
{
|
{
|
||||||
$this->storey--;
|
$this->storey--;
|
||||||
if ($this->storey == 0) {
|
if ($this->storey == 0) {
|
||||||
if (!Context::exists($this->cds)) {
|
if (!Context::exists($this->cds)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$pdo = $this->getTransactionClient();
|
$pdo = $this->getTransactionClient();
|
||||||
if ($pdo->inTransaction()) {
|
if ($pdo->inTransaction()) {
|
||||||
$pdo->commit();
|
$pdo->commit();
|
||||||
}
|
}
|
||||||
$this->release($pdo);
|
$this->release($pdo);
|
||||||
Context::remove($this->cds);
|
Context::remove($this->cds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function clear(): void
|
public function clear(): void
|
||||||
{
|
{
|
||||||
/** @var PDO $pdo */
|
/** @var PDO $pdo */
|
||||||
$pdo = Context::get($this->cds);
|
$pdo = Context::get($this->cds);
|
||||||
if ($pdo === null) {
|
if ($pdo === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->inTransaction()) {
|
if ($this->inTransaction()) {
|
||||||
$pdo->rollback();
|
$pdo->rollback();
|
||||||
}
|
}
|
||||||
$this->release($pdo);
|
$this->release($pdo);
|
||||||
Context::remove($this->cds);
|
Context::remove($this->cds);
|
||||||
$this->storey = 0;
|
$this->storey = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user