SQLite simultaneous reading and writing

后端 未结 4 1588
谎友^
谎友^ 2020-11-30 00:59

I\'ve read a lot of topics, but can\'t figure out answer for question: is it possible to read and write simultaneous?

I have background thread that updates some data

4条回答
  •  旧巷少年郎
    2020-11-30 01:14

    You cannot read and write at the same time. SQLite is a serverless, file-based database.

    From the SQLite FAQ:

    "When any process wants to write, it must lock the entire database file for the duration of its update. But that normally only takes a few milliseconds. Other processes just wait on the writer to finish then continue about their business. Other embedded SQL database engines typically only allow a single process to connect to the database at once."

提交回复
热议问题