I have read a few tutorials and did some search but I must be missing something.
I’ve had a bunch of different problems with sqlite on my iphone app the last few days.
The most common problem was crashing when I was doing inserts at the same time on different tables, not on the same table.
I can achieve several inserts using threads by the way, so I am sure there is concurrency.
So does the db lock the whole DB or just the table I am inserting information into?
I’m also looking into another possible problems who might be causing the crashes but this little piece of information would help a lot.
After further tests I can say with certainty that you can perform multiple inserts at the same time in the database as long as it is on different tables. Multiple inserts at the same time on the same table will throw an error.
The crashes I was having earlier seem to be related to the fact that I was init + alloc the db on each view I wanted to use it and then releasing it on each view.
After init+alloc only on the app delegate it solved the crashes.
Although you can have multiple instances of the same DB throughout your App it seems to be preferable to just having one in the App Delegate and accessing it as you need it.
This might not be entirely correct but was my conclusion after several hours searching and testing.
I hope this helps other people.