I have an app that writes to the databases with transactions. I understand that sqlite will write to the journal file and then merge it in once the journal file gets to a certain size. I also have functionality that will try and copy the database file to another location. My problem is I can't find a way to force sqlite to merge the journal into the main database.
All of my queries look something like this
SQLiteDatabase database =null;
try{
database = getReadableDatabase();
//PERFORM SOME INSERT
}
catch (Exception e){
Log.e(TAG, "Error with insert");
}
finally {
if( database != null){
database.close();
}
}
After these methods execute I will close the app and inspect the directory where the app saves its database. I can see the database file and database-journal.
I am trying to do something like
public void copyDatabase(){
//FORCE MERGE
//DO OTHER OPERATIONS
}
Does somebody have any ideas on how to merge the journal file when needed?
Aucun commentaire:
Enregistrer un commentaire