Update SQLCipher to 4.5.3-FTS-S3

This commit is contained in:
Greyson Parrelli
2023-03-15 16:19:01 -04:00
parent 8ca596580c
commit 7d7e6e5013
4 changed files with 13 additions and 9 deletions

View File

@@ -27,8 +27,8 @@ public final class SqlCipherDeletingErrorHandler implements DatabaseErrorHandler
}
@Override
public void onCorruption(SQLiteDatabase db) {
Log.e(TAG, "Database '" + databaseName + "' corrupted! Going to try to run some diagnostics.");
public void onCorruption(SQLiteDatabase db, String message) {
Log.e(TAG, "Database '" + databaseName + "' corrupted! Message: " + message + ". Going to try to run some diagnostics.");
Log.w(TAG, " ===== PRAGMA integrity_check =====");
try (Cursor cursor = db.rawQuery("PRAGMA integrity_check", null)) {

View File

@@ -18,15 +18,14 @@ import java.util.concurrent.atomic.AtomicReference
*/
class SqlCipherErrorHandler(private val databaseName: String) : DatabaseErrorHandler {
override fun onCorruption(db: SQLiteDatabase) {
val output = StringBuilder()
output.append("Database '$databaseName' corrupted! Going to try to run some diagnostics.\n")
override fun onCorruption(db: SQLiteDatabase, message: String) {
val result: DiagnosticResults = runDiagnostics(ApplicationDependencies.getApplication(), db)
var lines: List<String> = result.logs.split("\n")
lines = listOf("Database '$databaseName' corrupted!. Diagnostics results:\n") + lines
lines = listOf("Database '$databaseName' corrupted!", "[sqlite] $message", "Diagnostics results:") + lines
Log.e(TAG, "Database '$databaseName' corrupted!. Diagnostics results:\n ${result.logs}")
Log.e(TAG, "Database '$databaseName' corrupted!")
Log.e(TAG, "[sqlite] $message")
Log.e(TAG, "Diagnostic results:\n ${result.logs}")
if (result is DiagnosticResults.Success) {
if (result.pragma1Passes && result.pragma2Passes) {