sqlite error database is locked

后端 未结 8 1221
天命终不由人
天命终不由人 2020-12-06 08:00

I am have a sqlite database in the iPhone application I am writing. I get an error with following code that I am running in a background thread. In the background thread, I

8条回答
  •  囚心锁ツ
    2020-12-06 08:42

    you must always close the sqlite database after using it ... so add this line sqlite3_close(DB); just after sqlite3_finalize(statement);

    Update -

    You are returning YES in one of your while loop -

            while (sqlite3_step(statement) == SQLITE_ROW)
            {
                return YES;
                break;
            }
    

    so here you are nither finalizing nor closing the database.. you need to close if everytime you open it

提交回复
热议问题