From cb8275771fb335d9500b97e2b1b865973653c4bd Mon Sep 17 00:00:00 2001 From: Katharine Date: Sat, 30 Oct 2021 13:08:37 +0800 Subject: [PATCH] remove database shortcuts --- .../java/protect/card_locker/DBHelper.java | 54 ------------------- 1 file changed, 54 deletions(-) diff --git a/app/src/main/java/protect/card_locker/DBHelper.java b/app/src/main/java/protect/card_locker/DBHelper.java index a55ae71fe..505f3be52 100644 --- a/app/src/main/java/protect/card_locker/DBHelper.java +++ b/app/src/main/java/protect/card_locker/DBHelper.java @@ -613,21 +613,6 @@ public class DBHelper extends SQLiteOpenHelper } } - public void addLoyaltyCardToGroup(int cardId, String groupId){ - SQLiteDatabase db = getWritableDatabase(); - ContentValues contentValues = new ContentValues(); - contentValues.put(LoyaltyCardDbIdsGroups.cardID, cardId); - contentValues.put(LoyaltyCardDbIdsGroups.groupID, groupId); - db.insert(LoyaltyCardDbIdsGroups.TABLE, null, contentValues); - } - - public void removeLoyaltyCardFromGroup(int cardId, String groupId){ - SQLiteDatabase db = getWritableDatabase(); - db.delete(LoyaltyCardDbIdsGroups.TABLE, - whereAttrs(LoyaltyCardDbIdsGroups.cardID, LoyaltyCardDbIdsGroups.groupID), - withArgs(cardId, groupId)); - } - public boolean deleteLoyaltyCard(final int id) { SQLiteDatabase db = getWritableDatabase(); @@ -733,45 +718,6 @@ public class DBHelper extends SQLiteOpenHelper limitString, filter.trim().isEmpty() ? null : new String[] { TextUtils.join("* ", filter.split(" ")) + '*' }, null); } - /** - * Returns a cursor to all loyalty cards with the filter text in either the store and whether card is in the provided group - * - * @param filter - * @param group - * @param order - * @return Cursor - */ - public Cursor getIfLoyaltyCardsAreInGroupCursor(String filter, Group group, LoyaltyCardOrder order, LoyaltyCardOrderDirection direction) { - SQLiteDatabase db = getReadableDatabase(); - - if (group == null) { - throw new IllegalArgumentException("group cannot be null"); - } - String orderField = getFieldForOrder(order); - String[] selectionArgs; - if(filter.trim().isEmpty()) { - selectionArgs = new String[]{ - group._id - }; - }else{ - selectionArgs = new String[]{ - group._id, - TextUtils.join("* ", filter.split(" ")) + '*' - }; - } - return db.rawQuery("SELECT " + "*" + - " FROM " + LoyaltyCardDbIds.TABLE + " LEFT OUTER JOIN " + - " (SELECT " + LoyaltyCardDbIdsGroups.TABLE + ".*" + - " FROM " + LoyaltyCardDbIdsGroups.TABLE + - " WHERE " + LoyaltyCardDbIdsGroups.groupID + " = ? " + - " ) " + " AS " + LoyaltyCardDbIdsGroups.TABLE + - " ON " + LoyaltyCardDbIds.TABLE + "." + LoyaltyCardDbIds.ID + " = " + LoyaltyCardDbIdsGroups.TABLE + "." + LoyaltyCardDbIdsGroups.cardID + - (filter.trim().isEmpty() ? "" : " WHERE " + LoyaltyCardDbIds.TABLE + "." + LoyaltyCardDbIds.STORE + " MATCH ? ") + - " ORDER BY " + LoyaltyCardDbIds.TABLE + "." + orderField, - selectionArgs, - null); - } - /** * Returns the amount of loyalty cards. *