mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
Connection类的数据库连接参数增加sql_explain配置 用于配置是否需要分析SQL性能 默认关闭
This commit is contained in:
@@ -102,6 +102,8 @@ abstract class Connection
|
|||||||
'resultset_type' => Db::RESULTSET_ARRAY,
|
'resultset_type' => Db::RESULTSET_ARRAY,
|
||||||
// 自动写入时间戳字段
|
// 自动写入时间戳字段
|
||||||
'auto_timestamp' => false,
|
'auto_timestamp' => false,
|
||||||
|
// 是否需要进行SQL性能分析
|
||||||
|
'sql_explain' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
// PDO连接参数
|
// PDO连接参数
|
||||||
@@ -743,7 +745,7 @@ abstract class Connection
|
|||||||
$log = $this->queryStr . ' [ RunTime:' . $runtime . 's ]';
|
$log = $this->queryStr . ' [ RunTime:' . $runtime . 's ]';
|
||||||
$result = [];
|
$result = [];
|
||||||
// SQL性能分析
|
// SQL性能分析
|
||||||
if (0 === stripos(trim($this->queryStr), 'select')) {
|
if ($this->config['sql_explain'] && 0 === stripos(trim($this->queryStr), 'select')) {
|
||||||
$result = $this->getExplain($this->queryStr);
|
$result = $this->getExplain($this->queryStr);
|
||||||
}
|
}
|
||||||
// SQL监听
|
// SQL监听
|
||||||
|
|||||||
Reference in New Issue
Block a user