This commit is contained in:
as2252258@163.com
2021-07-03 13:24:14 +08:00
parent 9feebc2b73
commit 382a6ff1b5
3 changed files with 80 additions and 74 deletions
+2
View File
@@ -125,7 +125,9 @@ class Connection extends Pool
if (($pdo = Context::getContext($coroutineName)) instanceof PDO) {
return $pdo;
}
/** @var PDO $connections */
$connections = $this->getFromChannel($coroutineName, $config);
$connections->query('use `' . $config['database'].'`');
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
$number > 0 && $connections->beginTransaction();
}