setWriteAheadLoggingEnabled method not available in Sqlcipher for Android


#1

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


#2

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.


#3

oh okay. Thanks for the tip.


#4

Please confirm that

beginTransactionNonExclusive(); is equivalent to

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

and

setWriteAheadLoggingEnabled() is equivalent to

rawExecSQL("PRAGMA journal_mode=WAL;");

#5

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.