Sqlcipher: use compatibility mode instead of migration

GitOrigin-RevId: 91fe86328e7fcd2e03e298482ad2ffac2b48767f
This commit is contained in:
Arseny Smirnov 2020-08-14 13:44:16 +03:00
parent e43f419a6f
commit 11e09c5699

View File

@ -189,13 +189,8 @@ Result<SqliteDb> SqliteDb::do_open_with_key(CSlice path, const DbKey &db_key, bo
auto key = db_key_to_sqlcipher_key(db_key);
TRY_STATUS(db.exec(PSLICE() << "PRAGMA key = " << key));
if (with_cipher_migrate) {
LOG(INFO) << "Start 'PRAGMA cipher_migrate' for " << path;
PerfWarningTimer timer("PRAGMA cipher_migrate", 0.5);
TRY_RESULT(code, db.get_pragma_string("cipher_migrate"));
LOG(INFO) << "Finish 'PRAGMA cipher_migrate' for " << path;
if (code != "0") {
return Status::Error(PSLICE() << "'PRAGMA cipher_migrate' failed - " << code);
}
LOG(INFO) << "Try Sqlcipher compatibility mode";
TRY_STATUS(db.exec("PRAGMA cipher_compatibility = 3"));
}
}
TRY_STATUS_PREFIX(db.check_encryption(), "Can't open database: ");