In my iOS app I have a sqlite database. When the app is started, and if there is connectivity, it checks to see if there is any new data to upload and write to the database. Once this is finished, the app then displays the information in a tableview. I read about “Write Ahead Logging” (WAL), and as far as I understand, this allows a thread to read from the database, while another thread is writing. BUT only 1 write is allowed, but multiple reads. I want the app to display the information (read from the sqlite database) while there might be a thread in the background writing to it. And it seems that “Write Ahead Logging” (WAL) is what I need to do.
BUT I have not found any specific information on how to do this in iOS, and indeed if this is available. Would anyone be kind enough to share some code or knowledge?
I have already looked at: Read and Write Sqlite database data concurrently from multiple connections --> there is no actual code, and it refers to "To turn WAL on, please refer to Sqlite documentation." Which I have done, but I can't see how to use it in Xcode.
How to handle multiple thread access the sqlite3 with out dblocked error --> this does not mention anything about WAL.
Core Data and iOS 7: Different behavior of persistent store --> but this refers to Core Data rather than Sqlite.
Is there anything that explains how to enable WAL for sqlite in Xcode? Preferably with an example?
Thanks very much.
Aucun commentaire:
Enregistrer un commentaire