Log Queries when we add a log query flag

This commit is contained in:
Brice Maron 2013-03-30 17:40:46 +01:00
parent 5e74ec26a8
commit 2b8cf4959a
2 changed files with 10 additions and 1 deletions

View File

@ -159,6 +159,9 @@ class OC_Config{
if (defined('DEBUG') && DEBUG) {
$content .= "define('DEBUG',true);\n";
}
if (defined('LOG_QUERIES') && LOG_QUERIES) {
$content .= "define('LOG_QUERIES',true);\n";
}
$content .= "\$CONFIG = ";
$content .= var_export(self::$cache, true);
$content .= ";\n";

View File

@ -367,7 +367,9 @@ class OC_DB {
// Optimize the query
$query = self::processQuery( $query );
if(defined('LOG_QUERIES') && LOG_QUERIES === true) {
OC_Log::write('core', 'DB prepare : '.$query, OC_Log::DEBUG);
}
self::connect();
// return the result
if(self::$backend==self::BACKEND_MDB2) {
@ -952,6 +954,10 @@ class PDOStatementWrapper{
* make execute return the result instead of a bool
*/
public function execute($input=array()) {
if(defined('LOG_QUERIES') && LOG_QUERIES === true) {
$params_str = str_replace("\n"," ",var_export($input,true));
OC_Log::write('core', 'DB execute with arguments : '.$params_str, OC_Log::DEBUG);
}
$this->lastArguments = $input;
if (count($input) > 0) {