farajnew
farajnew

Reputation: 11

Multithreading with SQLite and Objective-C

I have a couple of threads and I'm using SQLite for storage. When I'm trying to access the database I'm getting SQLITE_BUSY error.

Is there a way how to fix this problem other than trying at each request ?

Upvotes: 1

Views: 495

Answers (2)

user859375
user859375

Reputation: 3699

Ignore my last answer.

You can use the sqlite3_errmsg function to get the error message as string and print it using NSLog or other ways as soon as error occurs to find the more appropriate and proper reason. http://www.sqlite.org/c3ref/errcode.html

You probably seem to be running in to serialization issue; I am not sure where.

Upvotes: 0

Perception
Perception

Reputation: 80598

You are most likely running in serialized mode. But ... you're probably looking to run in multi-threaded mode instead. Note that you will need a separate database connection in each thread if you go that route.

Here is the link to the documentation goodness: http://www.sqlite.org/threadsafe.html

Upvotes: 2

Related Questions