Repository navigation
Double a quote character inside an identifier instead of replacing it - #43
Open
simon-mundy wants to merge 1 commit into
Open
simon-mundy wants to merge 1 commit into
simon-mundy wants to merge 1 commit into
Conversation
AdapterPlatform set $quoteIdentifierTo to a single quote, so
quoteIdentifier('my"col') rendered "my'col" and named a different
column. SQLite escapes an embedded identifier quote by doubling it, so
the value is now '""' and the same name renders "my""col".
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
AdapterPlatformset$quoteIdentifierToto a single quote, so an embedded"was rewritten instead of escaped:Fix
SQLite escapes a quote inside a delimited identifier by doubling it, so the value is now
'""':The core default has the same fix in php-db/phpdb#250. This package sets the value itself, so it doesn't depend on that PR.
Tests
A new data-provider test in
AdapterPlatformTestcovers a quote inside a name, a lone quote, adjacent quotes, and a single quote left alone. It fails without the fix.mago format --checkandmago lintare clean.mago analyzereports 8 errors insrc/Pdo/Driver.php,src/Pdo/Feature/SqliteRowCounter.phpandsrc/Metadata/Source.php. The same errors appear on unchanged0.3.x, and this PR doesn't touch those files.