Commit f5dcc4cf authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2645 from deeky666/DBAL-2637

[DBAL-2637] Fix closing prepared statement cursor with LOB column on Oracle
parents 7e0a6cc4 0d31643d
......@@ -188,11 +188,7 @@ class OCI8Statement implements \IteratorAggregate, Statement
return true;
}
// emulate it by fetching and discarding rows, similarly to what PDO does in this case
// @link http://php.net/manual/en/pdostatement.closecursor.php
// @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075
// deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them
while (oci_fetch($this->_sth));
oci_cancel($this->_sth);
$this->result = false;
......
......@@ -14,6 +14,7 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table = new Table('stmt_test');
$table->addColumn('id', 'integer');
$table->addColumn('name', 'text', array('notnull' => false));
$this->_conn->getSchemaManager()->dropAndCreateTable($table);
}
......@@ -224,6 +225,19 @@ EOF
$this->assertTrue($stmt->closeCursor());
}
/**
* @group DBAL-2637
*/
public function testCloseCursorAfterCursorEnd()
{
$stmt = $this->_conn->prepare('SELECT name FROM stmt_test');
$stmt->execute();
$stmt->fetch();
$this->assertTrue($stmt->closeCursor());
}
/**
* @dataProvider emptyFetchProvider
*/
......
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