Index: core/kernel/db/db_connection.php =================================================================== --- core/kernel/db/db_connection.php +++ core/kernel/db/db_connection.php @@ -506,7 +506,10 @@ */ public function Query($sql, $key_field = null, $no_debug = false) { - $this->_queryCount++; + if ( !$no_debug ) { + $this->_queryCount++; + } + $this->lastQuery = $sql; // set 1st checkpoint: begin @@ -530,11 +533,13 @@ } } + $this->Destroy(); + // set 2nd checkpoint: begin if ( $this->_captureStatistics ) { $query_time = microtime(true) - $start_time; - if ( $query_time > DBG_MAX_SQL_TIME ) { + if ( $query_time > DBG_MAX_SQL_TIME && !$no_debug ) { $this->Application->logSlowQuery($sql, $query_time); } @@ -542,8 +547,6 @@ } // set 2nd checkpoint: end - $this->Destroy(); - return $ret; } else { @@ -572,7 +575,10 @@ */ public function GetIterator($sql, $key_field = null, $no_debug = false, $iterator_class = 'kMySQLQuery') { - $this->_queryCount++; + if ( !$no_debug ) { + $this->_queryCount++; + } + $this->lastQuery = $sql; // set 1st checkpoint: begin @@ -590,7 +596,7 @@ if ( $this->_captureStatistics ) { $query_time = microtime(true) - $start_time; - if ( $query_time > DBG_MAX_SQL_TIME ) { + if ( $query_time > DBG_MAX_SQL_TIME && !$no_debug ) { $this->Application->logSlowQuery($sql, $query_time); } @@ -1058,7 +1064,7 @@ public function GetIterator($sql, $key_field = null, $no_debug = false, $iterator_class = 'kMySQLQuery') { if ( $no_debug ) { - return parent::Query($sql, $key_field, $no_debug, $iterator_class); + return parent::GetIterator($sql, $key_field, $no_debug, $iterator_class); } global $debugger;