SQLiteQueryBuilder query - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SQLiteQueryBuilder query method.

This code example shows how to use the following methods:query, setTables
  } 
 
  @Override 
  public Cursor query(Uri url, String[] projection, String selection,
                      String[] selectionArgs, String sort) {
    SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
 
    qb.setTables(TABLE);
 
    String orderBy;
 
    if (TextUtils.isEmpty(sort)) {
      orderBy=Constants.DEFAULT_SORT_ORDER;
    } 
    else { 
      orderBy=sort;
    } 
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,

8
CodeRank
This code example shows how to use the following methods:query, setTables
	} 
 
	public Cursor getEmployees() {
 
		SQLiteDatabase db = getReadableDatabase();
		SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
 
		String [] sqlSelect = {"0 _id", "FullName"}; 
		String sqlTables = "Employees";
 
		qb.setTables(sqlTables);
		Cursor c = qb.query(db, sqlSelect, null, null,
				null, null, null); 
 
		c.moveToFirst();
		return c;
 
	} 
 
} 
8
CodeRank
This code example shows how to use the following methods:appendWhere, query, setTables
            String[] selectionArgs, String groupBy, String having, String sortOrder) {
        // We won't bother checking the validity of params here, but you should! 
 
        // SQLiteQueryBuilder is the helper class that creates the 
        // proper SQL syntax for us. 
        SQLiteQueryBuilder qBuilder = new SQLiteQueryBuilder();
 
        // Set the table we're querying. 
        qBuilder.setTables(DATABASE_TABLE_NAME);
 
        // If the query ends in a specific record number, we're 
        // being asked for a specific record, so set the 
        // WHERE clause in our query. 
        if((URI_MATCHER.match(uri)) == SPECIFIC_MESSAGE){
            qBuilder.appendWhere("_id=" + uri.getPathLeafId());
        } 
 
        // Set sort order. If none specified, use default. 
        if(TextUtils.isEmpty(sortOrder)){
            sortOrder = DEFAULT_SORT_ORDER;

7
CodeRank
This code example shows how to use the following methods:appendWhere, query, setTables
    @Override 
    public Cursor query(Uri uri, String[] projection, String selection,
            String[] selectionArgs,
            String sortOrder)
    { 
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(PHOTOS_TABLE);
        switch (uriMatcher.match(uri))
        { 
            case UPLOAD_ID:
                qb.appendWhere(KEY_ID + "=" + uri.getPathSegments().get(1));
                break; 
            default: 
                break; 
        } 
 
        Cursor c = qb.query(mDb, projection, selection, selectionArgs, null,
                null, null); 
        c.setNotificationUri(getContext().getContentResolver(), uri);
        return c;

7
CodeRank
This code example shows how to use the following methods:query, setTables
  } 
 
  @Override 
  public Cursor query(Uri url, String[] projection, String selection,
                      String[] selectionArgs, String sort) {
    SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
 
    qb.setTables(TABLE);
 
    String orderBy;
 
    if (TextUtils.isEmpty(sort)) {
      orderBy=Constants.DEFAULT_SORT_ORDER;
    } 
    else { 
      orderBy=sort;
    } 
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,

8
CodeRank
This code example shows how to use the following methods:query, setTables
This code example shows how to use the following methods:query, setTables
  } 
 
  @Override 
  public Cursor query(Uri url, String[] projection, String selection,
                      String[] selectionArgs, String sort) {
    SQLiteQueryBuilder qb=new SQLiteQueryBuilder();
 
    qb.setTables(TABLE);
 
    String orderBy;
 
    if (TextUtils.isEmpty(sort)) {
      orderBy=Constants.DEFAULT_SORT_ORDER;
    } 
    else { 
      orderBy=sort;
    } 
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,

8
CodeRank
This code example shows how to use the following methods:appendWhere, query, setTables
7
CodeRank
This code example shows how to use the following methods:appendWhere, query, setTables
8
CodeRank
This code example shows how to use the following methods:appendWhere, query, setTables
8
CodeRank

Related SQLiteQueryBuilder query Questions & Answers:

query Method Overview
Perform a query by combining all current settings and the information passed into this method.
See Code Examples for other Android SQLiteQueryBuilder Methods: