改名
This commit is contained in:
@@ -47,7 +47,7 @@ class Connection extends Component
|
|||||||
if (!Context::hasContext('begin_' . $coroutineName)) {
|
if (!Context::hasContext('begin_' . $coroutineName)) {
|
||||||
Context::setContext('begin_' . $coroutineName, 0);
|
Context::setContext('begin_' . $coroutineName, 0);
|
||||||
}
|
}
|
||||||
Context::increment('begin_' . $coroutineName, 1);
|
Context::increment('begin_' . $coroutineName);
|
||||||
|
|
||||||
$connection = Context::getContext($coroutineName);
|
$connection = Context::getContext($coroutineName);
|
||||||
if ($connection instanceof PDO && !$connection->inTransaction()) {
|
if ($connection instanceof PDO && !$connection->inTransaction()) {
|
||||||
@@ -62,14 +62,13 @@ class Connection extends Component
|
|||||||
public function commit($coroutineName)
|
public function commit($coroutineName)
|
||||||
{
|
{
|
||||||
$coroutineName = $this->name('Mysql:' . $coroutineName, true);
|
$coroutineName = $this->name('Mysql:' . $coroutineName, true);
|
||||||
if (Context::decrement('begin_' . $coroutineName) > 0) {
|
if (Context::decrement('begin_' . $coroutineName) == 1) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
$connection = Context::getContext($coroutineName);
|
$connection = Context::getContext($coroutineName);
|
||||||
if ($connection instanceof PDO && $connection->inTransaction()) {
|
if ($connection instanceof PDO && $connection->inTransaction()) {
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,15 +78,14 @@ class Connection extends Component
|
|||||||
public function rollback($coroutineName)
|
public function rollback($coroutineName)
|
||||||
{
|
{
|
||||||
$coroutineName = $this->name('Mysql:' . $coroutineName, true);
|
$coroutineName = $this->name('Mysql:' . $coroutineName, true);
|
||||||
if (Context::decrement('begin_' . $coroutineName) > 0) {
|
if (Context::decrement('begin_' . $coroutineName) == 1) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (($connection = Context::getContext($coroutineName)) instanceof PDO) {
|
if (($connection = Context::getContext($coroutineName)) instanceof PDO) {
|
||||||
if ($connection->inTransaction()) {
|
if ($connection->inTransaction()) {
|
||||||
$connection->rollBack();
|
$connection->rollBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user