SQLiteQueryBuilder
has method:
public Cursor query (SQLiteDatabase db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String sortOrder)
also SQLiteDataBase
has method:
public public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)
Is there any reason to use SQLiteQueryBuilder.query
method instead of SQLiteDataBase.query
and which advantages does it gives?
The SQLiteQueryBuilder
helps to construct queries that are more complex than those supported by the SQLiteDatabase
functions (for example, subqueries).
If your particular query does not need any of those complex features, you do not need to use SQLiteQueryBuilder
.
(But it might make sense if your code happens to be organized so that it's easier if all queries use SQLiteQueryBuilder
.)