setWriteAheadLoggingEnabled method not available in Sqlcipher for Android


Hi @developernotes

I see that

writableDatabase.beginTransactionNonExclusive();   setWriteAheadLoggingEnabled(true);

are not available as part of Sqlcipher for Android, but Is there any specific reason why these methods are not available as we are using them in our exisitng project for concurrent transactions. I suspect there could be performance issues as we are dealing with multiple of thousands of records. Please suggest


Hello @vinay_kumar

The SQLiteDatabase::beginTransactionNonExclusive() and SQLiteOpenHelper::setWriteAheadLoggingEnabled() methods were added in API 11, SQLCipher for Android uses an older snapshot of the android.database.sqlite package which allows for targeting down to Android 2.1. You can manually invoke these via SQL commands using rawExecSQL.


oh okay. Thanks for the tip.


Please confirm that

beginTransactionNonExclusive(); is equivalent to

rawExecSQL("PRAGMA database.locking_mode = NORMAL");`  


setWriteAheadLoggingEnabled() is equivalent to

rawExecSQL("PRAGMA journal_mode=WAL;");


Hello @AVD

In this case it is best to verify the source to understand the behavior of a different library. It appears that beginTransactionNonExclusive() ends up calling this, so they are issuing a BEGIN IMMEDIATE; command. The call to setWriteAheadLoggingEnabled() appears to end up calling this with a value of WAL.