diff --git a/src/DebugBar/DataCollector/PDO/PDOCollector.php b/src/DebugBar/DataCollector/PDO/PDOCollector.php index 8739fab..ba4e4dc 100644 --- a/src/DebugBar/DataCollector/PDO/PDOCollector.php +++ b/src/DebugBar/DataCollector/PDO/PDOCollector.php @@ -15,6 +15,8 @@ class PDOCollector extends DataCollector implements Renderable protected $timeCollector; + protected $renderSqlWithParams = false; + /** * @param TraceablePDO $pdo * @param TimeDataCollector $timeCollector @@ -27,6 +29,21 @@ class PDOCollector extends DataCollector implements Renderable } } + /** + * Renders the SQL of traced statements with params embeded + * + * @param boolean $enabled + */ + public function setRenderSqlWithParams($enabled = true) + { + $this->renderSqlWithParams = $enabled; + } + + public function isSqlRenderedWithParams() + { + return $this->renderSqlWithParams; + } + /** * Adds a new PDO instance to be collector * @@ -92,7 +109,7 @@ class PDOCollector extends DataCollector implements Renderable $stmts = array(); foreach ($pdo->getExecutedStatements() as $stmt) { $stmts[] = array( - 'sql' => $stmt->getSql(), + 'sql' => $this->renderSqlWithParams ? $stmt->getSqlWithParams() : $stmt->getSql(), 'row_count' => $stmt->getRowCount(), 'stmt_id' => $stmt->getPreparedId(), 'prepared_stmt' => $stmt->getSql(),