Forked from udacityandroid/Excerpt from PetProvider.java
Created
October 4, 2016 10:43
-
-
Save jchackDragon/632d0c7cb5800f7930a4c4c3503d0dd2 to your computer and use it in GitHub Desktop.
Revisions
-
udacityandroid created this gist
Sep 7, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ @Override public int delete(Uri uri, String selection, String[] selectionArgs) { // Get writeable database SQLiteDatabase database = mDbHelper.getWritableDatabase(); final int match = sUriMatcher.match(uri); switch (match) { case PETS: // Delete all rows that match the selection and selection args return database.delete(PetEntry.TABLE_NAME, selection, selectionArgs); case PET_ID: // Delete a single row given by the ID in the URI selection = PetEntry._ID + "=?"; selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) }; return database.delete(PetEntry.TABLE_NAME, selection, selectionArgs); default: throw new IllegalArgumentException("Deletion is not supported for " + uri); }