--
---
You received this message because you are subscribed to the Google Groups "SQLCipher Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlcipher+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
-- Nick Parker
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {public void preKey(SQLiteDatabase database) {}public void postKey(SQLiteDatabase database) {database.rawExecSQL("PRAGMA cipher_migrate;");}};SQLiteDatabase source = SQLiteDatabase.openOrCreateDatabase(sourceDatabase, password, null, hook);source.close();and only after that create the class that extends SQLiteOpenHelper. Does this look OK :-) ?I don't see yet how the solution with the 'hook' works if I open the database a second time with the hook enabled. Shall the application "remember" that it migrated the database and don't use the hook again?Werner
unless the overhead is such that
it is likely to be noticed by the user, I doubt that it will be a big
problem, assuming that the execution time for this logic is measured
in milliseconds.
--
---
You received this message because you are subscribed to the Google Groups "SQLCipher Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlcipher+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On Fri, Oct 18, 2013 at 3:30 PM, Stephen Lombardo
<sjlom...@zetetic.net> wrote:
> In the short term there is another benefit to the hook approach we are
> already using today. It allows developers flexibility to run other pragmas
> than cipher_migrate.
And if your SQLiteOpenHelper were tied into your hook system, that
would be wonderful.
For example, your SQLiteOpenHelper could implement SQLiteDatabaseHook,
passing `this` to SQLiteDatabase.openOrCreateDatabase() as the fourth
parameter, and offer no-op implementations of preKey() and postKey().
That way, handling PRAGMA cipher_migrate, or your other scenarios,
would be a matter of overriding one method, and not have to affect
anything else in the application.
My apologies for not having more substantively reviewed your beta when
it was initially released, and therefore not echoing these concerns
earlier in your development cycle. I will endeavor to pay more
attention in the future. Feel free to yell at me (ideally via private
email) if you have not gotten comments from me within a few days of
future beta releases. :-)
SQLiteDatabase.loadLibs(mCtx);
mOpenHelper = new DatabaseHelper(mCtx);
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
public void preKey(SQLiteDatabase database) {
}
public void postKey(SQLiteDatabase database) {
if (database.getVersion() <= 3) {
database.rawExecSQL("PRAGMA cipher_migrate;");
}
}
};
File dbFile = mCtx.getDatabasePath(DbDef.DB_NAME);
mDb = SQLiteDatabase.openOrCreateDatabase(dbFile, DbDef.DB_PWD,
null, hook);
> <https:/...