-
Notifications
You must be signed in to change notification settings - Fork 568
Upgrading while preserving user_version #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi rossimo, The |
I've attempted to read the user_version PRAGMA from the old database to set in the new database before calling File v1DatabaseFile= getDatabasePath( databaseName );
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase( v1DatabaseFile, databasePassword, null, null );
SQLiteStatement prog = db.compileStatement( "PRAGMA user_version;" );
int version = (int) prog.simpleQueryForLong(); Also, for clarification, I'm not attempting to import tables (with data) from a v1 database into an existing v2 database, I'm trying to convert a v1 database (with data) into a new v2 database. |
Hi rossimo, You can actually use the |
Thanks, that worked great! |
While using the
SQLiteDatabase.upgradeDatabaseFormatFromVersion1To2()
method to convert a database, it seems that the user_version PRAGMA is reset to 0 in the newly converted database. This results in theSQLiteOpenHelper.onCreate()
method being called upon my first attempt to use the converted database, even though the database already contains data. Is there a accessible method in the android-database-sqlcipher library that allows me to preserve the version PRAGMA to preventonCreate()
being called redundantly?The text was updated successfully, but these errors were encountered: