Refactor(DB): Replace rawQuery with query builder and use try-with-re…#2745
Open
vijay2909 wants to merge 1 commit intoCatimaLoyalty:mainfrom
Open
Refactor(DB): Replace rawQuery with query builder and use try-with-re…#2745vijay2909 wants to merge 1 commit intoCatimaLoyalty:mainfrom
vijay2909 wants to merge 1 commit intoCatimaLoyalty:mainfrom
Conversation
Member
|
Looks pretty good on first look, will have to look a bit more deeply as this is of course very important code to be bug-free. We have several open MRs (also one from you) touching the database class right now though. Like #2716 and #2731. I am thinking the following review/merge order would be best:
Would you agree with that order of review/merge? It does mean you'd either have to rebase #2731 twice or wait for #2716 to be done before you can rebase that one, I hope that's okay. |
Author
|
Thanks for the thoughtful review and for planning out the merge strategy! The proposed order sounds perfect. I'll keep an eye on the other PRs and get #2731 rebased once they're merged. No problem at all. Let me know if anything else is needed on this one. |
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.
Fixes: #99
All instances of
database.rawQuery()that involved dynamic arguments have been converted to use the structureddatabase.query()builder.This change eliminates manual SQL string concatenation, which is a common source of bugs and security vulnerabilities. By using parameterized queries (? placeholders), we now fully protect against SQL injection.
Some Cursor objects are now initialized within try-with-resources blocks. This guarantees that every cursor is automatically and correctly closed, even if an exception is thrown during processing. This prevents Cursor leaks, which can lead to app instability and crashes.