@Override public int update( Uri uri, ContentValues contentValues, String selection, String[] selectionArgs) { SQLiteDatabase db = helper.getWritableDatabase(); String realSelection = getSelectionFromId(uri, selection); return db.update(TABLE_NAME, contentValues, realSelection, selectionArgs); }
@Override public Uri insert(Uri uri, ContentValues contentValues) { SQLiteDatabase db = helper.getWritableDatabase(); long id = db.insert(TABLE_NAME, Items.NAME, contentValues); Log.d(LOG_TAG, "Adding new station to favorites database."); return ContentUris.withAppendedId(uri, id); }
@Override public int delete(Uri uri, String selection, String[] selectionArgs) { SQLiteDatabase db = helper.getWritableDatabase(); String realSelection = getSelectionFromId(uri, selection); Log.d(LOG_TAG, "Deleting station from favorites database."); return db.delete(TABLE_NAME, realSelection, selectionArgs); }
@Override public Cursor query( Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteDatabase db = helper.getWritableDatabase(); String realSelection = getSelectionFromId(uri, selection); Cursor result = db.query(TABLE_NAME, projection, realSelection, selectionArgs, null, null, sortOrder); Log.d(LOG_TAG, uri.toString() + ";" + realSelection + ";" + Arrays.toString(selectionArgs)); return result; }