- Make debug handler to be a method of rcube_mdb2

release-0.6
alecpl 14 years ago
parent 8254d9c7cb
commit f5a55bf173

@ -84,7 +84,7 @@ class rcube_mdb2
'persistent' => $this->db_pconn, 'persistent' => $this->db_pconn,
'emulate_prepared' => $this->debug_mode, 'emulate_prepared' => $this->debug_mode,
'debug' => $this->debug_mode, 'debug' => $this->debug_mode,
'debug_handler' => 'mdb2_debug_handler', 'debug_handler' => array($this, 'debug_handler'),
'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL); 'portability' => MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_EMPTY_TO_NULL);
if ($this->db_provider == 'pgsql') { if ($this->db_provider == 'pgsql') {
@ -787,16 +787,17 @@ class rcube_mdb2
'md5', 'rcube_sqlite_md5'); 'md5', 'rcube_sqlite_md5');
} }
} // end class rcube_db
/* this is our own debug handler for the MDB2 connection */ /**
function mdb2_debug_handler(&$db, $scope, $message, $context = array()) * Debug handler for the MDB2
{ */
if ($scope != 'prepare') { function debug_handler(&$db, $scope, $message, $context = array())
$debug_output = sprintf('%s(%d): %s;', {
$scope, $db->db_index, rtrim($message, ';')); if ($scope != 'prepare') {
write_log('sql', $debug_output); $debug_output = sprintf('%s(%d): %s;',
$scope, $db->db_index, rtrim($message, ';'));
write_log('sql', $debug_output);
}
} }
}
} // end class rcube_db

Loading…
Cancel
Save