當前位置: 首頁>>代碼示例>>Java>>正文


Java SQLiteQueryBuilder.setTables方法代碼示例

本文整理匯總了Java中android.database.sqlite.SQLiteQueryBuilder.setTables方法的典型用法代碼示例。如果您正苦於以下問題:Java SQLiteQueryBuilder.setTables方法的具體用法?Java SQLiteQueryBuilder.setTables怎麽用?Java SQLiteQueryBuilder.setTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.database.sqlite.SQLiteQueryBuilder的用法示例。


在下文中一共展示了SQLiteQueryBuilder.setTables方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getObservations

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
public Cursor getObservations() {
    SQLiteDatabase db = getReadableDatabase();
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    String [] sqlSelect = {
            "_id",
            ObsTable.Cols.DsoID,
            ObsTable.Cols.ObsDate,
            ObsTable.Cols.Location,
            ObsTable.Cols.Seeing,
            ObsTable.Cols.Transparency,
            ObsTable.Cols.Telescope,
            ObsTable.Cols.Eyepiece,
            ObsTable.Cols.Power,
            ObsTable.Cols.Filter,
            ObsTable.Cols.Notes
    };

    qb.setTables(ObsTable.NAME);
    Cursor c = qb.query(db, sqlSelect, null, null, null, null, null);
    c.moveToFirst();
    return c;
}
 
開發者ID:MTBehnke,項目名稱:NightSkyGuide,代碼行數:24,代碼來源:ObservationDatabaseHelper.java

示例2: handleMovieFull

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
private static void handleMovieFull(SQLiteQueryBuilder qb) {
	if(DBG) Log.d(TAG, "File is a movie.");

    qb.setTables(ScraperTables.MOVIE_TABLE_NAME +
            " LEFT JOIN " + ScraperTables.FILMS_MOVIE_VIEW_NAME + " ON (" +
            ScraperTables.MOVIE_TABLE_NAME + "." +
            ScraperStore.Movie.ID + " = " +
            ScraperTables.FILMS_MOVIE_VIEW_NAME + "." +
            ScraperStore.Movie.Director.MOVIE + ") " +
            "LEFT JOIN " + ScraperTables.PLAYS_MOVIE_VIEW_NAME + " ON (" +
            ScraperTables.MOVIE_TABLE_NAME + "." +
            ScraperStore.Movie.ID + " = " + 
            ScraperTables.PLAYS_MOVIE_VIEW_NAME + "." +
            ScraperStore.Movie.Actor.MOVIE + ") " +
            "LEFT JOIN " + ScraperTables.PRODUCES_MOVIE_VIEW_NAME + " ON (" +
            ScraperTables.MOVIE_TABLE_NAME + "." +
            ScraperStore.Movie.ID + " = " + 
            ScraperTables.PRODUCES_MOVIE_VIEW_NAME + "." +
            ScraperStore.Movie.Studio.MOVIE + ") " +
            "LEFT JOIN " + ScraperTables.BELONGS_MOVIE_VIEW_NAME + " ON (" +
            ScraperTables.MOVIE_TABLE_NAME + "." +
            ScraperStore.Movie.ID + " = " + 
            ScraperTables.BELONGS_MOVIE_VIEW_NAME + "." +
            ScraperStore.Movie.Genre.MOVIE + ")");
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:26,代碼來源:ScraperProvider.java

示例3: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
/**
 * Query the database with current settings and add information
 *
 * @param uri The database uri
 * @param projection The columns need to query
 * @param selection The where clause
 * @param selectionArgs The where value
 * @param sortOrder The column to sort
 *
 * @return The query result cursor
 */
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
        String sortOrder) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    qb.setTables(TABLE_NAME);

    int match = URI_MATCHER.match(uri);

    if (STATION_FREQ_ID == match) {
        qb.appendWhere("_id = " + uri.getPathSegments().get(1));
    }

    Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
    if (null != c) {
        c.setNotificationUri(getContext().getContentResolver(), uri);
    }
    return c;
}
 
