What does execSQL (String sql) function which belongs to SQLiteDatabase actually do? i've read android documentation for it but not getting it..Please someone explain it in easy words.

Thanks in advance.

share|improve this question

I know you've said you've read the Android documentation, but I'm going to link to it again as it's pretty well explained there. Taken from the Android documentation here

public void execSQL (String sql)

Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

It has no means to return any data (such as the number of affected rows). Instead, you're encouraged to use insert(String, String, ContentValues), update(String, ContentValues, String, String[]), et al, when possible.

In other words, it's used to execute any queries that don't return data, such as updating a database's tuples or inserting new tuples to the database.

share|improve this answer

execSQL runs a single SQL query on the SQLiteDatabase and doesn't return any data. So if you wanted to insert something, or update something and didn't expect any information in return you would use this command.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.