- Модуль: biconnector
- Путь к файлу: ~/bitrix/modules/biconnector/lib/manager.php
- Класс: BitrixBIConnectorManager
- Вызов: Manager::getDatabaseConnection
public function getDatabaseConnection()
{
$pool = BitrixMainApplication::getInstance()->getConnectionPool();
$connectionName = $this->connectionName ?: $pool::DEFAULT_CONNECTION_NAME;
$conn = $pool->getConnection($connectionName);
if (!$conn)
{
$conn = $pool->getConnection();
$connectionName = $pool::DEFAULT_CONNECTION_NAME;
}
if (!is_a($conn, 'BitrixBIConnectorDBMysqliConnection'))
{
if (is_a($conn, 'BitrixMainDBMysqlCommonConnection'))
{
$pool->cloneConnection($connectionName , $connectionName . '~', [
'className' => 'BitrixBIConnectorDBMysqliConnection',
]);
$conn = $pool->getConnection($connectionName . '~');
}
else
{
throw new BitrixMainConfigConfigurationException(sprintf(
"Class '%s' for '%s' connection is not supported", get_class($conn), $this->connectionName
));
}
}
return $conn;
}