trim leading whitespace when logging queries

This commit is contained in:
Shish 2019-07-07 19:22:44 +01:00
parent 1bd7e1a547
commit eb885c443c

View file

@ -192,6 +192,7 @@ class Database
{ {
global $_tracer; global $_tracer;
$dur = microtime(true) - $start; $dur = microtime(true) - $start;
$query = trim(preg_replace('/^[\t ]+/m', '', $query)); // trim leading whitespace
$_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", ["query"=>$query, "args"=>$args, "method"=>$method]); $_tracer->complete($start * 1000000, $dur * 1000000, "DB Query", ["query"=>$query, "args"=>$args, "method"=>$method]);
$this->query_count++; $this->query_count++;
$this->dbtime += $dur; $this->dbtime += $dur;