SQLiteQueryBuilder setTables - 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 setTables 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:query, setTables
        } 
    } 
 
    public Post getPost(long id) {
        final SQLiteDatabase db = openHelper.getReadableDatabase();
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(DATABASE_TABLE);
        Cursor c = qb.query(db, null, COL_ID + " = ?", new String[]{"" + id}, null, null, null);
        try { 
            if (!c.moveToFirst()) {
                return null; 
            } else { 
                return getPostFromCursor(c);
            } 
        } finally { 
            c.close();
        } 
    } 
 
    public static Post getPostFromCursor(Cursor c) {
7
CodeRank
This code example shows how to use the following methods:appendWhereEscapeString, query, setTables
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        final int match = URIMATCHER.match(uri);
        switch(match) {
            case SCHEDULE:
                qb.setTables(SCHEDULE_TXT);
                break; 
            case SCHEDULE_ID:
                qb.setTables(SCHEDULE_TXT);
                qb.appendWhereEscapeString("date=" + uri.getLastPathSegment());
                break; 
            case STAFF:
                qb.setTables(STAFF_TXT);
                break; 
            case STAFF_ID:
                qb.setTables(STAFF_TXT);

6
CodeRank

Related SQLiteQueryBuilder setTables Questions & Answers:

setTables Method Overview
Sets the list of tables to query.
See Code Examples for other Android SQLiteQueryBuilder Methods: