Skip to content

Commit

Permalink
[DB] WAL support on SQLcipher
Browse files Browse the repository at this point in the history
  • Loading branch information
agrosner committed Feb 18, 2021
1 parent 731edd0 commit a4b3680
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
3 changes: 1 addition & 2 deletions lib/src/main/kotlin/com/dbflow5/config/DBFlowDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.dbflow5.database.DatabaseStatement
import com.dbflow5.database.DatabaseWrapper
import com.dbflow5.database.FlowCursor
import com.dbflow5.database.OpenHelper
import com.dbflow5.database.trySetWriteAheadLoggingEnabled
import com.dbflow5.migration.Migration
import com.dbflow5.observing.TableObserver
import com.dbflow5.runtime.DirectModelNotifier
Expand Down Expand Up @@ -156,7 +155,7 @@ abstract class DBFlowDatabase : DatabaseWrapper {
var wal = false
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
wal = config != null && config.journalMode.adjustIfAutomatic(FlowManager.context) == JournalMode.WriteAheadLogging
helper.trySetWriteAheadLoggingEnabled(wal)
helper.setWriteAheadLoggingEnabled(wal)
}
writeAheadLoggingEnabled = wal
isOpened = true
Expand Down
11 changes: 0 additions & 11 deletions lib/src/main/kotlin/com/dbflow5/database/OpenHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,3 @@ interface OpenHelper : OpenHelperDelegate {

fun deleteDB()
}

/**
* Ignores if the underlying DB supports it or not.
*/
fun OpenHelper.trySetWriteAheadLoggingEnabled(enabled: Boolean) {
try {
setWriteAheadLoggingEnabled(enabled)
} catch (e: UnsupportedOperationException) {
// ignore
}
}

0 comments on commit a4b3680

Please sign in to comment.