Index: branches/5.2.x/core/kernel/db/db_connection.php =================================================================== diff -u -N -r16653 -r16662 --- branches/5.2.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 16653) +++ branches/5.2.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 16662) @@ -1,6 +1,6 @@ noDebuggingState; + } + if ( !is_object($this->connectionID) ) { // no connection while doing mysql_query $this->errorCode = mysqli_connect_errno(); @@ -500,13 +511,20 @@ * * @param string $sql * @param string $key_field - * @param bool $no_debug + * @param boolean|null $no_debug * @return Array * @access public */ - public function Query($sql, $key_field = null, $no_debug = false) + public function Query($sql, $key_field = null, $no_debug = null) { - $this->_queryCount++; + if ( $no_debug === null ) { + $no_debug = $this->noDebuggingState; + } + + if ( !$no_debug ) { + $this->_queryCount++; + } + $this->lastQuery = $sql; // set 1st checkpoint: begin @@ -530,20 +548,20 @@ } } + $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); } $this->_queryTime += $query_time; } // set 2nd checkpoint: end - $this->Destroy(); - return $ret; } else { @@ -565,14 +583,21 @@ * * @param string $sql * @param string $key_field - * @param bool $no_debug + * @param boolean|null $no_debug * @param string $iterator_class * @return kMySQLQuery|bool * @access public */ - public function GetIterator($sql, $key_field = null, $no_debug = false, $iterator_class = 'kMySQLQuery') + public function GetIterator($sql, $key_field = null, $no_debug = null, $iterator_class = 'kMySQLQuery') { - $this->_queryCount++; + if ( $no_debug === null ) { + $no_debug = $this->noDebuggingState; + } + + if ( !$no_debug ) { + $this->_queryCount++; + } + $this->lastQuery = $sql; // set 1st checkpoint: begin @@ -590,7 +615,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); } @@ -968,12 +993,16 @@ * * @param string $sql * @param string $key_field - * @param bool $no_debug + * @param boolean|null $no_debug * @return Array * @access public */ - public function Query($sql, $key_field = null, $no_debug = false) + public function Query($sql, $key_field = null, $no_debug = null) { + if ( $no_debug === null ) { + $no_debug = $this->noDebuggingState; + } + if ( $no_debug ) { return parent::Query($sql, $key_field, $no_debug); } @@ -1047,15 +1076,19 @@ * * @param string $sql * @param string $key_field - * @param bool $no_debug + * @param boolean|null $no_debug * @param string $iterator_class * @return kMySQLQuery|bool * @access public */ - public function GetIterator($sql, $key_field = null, $no_debug = false, $iterator_class = 'kMySQLQuery') + public function GetIterator($sql, $key_field = null, $no_debug = null, $iterator_class = 'kMySQLQuery') { + if ( $no_debug === null ) { + $no_debug = $this->noDebuggingState; + } + 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;