mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 05:18:32 +01:00
added option to render sql with params in PdoCollector (fixed #38)
This commit is contained in:
parent
3e2a0245e9
commit
f5cb5a1fcf
@ -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(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user