react-native-sqlite-storage icon indicating copy to clipboard operation
react-native-sqlite-storage copied to clipboard

How can I enable write-ahead logging

Open sp-suresh opened this issue 7 years ago • 3 comments

I was searching for the documentation showing how WAL can be enabled for simultaneous reading and writing

sp-suresh avatar Jun 24 '17 10:06 sp-suresh

This feature is not available. If you would like to make it work on iOS and Android PR would be very welcome. Otherwise I have to look more into this when I have time...

andpor avatar Aug 01 '17 21:08 andpor

You can just do, db.executeSql('PRAGMA journal_mode=WAL;') when you open/build your database.

While this is not the best solution it does enable WAL.

lukasbowen avatar Aug 04 '17 23:08 lukasbowen

You can just do, db.executeSql('PRAGMA journal_mode=WAL;') when you open/build your database.

While this is not the best solution it does enable WAL.

Actually, it won't work. The db did changed to wal mode, but android just restrict your db connection to 1.

The right way is to call https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper#setWriteAheadLoggingEnabled(boolean)

WonShaw avatar Oct 23 '21 04:10 WonShaw