Skip to content

Commit 2e8b53f

Browse files
Remove upgradeDatabaseFormatFromVersion1To2 in favor of cipher_migrate
1 parent 001d34b commit 2e8b53f

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/net/sqlcipher/database/SQLiteDatabase.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,37 +77,7 @@ public class SQLiteDatabase extends SQLiteClosable {
7777
public int status(int operation, boolean reset){
7878
return native_status(operation, reset);
7979
}
80-
81-
public static void upgradeDatabaseFormatFromVersion1To2(File databaseToMigrate, String password) throws Exception {
82-
83-
File newDatabasePath = null;
84-
boolean renameDatabase = false;
85-
SQLiteDatabaseHook hook = new SQLiteDatabaseHook(){
86-
public void preKey(SQLiteDatabase database){
87-
database.execSQL("PRAGMA cipher_default_use_hmac = off");
88-
}
89-
public void postKey(SQLiteDatabase database){
90-
database.execSQL("PRAGMA cipher_default_use_hmac = on");
91-
}
92-
};
93-
94-
try {
95-
newDatabasePath = File.createTempFile("temp", "db", databaseToMigrate.getParentFile());
96-
SQLiteDatabase source = SQLiteDatabase.openOrCreateDatabase(databaseToMigrate, password, null, hook);
97-
source.rawExecSQL(String.format("ATTACH DATABASE '%s' as newdb", newDatabasePath.getAbsolutePath()));
98-
source.rawExecSQL("SELECT sqlcipher_export('newdb')");
99-
source.rawExecSQL("DETACH DATABASE newdb");
100-
source.close();
101-
renameDatabase = true;
102-
} catch(Exception e){
103-
throw e;
104-
}
105-
if(renameDatabase){
106-
databaseToMigrate.delete();
107-
newDatabasePath.renameTo(databaseToMigrate);
108-
}
109-
}
110-
80+
11181
private static void loadICUData(Context context, File workingDir) {
11282

11383
try {

0 commit comments

Comments
 (0)