I've been reading a lot lately and I am now very confused how transactions and locking are working and how are related to each other.
When working with SQLite, imagine the following flow:
- begin SQLite transaction
- run a select statement on a SQLite connection to return values
- if condition is met on the returned values, go to step #4, otherwise go to step #5
- do the update
- commit SQLite transaction
If two threads run same code, is there a possibility that in one of the threads could get what is called a "dirty read" meaning, between the step #3 and step #4, the other thread could run the update (step #4)?