How do I unlock a SQLite database?

前端 未结 30 1813
栀梦
栀梦 2020-11-22 15:56
sqlite> DELETE FROM mails WHERE (`id` = 71);
SQL error: database is locked

How do I unlock the database so this will work?

30条回答
  •  半阙折子戏
    2020-11-22 16:31

    I have such problem within the app, which access to SQLite from 2 connections - one was read-only and second for writing and reading. It looks like that read-only connection blocked writing from second connection. Finally, it is turns out that it is required to finalize or, at least, reset prepared statements IMMEDIATELY after use. Until prepared statement is opened, it caused to database was blocked for writing.

    DON'T FORGET CALL:

    sqlite_reset(xxx);
    

    or

    sqlite_finalize(xxx);
    

提交回复
热议问题