Skip to content
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

SQLStore - use compiled sql statements, use update for merge #371

Merged
merged 1 commit into from
Mar 29, 2017

Conversation

BenSchwab
Copy link
Contributor

closes #369

@BenSchwab BenSchwab changed the title use compiled sql statements, use update for merge SQLStore - use compiled sql statements, use update for merge Mar 29, 2017
@digitalbuddha
Copy link
Contributor

I'm terrible with sql stuff. Didn't you just remove the compile statement stuff?

@BenSchwab
Copy link
Contributor Author

Haha me too -- it's pretty arcane stuff. I changed the compile statement to use the insert / update methods outlined here: https://developer.android.com/training/basics/data-storage/databases.html.

I think the advantage is that those methods will properly cleanse the arguments for sql injection attacks.

With the compile sql using a string, I think a user could construct a malicious record key that performs sql injection.

@digitalbuddha
Copy link
Contributor

Make sense thanks for explaining! I just assumed CompiledStatements == PreparedStatements.

Copy link
Contributor

@digitalbuddha digitalbuddha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remembered again why I use sqlDelight :-)

@BenSchwab
Copy link
Contributor Author

I think there is a difference between what I changed this too, and compiled statements. And compile statements have performance benefits. I'll go ahead and land this so SQLStore is functional, but I'll continue thinking about the optimal structure.

And yeah sqlDelight might be nice :)

@BenSchwab BenSchwab merged commit ec1d31f into master Mar 29, 2017
@BenSchwab BenSchwab deleted the bschwab--sql-store-merge branch March 29, 2017 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQLStore -- Records not updated
3 participants