Thankfully, the SQLite database and the API for accessing it provides some functions that will help you out.
in particular, these commands are "pragma" which reads and sets values in a properties list of the database and "user_version" which is an in-built database property intended to be used to track schema version.
sqlite> pragma user_version=10;
sqlite> pragma user_version;
user_version
------------------------------
10
sqlite> pragma user_version=12;
sqlite> pragma user_version;
user_version
------------------------------
12
This is the same process that your SQLiteOpenHelper implementation with Android uses, and provides you the ability to write onCreate and onUpdate methods as you would in Java.
http://stackoverflow.com/questions/2659797/how-do-i-use-sqlite3-pragma-user-version-in-objective-c
No comments:
Post a Comment