mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Log query time in database_log
This commit is contained in:
parent
71b4f4a64a
commit
e7fa5eb38a
@ -76,13 +76,19 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
|
|||||||
|
|
||||||
public function query($query)
|
public function query($query)
|
||||||
{
|
{
|
||||||
|
$this->queries++;
|
||||||
|
|
||||||
if($this->logged) {
|
if($this->logged) {
|
||||||
$this->log .= $query . PHP_EOL;
|
$startTime = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->queries++;
|
$ret = parent::query($query);
|
||||||
//echo $query . PHP_EOL;
|
if($this->logged) {
|
||||||
return parent::query($query);
|
$totalTime = microtime(true) - $startTime;
|
||||||
|
$this->log .= round($totalTime, 4) . ' ms - ' . $query . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function select($table, $data)
|
public function select($table, $data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user