Skip to content
Permalink
Browse files

Making database stats dependent of fullDebug

Leaving lastNumRows commented out until some bugs are solved
  • Loading branch information...
lorenzo committed Oct 17, 2010
1 parent 10646ba commit bcc1417e5dbcdd9f371ed280c4b983c892e10e10
Showing with 8 additions and 8 deletions.
  1. +5 −1 cake/libs/model/datasources/dbo/dbo_mysql.php
  2. +3 −7 cake/libs/model/datasources/dbo_source.php
@@ -299,7 +299,11 @@ function lastAffected() {
*/
function lastNumRows() {
if ($this->hasResult()) {
return mysql_num_rows($this->_result);
$i = 0;
foreach ($this->_result as $row) {
$i++;
}
return $i;
}
return null;
}
@@ -230,8 +230,6 @@ public function rawQuery($sql, $params = array()) {
*
* ### Options
*
* - stats - Collect meta data stats for this query. Stats include time take, rows affected,
* any errors, and number of rows returned. Defaults to `true`.
* - log - Whether or not the query should be logged to the memory log.
*
* @param string $sql
@@ -240,19 +238,17 @@ public function rawQuery($sql, $params = array()) {
* @return mixed Resource or object representing the result set, or false on failure
*/
public function execute($sql, $options = array(), $params = array()) {
$defaults = array('stats' => true, 'log' => $this->fullDebug);
$defaults = array('log' => $this->fullDebug);
$options = array_merge($defaults, $options);
$this->error = null;
$t = microtime(true);
$this->_result = $this->_execute($sql, $params);
if ($options['stats']) {
if ($options['log']) {
$this->took = round((microtime(true) - $t) * 1000, 0);
$this->affected = $this->lastAffected();
//$this->numRows = $this->lastNumRows();
}
if ($options['log']) {
$this->logQuery($sql);
}

0 comments on commit bcc1417

Please sign in to comment.
You can’t perform that action at this time.