DB: fix handling failed query in debug_query method
This commit is contained in:
parent
d9451fd66a
commit
28e6397f58
1 changed files with 6 additions and 1 deletions
|
@ -85,7 +85,10 @@ class Db {
|
|||
* @return void
|
||||
*/
|
||||
public static function debug_query($q) {
|
||||
self :: $total_query_time += intval(ceil($q->getExecutionTime() * 1000000000));
|
||||
$error = $q->getMessage();
|
||||
// Execution time not available in case of execution error
|
||||
if (!$error)
|
||||
self :: $total_query_time += intval(ceil($q->getExecutionTime() * 1000000000));
|
||||
$msg = "# DB query";
|
||||
if ($q->getResult())
|
||||
$msg .= sprintf(
|
||||
|
@ -104,6 +107,8 @@ class Db {
|
|||
$msg .= "\n# Parameters: '" . vardump($parameters) . "'";
|
||||
}
|
||||
}
|
||||
if ($error)
|
||||
$msg .= "\n# ERROR: $error";
|
||||
|
||||
Log :: debug($msg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue