daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest May 16th, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     private int deleteInternal(Uri url, String userWhere, String[] whereArgs) {
  2.         StringBuilder whereClause = getWhereClause(userWhere);
  3.         int match = mUrlMatcher.match(url);
  4.         String idColumnName = null;
  5.         final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
  6.         int count = 0;
  7.  
  8.         UrlMatch urlMatch = new UrlMatch(url, whereClause, match, db).invoke();
  9.         idColumnName = urlMatch.getIdColumnName();
  10.  
  11.         idColumnName = setIdColumnNameIfNull(idColumnName);
  12.  
  13.         appendIfChangedItemIdIsNotNull(idColumnName, urlMatch.getChangedItemId(), whereClause);
  14.  
  15.         if (DBG) log("delete from " + url + " WHERE  " + whereClause);
  16.  
  17.         count = db.delete(urlMatch.getTableToChange(), whereClause.toString(), whereArgs);
  18.         count += deleteRecordsFromAdditionTableToChange(whereArgs, urlMatch.getAdditionalTableToChange(), whereClause, db);
  19.  
  20.         if (urlMatch.isContactDeleted() && count > 0) {
  21.             // since the contact cleanup triggers no longer work for cross database tables,
  22.             // we have to do it by hand here.
  23.             performContactRemovalCleanup(urlMatch.getDeletedContactId());
  24.         }
  25.  
  26.         notifyOfDeletedRows(urlMatch, match, count);
  27.  
  28.         return count;
  29.     }
  30.  
  31.     private int deleteRecordsFromAdditionTableToChange(String[] whereArgs, String additionalTableToChange, StringBuilder whereClause, SQLiteDatabase db) {
  32.         int result = 0;
  33.         if (additionalTableToChange != null){
  34.             result = db.delete(additionalTableToChange, whereClause.toString(), whereArgs);
  35.         }
  36.         return result;
  37.     }
RAW Paste Data
Top