This commit is contained in:
NudeDude 2018-08-18 18:29:18 +02:00
parent 5944b70785
commit c1f9ef0faf
1 changed files with 3 additions and 0 deletions

View File

@ -53,6 +53,7 @@ public class TrendDatabase {
SQLiteDatabase db = dataHelper.getWritableDatabase();
ContentValues trendcolumn = new ContentValues();
String query = "DELETE FROM trend WHERE woeID=" + woeId;
db.beginTransaction();
db.execSQL(query); //Alte Einträge löschen
for(int pos = 0; pos < trends.size(); pos++) {
Trend trend = trends.get(pos);
@ -62,6 +63,8 @@ public class TrendDatabase {
trendcolumn.put("trendlink", trend.link);
db.insertWithOnConflict("trend",null, trendcolumn,SQLiteDatabase.CONFLICT_REPLACE);
}
db.setTransactionSuccessful();
db.endTransaction();
db.close();
}
}