-
Notifications
You must be signed in to change notification settings - Fork 53
Improve compatibility with legacy SQLite versions #302
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
Open
JanJakes
wants to merge
15
commits into
develop
Choose a base branch
from
on-conflict-clause-legacy-fix
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
ae3a212 to
a713a67
Compare
53d0133 to
3932f95
Compare
040e014 to
a2398a3
Compare
36a0880 to
2576a15
Compare
ON CONFLICT clause) on SQLite < 3.35.0570a5a0 to
815aa76
Compare
815aa76 to
3bb586b
Compare
…h SQLite < 3.33.0
…upport on old SQLite versions
3bb586b to
7e14b6e
Compare
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.
SQLite Version Compatibility Fixes
This PR adds support for older SQLite versions by addressing various compatibility issues. It also updates the CI workflow to test against multiple SQLite versions.
Compatibility fixes:
UPSERT / ON CONFLICT clause (SQLite < 3.35.0) — The generic
ON CONFLICT DO UPDATEclause without an explicit column list is only supported from SQLite 3.35.0. For older versions, we now catch the constraint violation error, parse the conflicting column names from the error message, and re-execute with an explicit column list.STRICT tables (SQLite < 3.37.0) — The
STRICTkeyword for table creation is only supported from SQLite 3.37.0. It is now conditionally omitted on older versions.VALUES list
columnNnaming (SQLite < 3.33.0) — Automatic column naming for VALUES lists (column1,column2, etc.) is only supported from SQLite 3.33.0. For older versions, we now emulate this by prepending a dummySELECT NULL AS column1, ... WHERE FALSE UNION ALL ...header.UPDATE ... FROMsyntax (SQLite < 3.33.0) — TheUPDATE ... FROMsyntax is only supported from SQLite 3.33.0. We now avoid using it internally in the information schema builder.IIF()function (all versions) — TheIIF()function was added in SQLite 3.32.0. We now useCASE WHEN ... THEN ... ELSE ... ENDinstead for broader compatibility.SUBSTRING()function (all versions) — TheSUBSTRING()function is not supported in older SQLite versions. We now translate it toSUBSTR().sqlite_schematable (SQLite < 3.33.0) — Thesqlite_schematable alias was added in SQLite 3.33.0. We now use the oldersqlite_mastername for compatibility.SQLite version detection — Changed from using a
SELECT SQLITE_VERSION()query to using thePDO::ATTR_SERVER_VERSIONattribute for retrieving the SQLite version, which avoids extra queries by using SQLite C API directly.CI workflow — Added support for testing against multiple SQLite versions.