sqlite3 database is getting locked

前端 未结 1 2048
悲&欢浪女
悲&欢浪女 2021-01-15 10:19

I am creating an application with sqlite. I am performing all kind of task on the database Insert, Update, Delete, Select.

For that I open the database

相关标签:
1条回答
  • 2021-01-15 10:54

    Open database once in the beginning. And close it in the end in AppWillterminate function. You are only consuming time by opening and closing it in every database function.

    As far as database lock is concerned, it gets locked when some application is still using it and other application is trying to get its access.

    This could be your app, or possibly the sqlite manager add-on of your firefox.

    I faced same problem once and what i did was

    1. Disabled the option in sqlite add-on where it remembers the previously opened database.

    2. Restart xcode, simulator.

    3. Make a copy of the sqlite file (desktop), delete it from the project and then add in project again from desktop.

    The last solution sounds weird, but i was mad that time.

    I hope this could help you.

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