简体   繁体   中英

Proper handling SQLite Database Corruption in android

I saw DatabaseErrorHandler interface that have onCorruption method , this interface can be passed to the SQLiteOpenHelper constructor . my question is what is a good implementation to provide in this method ? should i handle the delete side-effect problems only ?? or what causes this method to be called

If there is nothing special you want to do when the database gets corrupted then pass in null . The DefaultDatabaseErrorHandler will be used then. It deletes the database since corruption can't be repaired in SQLite afaik. Luckily it should never happen - SQLite is pretty robust.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM