How do I use the String[] selectionArgs
in SQLiteDatabase.query()
? I wish I could just set it to null
, as I have no use for it. I am just trying to load an entire unsorted table from a database into a Cursor
. Any suggestions on how to achieve this?
selectionArgs replace any question marks in the selection string.
for example:
String[] args = { "first string", "second@string.com" };
Cursor cursor = db.query("TABLE_NAME", null, "name=? AND email=?", args, null);
as for your question - you can use null
Yes, you may set all parameters to null except the table name.
for example:
Cursor cursor = db.query("TABLE_NAME", null, null, null, null, null, null);
来源:https://stackoverflow.com/questions/10507005/using-string-selectionargs-in-sqlitedatabase-query