開發者ID:hyperion70,項目名稱:android_device_MTS_x2605,代碼行數:31,代碼來源:FmRadioContentProvider.java

示例4: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    switch (URI_MATCHER.match(uri)) {
        case DEBUG_CONFIG_CODE:
            qb.setTables(DEBUG_CONFIG_TABLE);
            qb.setProjectionMap(projectionMap);
            break;

        default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }

    SQLiteDatabase db = dbHelper.getReadableDatabase();

    Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
    if (getContext() != null && getContext().getContentResolver() != null) {
        c.setNotificationUri(getContext().getContentResolver(), uri);
    }
    return c;
}
 
開發者ID:TinkerPatch,項目名稱:tinkerpatch-debug-tool,代碼行數:23,代碼來源:DebugProvider.java

示例5: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    int matchCode = mUriMatcher.match(uri);
    if (matchCode < 0) {
        throw new IllegalArgumentException("Invalid query URI: " + uri);
    }
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    if (isItemUri(matchCode)) {
        queryBuilder.appendWhere(BaseColumns._ID + "=" + uri.getLastPathSegment());
    }
    queryBuilder.setTables(getTableName(matchCode));
    SQLiteDatabase db = getDatabase(false);
    Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
}
 
開發者ID:apsun,項目名稱:QuoteLock,代碼行數:17,代碼來源:AutoContentProvider.java

示例6: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection,
                    final String[] selectionArgs, final String sortOrder) {
    final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(DATABASE_TABLE);

    final List<String> pathSegments = uri.getPathSegments();
    if (pathSegments.size() > 2)
        throw new IllegalArgumentException(uri.toString());

    if (pathSegments.size() == 2) {
        final AbstractAddress address = getDepositAddress(uri);
        qb.appendWhere(KEY_DEPOSIT_COIN_ID + "=");
        qb.appendWhereEscapeString(address.getType().getId());
        qb.appendWhere(" AND " + KEY_DEPOSIT_ADDRESS + "=");
        qb.appendWhereEscapeString(address.toString());
    }

    final Cursor cursor = qb.query(helper.getReadableDatabase(), projection,
            selection, selectionArgs, null, null, sortOrder);

    cursor.setNotificationUri(getContext().getContentResolver(), uri);

    return cursor;
}
 
開發者ID:filipnyquist,項目名稱:lbry-android,代碼行數:26,代碼來源:ExchangeHistoryProvider.java

示例7: queryById

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
protected Cursor queryById(Uri uri, String tableName, String[] columns, String selection, String[] selectionArgs, String sortOrder) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(tableName);
    StringBuilder w = new StringBuilder();
    w.append("_id = ");
    w.append(uri.getLastPathSegment());
    if (selection != null) {
        w.append(" AND (");
        w.append(selection);
        w.append(")");
    }
    mDb = mDbHelper.getWritableDatabase();
    return qb.query(mDb,
            columns,
            w.toString(),
            selectionArgs,
            null,
            null,
            sortOrder
    );
}
 
開發者ID:lifechurch,項目名稱:nuclei-android,代碼行數:22,代碼來源:ContentProviderBase.java

示例8: fetchAll

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
/**
 * Return a Cursor that contains all ExternalAttribute records which matches the parameters
 * 
 * @param attributeName
 *          is the attribute name, or null to fetch any actionName
 * @param appID
 *          is the application id, or null to fetch any appID
 * @param dataTypeID
 *          is the dataType id, or null to fetch any dataTypeID
 * @return a Cursor that contains all RegisteredAction records which matches the parameters.
 */
public Cursor fetchAll(String attributeName, Long appID, Long dataTypeID) {
  SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
  qb.setTables(DATABASE_TABLE);
  qb.appendWhere("1=1");
  if (attributeName != null) {
    qb.appendWhere(" AND " + KEY_EXTERNALATTRIBUTENAME + " = ");
    qb.appendWhereEscapeString(attributeName);
  }
  if (appID != null) {
    qb.appendWhere(" AND " + KEY_APPID + " = " + appID);
  }
  if (dataTypeID != null) {
    qb.appendWhere(" AND " + KEY_DATATYPEID + " = " + dataTypeID);
  }
  // Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
  return qb.query(database, KEYS, null, null, null, null, null);
}
 
開發者ID:biotinker,項目名稱:LibreTasks,代碼行數:29,代碼來源:ExternalAttributeDbAdapter.java

示例9: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                    String sortOrder) {

    int key = uriMatcher.match(uri);
    String table = "";

    switch (key) {
        case M_NOTE://0
            table = tblNote.TBL_NAME;
            break;
        default:
            break;
    }

    SQLiteDatabase sqlDB = mDbHelper.getWritableDatabase();
    SQLiteQueryBuilder sqlBuilder = new SQLiteQueryBuilder();
    sqlBuilder.setTables(table);
    sqlBuilder.setDistinct(true);
    Cursor c = sqlBuilder.query(sqlDB, projection, selection, selectionArgs, null, null,
            sortOrder);
    c.setNotificationUri(getContext().getContentResolver(), uri);
    return c;
}
 
開發者ID:tuyendt6,項目名稱:WindowsNoteMaster,代碼行數:25,代碼來源:DatabaseManager.java

示例10: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(sqLiteOpenHelper.TABLE_NAME);
    switch (uriMatcher.match(uri)){
        case PLACES_ID:
            queryBuilder.setProjectionMap(PlaceMap);
            break;
        default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }
    if (sortOrder == null || sortOrder == ""){
        sortOrder = sqLiteOpenHelper.ID;
    }

    Cursor cursor = queryBuilder.query(database, projection, selection,
            selectionArgs, null, null, sortOrder);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
}
 
開發者ID:thesabareesh,項目名稱:protrip,代碼行數:21,代碼來源:PlacesProvider.java

示例11: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
    createDbIfNotExists();

    SqlArguments args = new SqlArguments(uri, selection, selectionArgs);
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(args.table);

    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    Cursor result = qb.query(db, projection, args.where, args.args, null, null, sortOrder);
    result.setNotificationUri(getContext().getContentResolver(), uri);

    return result;
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:16,代碼來源:LauncherProvider.java

示例12: handleEpisodeFull

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
private static void handleEpisodeFull(SQLiteQueryBuilder qb) {
	if(DBG) Log.d(TAG, "File is a TV show.");

    qb.setTables(ScraperTables.EPISODE_TABLE_NAME +
            " LEFT JOIN " + ScraperTables.FILMS_EPISODE_VIEW_NAME + " ON (" +
            ScraperTables.EPISODE_TABLE_NAME + "." +
            ScraperStore.Episode.ID + " = " +
            ScraperTables.FILMS_EPISODE_VIEW_NAME + "." +
            ScraperStore.Episode.Director.EPISODE + ") " +
            "LEFT JOIN " + ScraperTables.GUESTS_VIEW_NAME + " ON (" +
            ScraperTables.EPISODE_TABLE_NAME + "." +
            ScraperStore.Episode.ID + " = " + 
            ScraperTables.GUESTS_VIEW_NAME + "." +
            ScraperStore.Episode.Actor.EPISODE + ")");
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:16,代碼來源:ScraperProvider.java

示例13: query

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
@Override
public Cursor query(final Uri uri, final String[] projection, final String selection,
        final String[] selectionArgs, final String sortOrder) {
    final SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
    final int match = sURIMatcher.match(uri);

    switch (match) {
        case SINGLE_PREFERENCE:
        case INTERNAL_SINGLE_PREFERENCE:
            builder.appendWhere(
                    TrayContract.Preferences.Columns.KEY + " = " +
                            DatabaseUtils.sqlEscapeString(uri.getPathSegments().get(2)));
            // no break
        case MODULE_PREFERENCE:
        case INTERNAL_MODULE_PREFERENCE:
            if (match == SINGLE_PREFERENCE
                    || match == INTERNAL_SINGLE_PREFERENCE) {
                builder.appendWhere(" AND ");
            }
            builder.appendWhere(
                    TrayContract.Preferences.Columns.MODULE + " = " +
                            DatabaseUtils.sqlEscapeString(uri.getPathSegments().get(1)));
            // no break
        case ALL_PREFERENCE:
        case INTERNAL_ALL_PREFERENCE:
            builder.setTables(getTable(uri));
            break;
        default:
            throw new IllegalArgumentException("Query is not supported for Uri: " + uri);
    }

    // Query
    Cursor cursor = builder.query(getReadableDatabase(), projection, selection,
            selectionArgs, null, null, sortOrder);

    if (cursor != null) {
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
    }
    return cursor;
}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:41,代碼來源:TrayProvider.java

示例14: getWifiServer

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
public WifiServer getWifiServer(long id){
    SQLiteDatabase db = this.getReadableDatabase();

    WifiServer wifiServer = new WifiServer();
    wifiServer.setId(id);

    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    qb.setTables(TABLE_SERVERS +
            " JOIN " + TABLE_WIFI_SERVERS +
            " USING(" + COLUMN_ID + ")");

    Cursor c = qb.query(db,
            new String[]{COLUMN_IS_ENABLED,
                    COLUMN_CERTIFICATE_ID,
                    COLUMN_IP_OR_HOSTNAME,
                    COLUMN_PORT_NUMBER,
                    COLUMN_SSID_WHITELIST},
            COLUMN_ID + "=?", new String[]{String.valueOf(id)},
            null, null, null);

    if (c.moveToFirst()){
        wifiServer.setIsEnabled(intToBool(c.getInt(0)));
        wifiServer.setCertificateId(c.getLong(1));
        wifiServer.setIpOrHostname(c.getString(2));
        wifiServer.setPortNumber(c.getInt(3));
        wifiServer.setSsidWhitelist(c.getString(4));
    }

    c.close();
    db.close();
    return wifiServer;
}
 
開發者ID:rootkiwi,項目名稱:an2linuxclient,代碼行數:34,代碼來源:ServerDatabaseHandler.java

示例15: getMobileServer

import android.database.sqlite.SQLiteQueryBuilder; //導入方法依賴的package包/類
public MobileServer getMobileServer(long id){
    SQLiteDatabase db = this.getReadableDatabase();

    MobileServer mobileServer = new MobileServer();
    mobileServer.setId(id);

    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    qb.setTables(TABLE_SERVERS +
            " JOIN " + TABLE_MOBILE_SERVERS +
            " USING(" + COLUMN_ID + ")");

    Cursor c = qb.query(db,
            new String[]{COLUMN_IS_ENABLED,
                    COLUMN_CERTIFICATE_ID,
                    COLUMN_IP_OR_HOSTNAME,
                    COLUMN_PORT_NUMBER,
                    COLUMN_ROAMING_ALLOWED},
            COLUMN_ID + "=?", new String[]{String.valueOf(id)},
            null, null, null);

    if (c.moveToFirst()){
        mobileServer.setIsEnabled(intToBool(c.getInt(0)));
        mobileServer.setCertificateId(c.getLong(1));
        mobileServer.setIpOrHostname(c.getString(2));
        mobileServer.setPortNumber(c.getInt(3));
        mobileServer.setRoamingAllowed(intToBool(c.getInt(4)));
    }

    c.close();
    db.close();
    return mobileServer;
}
 
開發者ID:rootkiwi,項目名稱:an2linuxclient,代碼行數:34,代碼來源:ServerDatabaseHandler.java


注:本文中的android.database.sqlite.SQLiteQueryBuilder.setTables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。