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,6 +85,9 @@ class Db {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function debug_query($q) {
|
public static function debug_query($q) {
|
||||||
|
$error = $q->getMessage();
|
||||||
|
// Execution time not available in case of execution error
|
||||||
|
if (!$error)
|
||||||
self :: $total_query_time += intval(ceil($q->getExecutionTime() * 1000000000));
|
self :: $total_query_time += intval(ceil($q->getExecutionTime() * 1000000000));
|
||||||
$msg = "# DB query";
|
$msg = "# DB query";
|
||||||
if ($q->getResult())
|
if ($q->getResult())
|
||||||
|
@ -104,6 +107,8 @@ class Db {
|
||||||
$msg .= "\n# Parameters: '" . vardump($parameters) . "'";
|
$msg .= "\n# Parameters: '" . vardump($parameters) . "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($error)
|
||||||
|
$msg .= "\n# ERROR: $error";
|
||||||
|
|
||||||
Log :: debug($msg);
|
Log :: debug($msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue