Commit 220a5b0a authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-228'

parents c37d2113 95bcdc63
...@@ -227,8 +227,14 @@ class OCI8Statement implements \IteratorAggregate, Statement ...@@ -227,8 +227,14 @@ class OCI8Statement implements \IteratorAggregate, Statement
} }
$result = array(); $result = array();
oci_fetch_all($this->_sth, $result, 0, -1, if (self::$fetchStyleMap[$fetchStyle] === OCI_BOTH) {
self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_FETCHSTATEMENT_BY_ROW | OCI_RETURN_LOBS); while ($row = $this->fetch($fetchStyle)) {
$result[] = $row;
}
} else {
oci_fetch_all($this->_sth, $result, 0, -1,
self::$fetchStyleMap[$fetchStyle] | OCI_RETURN_NULLS | OCI_FETCHSTATEMENT_BY_ROW | OCI_RETURN_LOBS);
}
return $result; return $result;
} }
......
...@@ -83,6 +83,27 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase ...@@ -83,6 +83,27 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]); $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]);
} }
/**
* @group DBAL-228
*/
public function testPrepareWithFetchAllBoth()
{
$paramInt = 1;
$paramStr = 'foo';
$sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?";
$stmt = $this->_conn->prepare($sql);
$this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt);
$stmt->bindParam(1, $paramInt);
$stmt->bindParam(2, $paramStr);
$stmt->execute();
$rows = $stmt->fetchAll(\PDO::FETCH_BOTH);
$rows[0] = array_change_key_case($rows[0], \CASE_LOWER);
$this->assertEquals(array('test_int' => 1, 'test_string' => 'foo', 0 => 1, 1 => 'foo'), $rows[0]);
}
public function testPrepareWithFetchColumn() public function testPrepareWithFetchColumn()
{ {
$paramInt = 1; $paramInt = 1;
......
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