I am currently studying SQLite and I have found that it uses various classes like ContentValues for insertion and updation… I was wondering whether I have to follow the given way or can I write a normal SQL query and use db.execSQL() method to execute them?
Will it bring any inconsistency to my database because with these all “extra” steps doesnt it stop the flow of the query and I feel it would be faster if we use a query directly.
I am currently studying SQLite and I have found that it uses various classes
Share
You can do any SQL command you want with
db.execSQLexceptselectcommand or any other SQL command that return data (you usedb.rawQuery()for this). The classes used are helper classes that make it easy for you to manipulate DBs (try inserting 100 rows with 20 columns each usingContentValuesanddb.execSQLand you will get the point). For small tables it will not differ much (and you will not cause inconsistecies), however, for large tables with inputs that depend on user interface or use calculations, it might be useful to have a class like ContentValues with its helper methods.