I want to use the SQLite clause LIMIT and OFFSET, so that I can fetch my records in pages. But, though I can find the LIMIT clause in the SQLiteQueryBuilder.query() which would effectively limit the number of record in my result. Couldn't find the OFFSET clause anywhere so that I can continue fetching from the point I left. Also, can someone explain to me the exact use of SelectionArgs[] in the query() function, with some example?
A:
Try this:
db.query(TABLENAME,
new String[] { _ID,NAME,CHILDREN },
NAME+"=? OR "+CHILDREN+" > ? ",
new String[] { "John","3"},
null,
null,
" 25 OFFSET 100"); //or 100, 25
Please note everything is string, so the where clause replacements must also be strings
Pentium10
2010-06-27 14:33:59
A:
You can just give the Limit and Offset parameters in the where clause , in this way
tmpCol.query(Tablename, columns, "WHERE Clause LIMIT xx OFFSET yy",
selectionArgs[], having, orderBy);
Codevalley
2010-06-28 05:55:25
I don't think you should put a "WHERE" in the where clause. The API does it foryou.
polyglot
2010-06-29 14:13:46