改名
This commit is contained in:
@@ -113,10 +113,14 @@ class Connection extends Component
|
||||
if (($pdo = Context::getContext($coroutineName)) instanceof PDO) {
|
||||
return $pdo;
|
||||
}
|
||||
/** @var PDO $connections */
|
||||
$connections = $this->getPool()->getFromChannel($coroutineName);
|
||||
if (empty($connections)) {
|
||||
if (Coroutine::getCid() === -1) {
|
||||
$connections = $this->createClient($coroutineName, $config);
|
||||
} else {
|
||||
/** @var PDO $connections */
|
||||
$connections = $this->getPool()->getFromChannel($coroutineName);
|
||||
if (empty($connections)) {
|
||||
$connections = $this->createClient($coroutineName, $config);
|
||||
}
|
||||
}
|
||||
if ($number = Context::getContext('begin_' . $coroutineName, Coroutine::getCid())) {
|
||||
$number > 0 && $connections->beginTransaction();
|
||||
@@ -125,6 +129,18 @@ class Connection extends Component
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $isMaster
|
||||
* @param $max
|
||||
* @throws Exception
|
||||
*/
|
||||
public function initConnections($name, $isMaster, $max)
|
||||
{
|
||||
$this->getPool()->initConnections($name, $isMaster, $max);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $config
|
||||
|
||||
Reference in New Issue
Block a user