Fixed query result caching when FetchMode::COLUMN is used#3686
Merged
Ocramius merged 1 commit intodoctrine:masterfrom Oct 8, 2019
Merged
Fixed query result caching when FetchMode::COLUMN is used#3686Ocramius merged 1 commit intodoctrine:masterfrom
Ocramius merged 1 commit intodoctrine:masterfrom
Conversation
Internally, ArrayStatement expects every row to be represented as an array regardless of the fetch mode, however FetchMode::COLUMN produces one value per row.
Ocramius
approved these changes
Oct 8, 2019
morozov
added a commit
that referenced
this pull request
Oct 8, 2019
rgrellmann
pushed a commit
to Rossmann-IT/dbal
that referenced
this pull request
Apr 22, 2020
Release v2.9.3 [](https://travis-ci.org/doctrine/dbal) This release fixes regressions introduced in previous releases and other bugs. - Total issues resolved: **5** - Total pull requests resolved: **14** - Total contributors: **9** **Regressions** - [3686: Fixed query result caching when `FetchMode::COLUMN` is used](doctrine#3686) thanks to @morozov and @Junker - [3456: Compare type class when comparing columns.](doctrine#3456) thanks to @garret-gunter and @cs278 **Other bugs** - [3679: fix begin trasaction after reconnect](doctrine#3679) thanks to @kalinin-k-a - [3547: Default column expressions do not work on SQL Server](doctrine#3547) thanks to @morozov - [3420: Index length can be a `string`: ensure that it is an integer when read by the `MySqlSchemaManager`](doctrine#3420) thanks to @leofeyer **CI improvements and maintenance** - [3702: Updated SQL Server extensions to fix build failures on PHP 7.4](doctrine#3702) thanks to @morozov - [3662: Marked connection exception test incomplete on MySQL 8](doctrine#3662) thanks to @morozov - [3622: Switched from ibmcom/db2express-c to ibmcom/db2](doctrine#3622) thanks to @morozov - [3465: Replaced MySQL 5.7 installed from a PPA with an official Docker image](doctrine#3465) thanks to @morozov - [3454: CI: Test against PHP 7.4snapshot instead of nightly (8.0)](doctrine#3454) thanks to @Majkl578 - [3452: Fixed AppVeyor build configuration and the issue on SQL Server](doctrine#3452) thanks to @morozov and @Majkl578 - [3447: Replaced custom docker image for PostgreSQL with the official one](doctrine#3447) thanks to @morozov - [3407: CI: Test against MySQL 8.0 on Travis](doctrine#3407) thanks to @morozov **PHP 7.4 support** - [3642: Fixed test failures on PHP 7.4](doctrine#3642) thanks to @morozov # gpg: Signature made Sat Nov 2 23:20:42 2019 # gpg: using RSA key 374EADAF543AE995 # gpg: Can't check signature: public key not found
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Internally,
ArrayStatementexpects every row to be represented as an array regardless of the fetch mode, howeverFetchMode::COLUMNproduces one value per row.This issue reveals a more fundamental problem: the cached result set is formed from the data represented to the currently used fetch mode and may not contain all the data needed for fetching from the same statement in a different mode. It means that the behavior of the cache may be unpredictable when the original and subsequent fetch modes are different. For example:
SELECT foo, bar FROM table;$stmt->fetchAll(FetchMode::COLUMN);$stmt->fetchAll(FetchMode::ASSOC). The second query will contain only one column from the cache.SELECT t1.id, t2.id FROM t1 JOIN t2;$stmt->fetchAll(FetchMode::ASSOCIATIVE);$stmt->fetchAll(FetchMode::NUMERIC). The second query will contain only one column from the cache.