Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String[] whereArgs parameter of database method in android

Tags:

android

delete(String table, String whereClause, String[] whereArgs)

update(String table, ContentValues values, String whereClause, String[] whereArgs)

What is this String[] whereArgs? Is it connected with "?" (so called wild card)?

like image 244
outcast Avatar asked Dec 30 '10 05:12

outcast


1 Answers

Yes, the String[] whereArgs contains the arguments to be appended to the whereClause.

For example, you want to make a delete query:

delete from InfoTable where name = "ABC" and id = "23"

then the query should be:

delete("InfoTable", "name = ? AND id = ?" , new String[] {"ABC", "23"});
like image 106
pankajagarwal Avatar answered Oct 07 '22 17:10

pankajagarwal