android - SQLiteOpenHelper#onUpgrade() - is newVersion alwyays the newest version? -


Database Helper with my advanced idea:

  Public class databaseHelper SQLiteOpenHelper Extended {Private Static Final}  

switch without switch s The database schema will be updated to step-by-step up to the latest version, it does not matter what was in the first version of the user. If the old version is 8 , upgrade methods upgradeToNinth (db) , upgradeToTenth (DB) and UpgradeToEleventh (db) will be run. Great! But this code makes a perception that the value of newVersion is always the latest version of the database (the value given to the SQLiteOpenHelper manufacturer)). Is this goodbye true?

But this code makes a perception that the value of the new version is always the latest version of the database (the value given for the SQLiteOpenHelper constructor). Is this all true?

yes.

It can be verified by reading that onUpgrade () is the newverions logic in the same way as the SQLiteOpenHelper Pass the logic of the constructor.


Comments