Skip to content

Commit

Permalink
Do not call closeCursor() in prepared statements on TYPO3 8.7 (#955)
Browse files Browse the repository at this point in the history
Calling `closeCursor()` in prepared statements on TYPO3 8.7 leads to always the first
result being returned. In TYPO3 >= 9.5 the calls to closeCursor are correct.
  • Loading branch information
sgrossberndt committed Sep 1, 2020
1 parent db047a4 commit fced62c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Documentation/ApiOverview/Database/Statement/Index.rst
Expand Up @@ -123,11 +123,9 @@ and executes it twice with different arguments:
->getSQL();
$statement = $connection->executeQuery($sqlStatement, [ 24 ]);
$result1 = $statement->fetch();
$statement->closeCursor(); // free the resources for this result
$statement->bindValue(1, 25);
$statement->execute();
$result2 = $statement->fetch();
$statement->closeCursor(); // free the resources for this result
Looking at a mysql debug log:
Expand All @@ -140,3 +138,10 @@ Looking at a mysql debug log:
The log shows one statement preparation with two executions.

.. note::

In TYPO3 v8.7 calling :php:`$statement->closeCursor();` in order to free the resources
for a result will lead to unexpected results due to a bug
in `doctrine/dbal#2546 <https://github.com/doctrine/dbal/pull/2546>`__. In TYPO3 >= v9.5
calling :php:`$statement->closeCursor();` after :php:`$statement->fetch();` is recommended.

0 comments on commit fced62c

Please sign in to comment.