变更
This commit is contained in:
@@ -94,16 +94,15 @@ class Connection extends Component
|
|||||||
* @return PDO|null
|
* @return PDO|null
|
||||||
* @throws Kiri\Exception\ConfigException
|
* @throws Kiri\Exception\ConfigException
|
||||||
*/
|
*/
|
||||||
public function get(mixed $config, bool $isMaster = false): ?\PDO
|
public function get(mixed $config): ?\PDO
|
||||||
{
|
{
|
||||||
$name = $config['cds'] . ($isMaster ? 'master' : 'slave');
|
if (!$this->pool->hasChannel($config['cds'])) {
|
||||||
if (!$this->pool->hasChannel($name)) {
|
$this->pool->initConnections($config['cds'], $config['pool']['max']);
|
||||||
$this->pool->initConnections($name, $config['pool']['max']);
|
|
||||||
}
|
}
|
||||||
if (!Context::hasContext($name)) {
|
if (!Context::hasContext($config['cds'])) {
|
||||||
return Context::setContext($name, $this->pool->get($name, $this->generate($config)));
|
return Context::setContext($config['cds'], $this->pool->get($config['cds'], $this->generate($config)));
|
||||||
} else {
|
} else {
|
||||||
return Context::getContext($name);
|
return Context::getContext($config['cds']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user