. */ namespace Doctrine\DBAL\Logging; /** * Includes executed SQLs in a Debug Stack * * * @link www.doctrine-project.org * @since 2.0 * @version $Revision$ * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage * @author Roman Borschel */ class DebugStack implements SQLLogger { /** @var array $queries Executed SQL queries. */ public $queries = array(); /** @var boolean $enabled If Debug Stack is enabled (log queries) or not. */ public $enabled = true; public $start = null; public $currentQuery = 0; /** * {@inheritdoc} */ public function startQuery($sql, array $params = null, array $types = null) { if ($this->enabled) { $this->start = microtime(true); $this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0); } } /** * {@inheritdoc} */ public function stopQuery() { if ($this->enabled) { $this->queries[$this->currentQuery]['executionMS'] = microtime(true) - $this->start; } } }