-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing the position of the emptied variable #3997
Changes from all commits
4f51944
a711cce
4e54fce
90121e3
6ebd9a1
c7ba8bb
03937e3
8f70206
038b00d
039d351
70ecd18
40a452b
3cc7fe2
0ca34b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -165,7 +165,7 @@ public function testDontFinishNoCache() : void | |||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
$this->hydrateStmt($stmt, FetchMode::NUMERIC); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
self::assertCount(2, $this->sqlLogger->queries); | ||||||||||||||||||||||||||||||||||
self::assertCount(1, $this->sqlLogger->queries); | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, isn't this test supposed to have 2 queries executed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really, a second query he took from the cache There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test was incorrect because, just will save the query in $this->sqlLogger->queries when the query are execute in the database. dbal/lib/Doctrine/DBAL/Connection.php Lines 894 to 897 in 4c03ed8
When the query are in the cache, they return before dbal/lib/Doctrine/DBAL/Connection.php Lines 886 to 897 in 4c03ed8
The reason are the cache doesn't work before, when we use fetch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, which is why I approved if at first, but if there's another reason why @beberlei expected 2 in the past, I want to know and would like to be on the save side. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was recently changed in #4048. It's an improvement, not a bugfix, so this change shouldn't be made in |
||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
public function testFetchAllAndFinishSavesCache() : void | ||||||||||||||||||||||||||||||||||
|
@@ -194,6 +194,24 @@ public function testFetchAllColumn() : void | |||||||||||||||||||||||||||||||||
self::assertEquals([1], $stmt->fetchAll(FetchMode::COLUMN)); | ||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
public function testGetIterator() : void | ||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||
$query = $this->connection->getDatabasePlatform() | ||||||||||||||||||||||||||||||||||
->getDummySelectSQL('1'); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
$qcp = new QueryCacheProfile(0, 0, new ArrayCache()); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
$stmt = $this->connection->executeCacheQuery($query, [], [], $qcp); | ||||||||||||||||||||||||||||||||||
$stmt->getIterator(); | ||||||||||||||||||||||||||||||||||
$stmt->closeCursor(); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
$stmt = $this->connection->executeCacheQuery($query, [], [], $qcp); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
$iterator = $stmt->getIterator(); | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
self::assertCount(1, $iterator); | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a valid behavior to expect. The fact that the iterator internally calls |
||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||
* @param array<int, array<int, int|string>> $expectedResult | ||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert. The type hint should refer to an interface, not to a specific implementation.