1

I have a QML application which user intract with. There is a timer that listen to server for work order then insert all info to SQLite db in application.Also user make change on data (update,delete etc...) in SQLite. My question is , How to prevent multi operation on SQLite table. Only one operation must take effect on SQLite(select,delete,insert,update....) I don't know but , Can Mutex.lock structure use for this. Or Is there a something wrong with multiple operation on SQLite

Kevin yudo
  • 233
  • 4
  • 15

1 Answers1

0

First thing you should do is read up on SQLite locking, they have a section in the docs about it: https://www.sqlite.org/lockingv3.html

The summarisation is that SQLite does locking on modifications such as an insert or update, but won't create a lock when reading. However if a lock exists whilst a modification is in progress the read won't be able to access the database.

I wouldn't worry too much about locking on reading, the state should be fine to be shared at that stage.

Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55