Clean class

Media3
Thomas 10 months ago
parent fbf2d72f5d
commit 1a237e00c3

@ -68,7 +68,7 @@ public class CachedBundle {
} }
public long insertAccountBundle(Account account, BaseAccount currentUser) throws DBException { public void insertAccountBundle(Account account, BaseAccount currentUser) throws DBException {
if (db == null) { if (db == null) {
throw new DBException("db is null. Wrong initialization."); throw new DBException("db is null. Wrong initialization.");
} }
@ -83,9 +83,8 @@ public class CachedBundle {
valuesAccount.put(Sqlite.COL_INSTANCE, currentUser.instance); valuesAccount.put(Sqlite.COL_INSTANCE, currentUser.instance);
valuesAccount.put(Sqlite.COL_TYPE, CacheType.ACCOUNT.getValue()); valuesAccount.put(Sqlite.COL_TYPE, CacheType.ACCOUNT.getValue());
removeIntent(currentUser, account.id); removeIntent(currentUser, account.id);
return db.insertOrThrow(Sqlite.TABLE_INTENT, null, valuesAccount); db.insertOrThrow(Sqlite.TABLE_INTENT, null, valuesAccount);
} }
return -1;
} }
/** /**
@ -272,21 +271,8 @@ public class CachedBundle {
/** /**
* Remove a bundle from db * Remove a bundle from db
*
* @param id - intent id
*/ */
private void removeIntent(String id) throws DBException { public void deleteOldIntent() throws DBException {
if (db == null) {
throw new DBException("db is null. Wrong initialization.");
}
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_ID + " = '" + id + "'", null);
}
/**
* Remove a bundle from db
*
*/
public long deleteOldIntent() throws DBException {
if (db == null) { if (db == null) {
throw new DBException("db is null. Wrong initialization."); throw new DBException("db is null. Wrong initialization.");
} }
@ -296,10 +282,9 @@ public class CachedBundle {
Date date = cal.getTime(); Date date = cal.getTime();
String dateStr = Helper.dateToString(date); String dateStr = Helper.dateToString(date);
try { try {
return db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr}); db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr});
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return -1;
} }
} }

Loading…
Cancel
Save