Commit cd97dd8b authored by Christopher Davis's avatar Christopher Davis Committed by Steve Müller

Track the Values & Types Passed to Statement::bindParam

So they get passed to the SQLLogger on `Statement::execute`.
parent b896ddd6
......@@ -138,6 +138,8 @@ class Statement implements \IteratorAggregate, DriverStatement
*/
public function bindParam($name, &$var, $type = PDO::PARAM_STR, $length = null)
{
$this->params[$name] = $var;
$this->types[$name] = $type;
return $this->stmt->bindParam($name, $var, $type, $length);
}
......
......@@ -99,6 +99,28 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement->execute($values);
}
public function testExecuteCallsStartQueryWithTheParametersBoundViaBindParam()
{
$name = 'foo';
$var = 'bar';
$values = array($name => $var);
$types = array($name => \PDO::PARAM_STR);
$sql = '';
$logger = $this->createMock('\Doctrine\DBAL\Logging\SQLLogger');
$logger->expects($this->once())
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo($values), $this->equalTo($types));
$this->configuration->expects($this->once())
->method('getSQLLogger')
->will($this->returnValue($logger));
$statement = new Statement($sql, $this->conn);
$statement->bindParam($name, $var);
$statement->execute();
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment