当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseUtils.concatenateWhere方法代码示例

本文整理汇总了Java中android.database.DatabaseUtils.concatenateWhere方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseUtils.concatenateWhere方法的具体用法?Java DatabaseUtils.concatenateWhere怎么用?Java DatabaseUtils.concatenateWhere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.database.DatabaseUtils的用法示例。


在下文中一共展示了DatabaseUtils.concatenateWhere方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addIdToSelection

import android.database.DatabaseUtils; //导入方法依赖的package包/类
protected static String addIdToSelection(int match, String selection) {
    String where;
    switch (match) {
        case MATCH_PHOTO_ID:
        case MATCH_ALBUM_ID:
        case MATCH_METADATA_ID:
            where = WHERE_ID;
            break;
        default:
            return selection;
    }
    return DatabaseUtils.concatenateWhere(selection, where);
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:14,代码来源:PhotoProvider.java

示例2: delete

import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
 * Handle deleting data.
 */
@Override
public int delete(Uri uri, String where, String[] whereArgs) {
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    String finalWhere;

    int count;

    switch (mUriMatcher.match(uri)) {
        case MAIN:
            // If URI is main table, delete uses incoming where clause and args.
            count = db.delete(MainTable.TABLE_NAME, where, whereArgs);
            break;

            // If the incoming URI matches a single note ID, does the delete based on the
            // incoming data, but modifies the where clause to restrict it to the
            // particular note ID.
        case MAIN_ID:
            // If URI is for a particular row ID, delete is based on incoming
            // data but modified to restrict to the given ID.
            finalWhere = DatabaseUtils.concatenateWhere(
                    MainTable._ID + " = " + ContentUris.parseId(uri), where);
            count = db.delete(MainTable.TABLE_NAME, finalWhere, whereArgs);
            break;

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

    getContext().getContentResolver().notifyChange(uri, null);

    return count;
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:36,代码来源:LoaderThrottle.java

示例3: update

import android.database.DatabaseUtils; //导入方法依赖的package包/类
/**
 * Handle updating data.
 */
@Override
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
    SQLiteDatabase db = mOpenHelper.getWritableDatabase();
    int count;
    String finalWhere;

    switch (mUriMatcher.match(uri)) {
        case MAIN:
            // If URI is main table, update uses incoming where clause and args.
            count = db.update(MainTable.TABLE_NAME, values, where, whereArgs);
            break;

        case MAIN_ID:
            // If URI is for a particular row ID, update is based on incoming
            // data but modified to restrict to the given ID.
            finalWhere = DatabaseUtils.concatenateWhere(
                    MainTable._ID + " = " + ContentUris.parseId(uri), where);
            count = db.update(MainTable.TABLE_NAME, values, finalWhere, whereArgs);
            break;

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

    getContext().getContentResolver().notifyChange(uri, null);

    return count;
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:32,代码来源:LoaderThrottle.java

示例4: query

import android.database.DatabaseUtils; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    int uriMatch = uriMatcher.match(uri);
    switch (uriMatch) {
        case ROUTE_PLANETS:
            return db.query(PlanetContract.Planet.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder);
        case ROUTE_PLANET:
            long id = PlanetContract.Planet.idFromUri(uri);
            selection = DatabaseUtils.concatenateWhere(selection, String.format("%s=?", PlanetContract.Planet._ID));
            selectionArgs = DatabaseUtils.appendSelectionArgs(selectionArgs, new String[]{Long.toString(id)});
            return db.query(PlanetContract.Planet.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder);
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
}
 
开发者ID:atomicrobot,项目名称:vinyl,代码行数:16,代码来源:PlanetContentProvider.java


注:本文中的android.database.DatabaseUtils.concatenateWhere方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。