Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update NativeSqlDatabase.kt to change readonly flag for DELETE, INSERT, and UPDATE statements #5680

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

Merged
merged 5 commits into from
May 13, 2025

Conversation

griffio
Copy link
Contributor

@griffio griffio commented Mar 20, 2025

fixes #5672

  • Add check sql statements that allow for mutating operations that return results - useReadOnly is set to false.
    • The RETURNING clause is only available in top-level DELETE, INSERT, and UPDATE statements.
  • Add an integration test for native driver, this only runs when installed sqlite version supports RETURNING

The implementation of the read-only flag is set internally and isn't determined by transaction - currently it was assumed that Sql is either write only for mutations or read only for queries that return results

@griffio griffio force-pushed the fix-5672-native-sqlite-driver branch from df698a6 to a38aa81 Compare March 21, 2025 10:46
@griffio griffio marked this pull request as ready for review March 21, 2025 10:52
@griffio griffio force-pushed the fix-5672-native-sqlite-driver branch from a38aa81 to c89ad83 Compare March 21, 2025 12:37
griffio added 5 commits March 26, 2025 15:36
The implementation of the read-only flag must be set internally - currently it was assumed that sql is either write only or read only.

Check sql statements that allow for mutating operations that return results - useReadOnly is set to false

The RETURNING clause is only available in top-level DELETE, INSERT, and UPDATE statements
Add driver test cases
@griffio griffio force-pushed the fix-5672-native-sqlite-driver branch from 4d793e6 to 513ab3c Compare March 26, 2025 15:36
@AlecKazakova AlecKazakova merged commit 71dd6a7 into sqldelight:master May 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

NativeSqliteDriver fails to properly handle UPDATE RETURNING syntax
2 participants