The SQLiteDataBase.insert(String, String, ContentValues) convenience method takes a ContentValues object which contains all of the column values of a row to be inserted into the database. If I use the ContentValues.put() methods to build a ContentValues object to insert into the database, does either put() or insert() sanitize the input or do I have to do that myself?
-
1Sorry about the bung hyperlinking but it always works in the preview and never in the real post for me...Sam Svenbjorgchristiensensen– Sam Svenbjorgchristiensensen2010-11-13 02:44:04 +00:00Commented Nov 13, 2010 at 2:44
Add a comment
|
2 Answers
Yes, this will protect you from injection. You can see in the source that insertWithOnConflict (which is called by insert) correctly uses ? place-holders in a SQLiteStatement.
1 Comment
Michael
That link appears to be broken, the page says "Unknown identifier: "android/database/sqlite/SQLiteDatabase.java". Falling back to search"