Using String [] selectionArgs in SQLiteDatabase.query ()

How to use String[] selectionArgs in SQLiteDatabase.query() ? I would like to just set it to null , since I cannot use it. I am just trying to load an entire unsorted table from a database into Cursor . Any suggestions on how to achieve this?

+44
android android-sqlite android-cursor
May 08 '12 at 21:44
source share
2 answers

selectionArgs replaces any question marks in the selection string.

eg:

 String[] args = { "first string", "second@string.com" }; Cursor cursor = db.query("TABLE_NAME", null, "name=? AND email=?", args, null); 

according to your question - you can use null

+181
May 08 '12 at 22:13
source share

Yes, you can set all parameters to null except the table name.

eg:

 Cursor cursor = db.query("TABLE_NAME", null, null, null, null, null, null); 
+12
May 8 '12 at
source share



All Articles