Created
July 9, 2011 13:25
-
-
Save jyokyoku/1073579 to your computer and use it in GitHub Desktop.
CakePHP DboMysqlLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::import('Datasource', 'DboSource'); | |
App::import('Datasource', 'DboMysql'); | |
class DboMysqlLog extends DboMysql | |
{ | |
function execute($sql, $options = array()) { | |
$defaults = array('log' => ($this->fullDebug || Configure::read('Sql.log'))); | |
$options = array_merge($defaults, $options); | |
return parent::execute($sql, $options); | |
} | |
function logQuery($sql) { | |
$return = parent::logQuery($sql); | |
if (Configure::read('Sql.log')) { | |
$this->log($sql, 'sql'); | |
} | |
return $return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment