mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Making database stats dependent of fullDebug
Leaving lastNumRows commented out until some bugs are solved
This commit is contained in:
parent
10646ba2ad
commit
bcc1417e5d
2 changed files with 8 additions and 8 deletions
|
@ -299,7 +299,11 @@ class DboMysql extends DboSource {
|
|||
*/
|
||||
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 @@ class DboSource extends DataSource {
|
|||
*
|
||||
* ### 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 @@ class DboSource extends DataSource {
|
|||
* @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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue