Commit db9b0320 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-339' into 2.3

parents 7a657fa8 2c10252b
...@@ -190,6 +190,12 @@ class Statement implements \IteratorAggregate, DriverStatement ...@@ -190,6 +190,12 @@ class Statement implements \IteratorAggregate, DriverStatement
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null) public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
{ {
if ($arg2 === null) {
return $this->stmt->setFetchMode($fetchMode);
} else if ($arg3 === null) {
return $this->stmt->setFetchMode($fetchMode, $arg2);
}
return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3); return $this->stmt->setFetchMode($fetchMode, $arg2, $arg3);
} }
......
...@@ -501,6 +501,21 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -501,6 +501,21 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); $this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn());
} }
/**
* @group DBAL-339
*/
public function testSetFetchModeOnDbalStatement()
{
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->executeQuery($sql, array(1, "foo"));
$stmt->setFetchMode(\PDO::FETCH_NUM);
while ($row = $stmt->fetch()) {
$this->assertTrue(isset($row[0]));
$this->assertTrue(isset($row[1]));
}
}
private function setupFixture() private function setupFixture()
{ {
$this->_conn->executeQuery('DELETE FROM fetch_table')->execute(); $this->_conn->executeQuery('DELETE FROM fetch_table')->execute();
......
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