Permalink
Browse files

fix DebugPDOStatement for usage with execute

  • Loading branch information...
1 parent 50c2274 commit 2bb6d2ded0816f1b9bc36e03ce94de48d18d8d71 @jmglsn jmglsn committed Oct 9, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 runtime/lib/connection/DebugPDOStatement.php
@@ -61,17 +61,20 @@ protected function __construct(PropelPDO $pdo)
}
/**
+ * @param array $values Parameters which were passed to execute(), if any. Default: bound parameters.
+ *
* @return string
*/
- public function getExecutedQueryString()
+ public function getExecutedQueryString(array $values = array())
{
$sql = $this->queryString;
+ $boundValues = empty($values) ? $this->boundValues : $values;
$matches = array();
if (preg_match_all('/(:p[0-9]+\b)/', $sql, $matches)) {
$size = count($matches[1]);
for ($i = $size - 1; $i >= 0; $i--) {
$pos = $matches[1][$i];
- $sql = str_replace($pos, $this->boundValues[$pos], $sql);
+ $sql = str_replace($pos, $boundValues[$pos], $sql);
}
}
@@ -91,7 +94,7 @@ public function execute($input_parameters = null)
$debug = $this->pdo->getDebugSnapshot();
$return = parent::execute($input_parameters);
- $sql = $this->getExecutedQueryString();
+ $sql = $this->getExecutedQueryString($input_parameters?:array());
$this->pdo->log($sql, null, __METHOD__, $debug);
$this->pdo->setLastExecutedQuery($sql);
$this->pdo->incrementQueryCount();

0 comments on commit 2bb6d2d

Please sign in to comment.