From aa2e844b73d40d02c0d4800ac58a0646b3918e7a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 6 Jun 2016 18:48:09 +0800 Subject: [PATCH] =?UTF-8?q?Connection=E7=B1=BB=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=9E=E6=8E=A5=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?sql=5Fexplain=E9=85=8D=E7=BD=AE=20=E7=94=A8=E4=BA=8E=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=98=AF=E5=90=A6=E9=9C=80=E8=A6=81=E5=88=86=E6=9E=90?= =?UTF-8?q?SQL=E6=80=A7=E8=83=BD=20=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Connection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 31f3e1f0..b913c0df 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -102,6 +102,8 @@ abstract class Connection 'resultset_type' => Db::RESULTSET_ARRAY, // 自动写入时间戳字段 'auto_timestamp' => false, + // 是否需要进行SQL性能分析 + 'sql_explain' => false, ]; // PDO连接参数 @@ -743,7 +745,7 @@ abstract class Connection $log = $this->queryStr . ' [ RunTime:' . $runtime . 's ]'; $result = []; // SQL性能分析 - if (0 === stripos(trim($this->queryStr), 'select')) { + if ($this->config['sql_explain'] && 0 === stripos(trim($this->queryStr), 'select')) { $result = $this->getExplain($this->queryStr); } // SQL监听