简体   繁体   中英

Android: Sqlite DB Upgrade openOrCreateDatabase

Have used openOrCreateDatabase to create a SQLiteDatabase associated with my application package. Wat does setVersion api do? Now my DB is getting upgraded on newer version of my app.Is there any upgrade callback? OR we need to use SQLiteOpenHelper to get upgrade callback?

openOrCreateDatabase() just opens the database file, creating a new one if one doesn't already exist.

There's no versioning involved, and no schema creation / upgrade callbacks. SQLiteOpenHelper is an easy way to provide such functionality.

To learn how SQLiteOpenHelper does the versioning and invokes callbacks, see the source .

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