Commit cd527bbc authored by Marco Pivetta's avatar Marco Pivetta

Merge branch 'fix/#2637-#2645-fix-closing-prepared-statement-cursor-on-LOB-in-oracledb' into 2.5

Backport #2637 to 2.5.x
Backport #2645 to 2.5.x
parents c13ee0cc 36a0e656
......@@ -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