Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/middleware/DatabaseUpdateService.java
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | private boolean performDBUpdate(AtomicReference<Fetcher.result> gres){ | ||||
if(gres.get()!= Fetcher.result.OK){ | if(gres.get()!= Fetcher.result.OK){ | ||||
Log.w(DEBUG_TAG,"Something went wrong downloading"); | Log.w(DEBUG_TAG,"Something went wrong downloading"); | ||||
return false; | return false; | ||||
} | } | ||||
if(!setDBUpdatingFlag(true)) | if(!setDBUpdatingFlag(true)) | ||||
return false; //If the commit to the SharedPreferences didn't succeed, simply stop updating the database | return false; //If the commit to the SharedPreferences didn't succeed, simply stop updating the database | ||||
final NextGenDB dbHelp = NextGenDB.getInstance(getApplicationContext()); | final NextGenDB dbHelp = new NextGenDB(getApplicationContext()); | ||||
final SQLiteDatabase db = dbHelp.getWritableDatabase(); | final SQLiteDatabase db = dbHelp.getWritableDatabase(); | ||||
//Empty the needed tables | //Empty the needed tables | ||||
db.beginTransaction(); | db.beginTransaction(); | ||||
//db.execSQL("DELETE FROM "+StopsTable.TABLE_NAME); | //db.execSQL("DELETE FROM "+StopsTable.TABLE_NAME); | ||||
//db.delete(LinesTable.TABLE_NAME,null,null); | //db.delete(LinesTable.TABLE_NAME,null,null); | ||||
//put new data | //put new data | ||||
long startTime = System.currentTimeMillis(); | long startTime = System.currentTimeMillis(); | ||||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register