What is the preference for SQLiteQueryBuilder?

SQLiteQueryBuilder

has a method:

 public Cursor query (SQLiteDatabase db, String[] projectionIn, String selection, String[] selectionArgs, String groupBy, String having, String sortOrder)

      

also SQLiteDataBase

has a 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 the method SQLiteQueryBuilder.query

insteadSQLiteDataBase.query

and what are the benefits?

+3


source to share


1 answer


SQLiteQueryBuilder

helps to create more complex queries than those supported by the functions SQLiteDatabase

(for example, subqueries).



If your specific request doesn't need any of these complex features, then you don't need to use SQLiteQueryBuilder

. (But it might make sense if your code is organized to make it easier if all queries are using SQLiteQueryBuilder

.)

+3


source







All Articles