Best SQLite database upgrade strategy in the background when using a database

I have an application that allows users to query sqlite DB. When the application starts, it loads the URL to see if there are any database updates in the background thread.

Unfortunately, this leads to locks if the user selects a function that tries to query the database while the update is in progress.

My question is twofold.

  • What is the best conflict avoidance strategy in this scenario.

    • Copy the database to another file, update it and copy it back
    • You have some kind of singleton mode and use it to schedule operations in a queue.
    • and wait for the lock to open (although I do not want to resist the user)
  • Is it possible to pause the background thread before the application terminates and launches updates immediately before the application terminates.

If anyone has any advice, I would appreciate that I need to start the update without requiring the user to stop using the application.

+3
source share
2 answers

To answer your question, I believe that point number 1 is the best solution for your specific problem on the Iphone. Seeing that you cannot start another thread to process the background image, a little waiting (which most programs have at the beginning) is a standard action.

, , . ( ), , - .

IMO, (, ) - .

0

- , , , URL . URL-? , , URL- - - , URL-.

0

Source: https://habr.com/ru/post/1773111/


All Articles