Commit dc0f9c8b authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-257] Fix fetchColumn() on empty result for OCI8 to return false

parent 1f188109
......@@ -255,7 +255,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
public function fetchColumn($columnIndex = 0)
{
$row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
return $row[$columnIndex];
return isset($row[$columnIndex]) ? $row[$columnIndex] : false;
}
/**
......
......@@ -491,6 +491,16 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime);
}
/**
* @group DBAL-257
*/
public function testEmptyFetchColumnReturnsFalse()
{
$this->_conn->executeQuery('DELETE FROM fetch_table')->execute();
$this->assertFalse($this->_conn->fetchColumn('SELECT test_int FROM fetch_table'));
$this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn());
}
private function setupFixture()
{
$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