Search code examples
iphonesqlitereadwritelock

Can I read from a SQLite db while writing to it on the iPhone?


Is it possible to read from a SQLite db while it's being written to?

I'm aware that access is blocked for writes when it's being written to, but is that the same for reads?


Solution

  • After some reading around, and looking through the FMDB code, I discovered that I wasn't using the SQLITE_BUSY and SQLITE_LOCKED return values correctly.

    According to the FMDB code, one should loop for a limited number of retries, waiting for a short time bewteen.

    So I implemented that in my code, and everything seems to work fine.