Commit 36a0e656 authored by Steve Müller's avatar Steve Müller Committed by Marco Pivetta

fixes #2637: fix closing prepared statement cursor with LOB column on Oracle

parent c13ee0cc
......@@ -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;
......
......@@ -15,6 +15,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);
}
......@@ -225,6 +226,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