diff --git a/system/modules/core/library/Contao/Database/Statement.php b/system/modules/core/library/Contao/Database/Statement.php index c307b66b31..273cee8936 100644 --- a/system/modules/core/library/Contao/Database/Statement.php +++ b/system/modules/core/library/Contao/Database/Statement.php @@ -51,6 +51,18 @@ abstract class Statement */ protected $strQuery; + /** + * Query start + * @var int + */ + protected $intQueryStart; + + /** + * Query end + * @var int + */ + protected $intQueryEnd; + /** * Autocommit indicator * @var boolean @@ -278,10 +290,12 @@ public function query($strQuery='') } // Execute the query + $this->intQueryStart = microtime(true); if (($this->resResult = $this->execute_query()) == false) { throw new \Exception(sprintf('Query error: %s (%s)', $this->error, $this->strQuery)); } + $this->intQueryEnd = microtime(true); // No result set available if (!is_resource($this->resResult) && !is_object($this->resResult)) @@ -370,6 +384,7 @@ protected function debugQuery($objResult=null) } $arrData['query'] = specialchars($this->strQuery); + $arrData['duration'] = \System::getFormattedNumber((($this->intQueryEnd - $this->intQueryStart) * 1000), 3) . ' ms'; if ($objResult === null || strncasecmp($this->strQuery, 'SELECT', 6) !== 0) {