mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
fix dbType bug
This commit is contained in:
@@ -50,7 +50,7 @@ class Framework
|
|||||||
public const VERSION_ID = 721;
|
public const VERSION_ID = 721;
|
||||||
|
|
||||||
/** @var string 版本名称 */
|
/** @var string 版本名称 */
|
||||||
public const VERSION = '3.2.0';
|
public const VERSION = '3.2.1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var RuntimePreferences 运行时偏好(环境信息&参数)
|
* @var RuntimePreferences 运行时偏好(环境信息&参数)
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ class DBConnection implements Connection
|
|||||||
public function __construct(private array $params)
|
public function __construct(private array $params)
|
||||||
{
|
{
|
||||||
$this->db_type = $params['dbType'] ?? ZM_DB_POOL;
|
$this->db_type = $params['dbType'] ?? ZM_DB_POOL;
|
||||||
if ($params['dbType'] === ZM_DB_POOL) {
|
if ($this->db_type === ZM_DB_POOL) {
|
||||||
// 默认连接池的形式,
|
// 默认连接池的形式,
|
||||||
logger()->debug('Constructing...');
|
logger()->debug('Constructing...');
|
||||||
$this->conn = DBPool::pool($params['dbName'])->get();
|
$this->conn = DBPool::pool($params['dbName'])->get();
|
||||||
$this->pool_name = $params['dbName'];
|
$this->pool_name = $params['dbName'];
|
||||||
} elseif ($params['dbType'] === ZM_DB_PORTABLE) {
|
} elseif ($this->db_type === ZM_DB_PORTABLE) {
|
||||||
$connect_str = 'sqlite:{filename}';
|
$connect_str = 'sqlite:{filename}';
|
||||||
if (FileSystem::isRelativePath($params['filename'])) {
|
if (FileSystem::isRelativePath($params['filename'])) {
|
||||||
$params['filename'] = zm_dir(config('global.data_dir') . '/db/' . $params['filename']);
|
$params['filename'] = zm_dir(config('global.data_dir') . '/db/' . $params['filename']);
|
||||||
|
|||||||
Reference in New Issue
Block a user