From 91118649782263abb1af785936ad8b871565cb98 Mon Sep 17 00:00:00 2001 From: tianya Date: Thu, 17 Sep 2020 14:33:18 +0800 Subject: [PATCH] =?UTF-8?q?DEBUG=5FLEVEL=3D=3D=3DTRUE=E6=89=93=E5=8D=B0SQL?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4=E5=92=8C=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/dedesql.class.php | 4 ++-- src/include/dedesqli.class.php | 19 +++++++++++++++++-- src/include/helpers/channelunit.helper.php | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/include/dedesql.class.php b/src/include/dedesql.class.php index 89b4caa8..ea35d86e 100755 --- a/src/include/dedesql.class.php +++ b/src/include/dedesql.class.php @@ -86,7 +86,7 @@ class DedeSql } function SelectDB($dbname) { - mysql_select_db($dbname); + mysql_select_db($dbname, $this->linkID); } //设置SQL里的参数 @@ -134,7 +134,7 @@ class DedeSql exit(); } $this->isInit = TRUE; - @mysql_select_db($this->dbName); + @mysql_select_db($this->dbName, $this->linkID); $mysqlver = explode('.',$this->GetVersion()); $mysqlver = $mysqlver[0].'.'.$mysqlver[1]; diff --git a/src/include/dedesqli.class.php b/src/include/dedesqli.class.php index 57888446..4392c635 100755 --- a/src/include/dedesqli.class.php +++ b/src/include/dedesqli.class.php @@ -240,8 +240,12 @@ class DedeSqli if($this->recordLog) { $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); - //echo $this->queryString."--{$queryTime}
\r\n"; } + if (DEBUG_LEVEL===TRUE) { + $queryTime = ExecTime() - $t1; + echo "
执行SQL:".$this->queryString.",执行时间:{$queryTime}
\r\n"; + } + return $rs; } @@ -280,6 +284,10 @@ class DedeSqli $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
\r\n"; } + if (DEBUG_LEVEL===TRUE) { + $queryTime = ExecTime() - $t1; + echo "
执行SQL:".$this->queryString.",执行时间:{$queryTime}
\r\n"; + } return mysqli_affected_rows($this->linkID); } @@ -333,6 +341,10 @@ class DedeSqli $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
\r\n"; } + if (DEBUG_LEVEL===TRUE) { + $queryTime = ExecTime() - $t1; + echo "
执行SQL:".$this->queryString.",执行时间:{$queryTime}
\r\n"; + } if($this->result[$id]===FALSE) { @@ -349,15 +361,18 @@ class DedeSqli function GetOne($sql='',$acctype=MYSQLI_ASSOC) { global $dsqli; + // $t1 = ExecTime(); if(!$dsqli->isInit) { $this->Init($this->pconnect); - } + } + // echo ExecTime() - $t1; if($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } + if(!empty($sql)) { if(!preg_match("/LIMIT/i",$sql)) $this->SetQuery(preg_replace("/[,;]$/i", '', trim($sql))." LIMIT 0,1;"); diff --git a/src/include/helpers/channelunit.helper.php b/src/include/helpers/channelunit.helper.php index 6449c8c1..0c08a887 100755 --- a/src/include/helpers/channelunit.helper.php +++ b/src/include/helpers/channelunit.helper.php @@ -5,6 +5,7 @@ * @version $Id: channelunit.helper.php 1 16:49 2010年7月6日Z tianya $ * @package DedeCMS.Helpers * @copyright Copyright (c) 2007 - 2020, DesDev, Inc. + * @copyright Copyright (c) 2020, DedeBIZ.COM * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ @@ -558,7 +559,7 @@ function MakeOneTag(&$dtp, &$refObj, $parfield='Y') $dtp->Assign($tagid,$funcname($ctag,$refObj)); if (DEBUG_LEVEL==TRUE) { $queryTime = ExecTime() - $ttt1; - echo '标签:'.$tagname.'载入花费时间:'.$queryTime."
\r\n"; + echo '\r\n"; } } }