Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #770 from jmglsn/master

DebugPDOStatement on execute()
  • Loading branch information...
commit 4dde6dafe88703ae95f6e8d0a212a3f01bb8dcd7 2 parents 7a708f7 + 2bb6d2d
@willdurand willdurand authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 runtime/lib/connection/DebugPDOStatement.php
View
9 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();
Please sign in to comment.
Something went wrong with that request. Please try again.