How can I lock a sqlite database?

后端 未结 1 546
星月不相逢
星月不相逢 2020-12-30 03:44

We\'ve had issues in the past where a rogue process was keeping a sqlite db locked. I\'ve written some code to notify us if this is happening, but need to test it.

H

相关标签:
1条回答
  • 2020-12-30 04:31

    Execute these statements:

    PRAGMA locking_mode = EXCLUSIVE;
    BEGIN EXCLUSIVE;
    

    This will lock whole database until you execute:

    COMMIT;
    

    For simplicity, you can do this using sqlite3 command line utility.

    For more info, see documentation.

    0 讨论(0)
提交回复
热议问题