Unverified Commit 62dacc09 authored by Sergei Morozov's avatar Sergei Morozov

Merge branch 'bpo/2.9/#3381' into 2.9

parents 125fb5e7 79e369e8
...@@ -166,7 +166,10 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -166,7 +166,10 @@ class ResultCacheStatement implements IteratorAggregate, ResultStatement
*/ */
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null) public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{ {
return $this->statement->fetchAll($fetchMode, $fetchArgument, $ctorArgs); $this->data = $this->statement->fetchAll($fetchMode, $fetchArgument, $ctorArgs);
$this->emptied = true;
return $this->data;
} }
/** /**
......
...@@ -166,6 +166,16 @@ class ResultCacheTest extends DbalFunctionalTestCase ...@@ -166,6 +166,16 @@ class ResultCacheTest extends DbalFunctionalTestCase
self::assertCount(2, $this->sqlLogger->queries); self::assertCount(2, $this->sqlLogger->queries);
} }
public function testFetchAllAndFinishSavesCache()
{
$layerCache = new ArrayCache();
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'testcachekey', $layerCache));
$stmt->fetchAll();
$stmt->closeCursor();
self::assertCount(1, $layerCache->fetch('testcachekey'));
}
public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode) public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode)
{ {
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey')); $stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
......
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