改名
This commit is contained in:
@@ -66,14 +66,15 @@ class Connection extends Pool
|
|||||||
if (!Context::hasContext('begin_' . $coroutineName)) {
|
if (!Context::hasContext('begin_' . $coroutineName)) {
|
||||||
Context::setContext('begin_' . $coroutineName, 0);
|
Context::setContext('begin_' . $coroutineName, 0);
|
||||||
}
|
}
|
||||||
if (Context::getContext('begin_' . $coroutineName) === 0) {
|
Context::autoIncr('begin_' . $coroutineName);
|
||||||
|
if (!Context::getContext('begin_' . $coroutineName) !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$connection = Context::getContext($coroutineName);
|
$connection = Context::getContext($coroutineName);
|
||||||
if ($connection instanceof PDO && !$connection->inTransaction()) {
|
if ($connection instanceof PDO && !$connection->inTransaction()) {
|
||||||
$connection->beginTransaction();
|
$connection->beginTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::autoIncr('begin_' . $coroutineName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $coroutineName
|
* @param $coroutineName
|
||||||
@@ -88,13 +89,14 @@ class Connection extends Pool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$connection = Context::getContext($coroutineName);
|
$connection = Context::getContext($coroutineName);
|
||||||
if ($connection instanceof PDO) {
|
if (!($connection instanceof PDO)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Context::setContext('begin_' . $coroutineName, 0);
|
||||||
if ($connection->inTransaction()) {
|
if ($connection->inTransaction()) {
|
||||||
$this->info('connection commit.');
|
$this->info('connection commit.');
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
}
|
}
|
||||||
Context::setContext('begin_' . $coroutineName, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user