I'm new to sqlite. I'm trying to use sqlite 3.2.8 in a multithreaded environment on MacOSX 10.4.4. I compiled it with threading enabled and I also get the database handle in each thread (I don't open it in the main thread and pass the handle around).
The problem I'm having is when I try and use transactions. I keep getting the error 'can not start a transaction within a transaction'. I don't do this but I keep getting the error. I believe I get this because I'm in a multithreaded environment. For example Thread 1. sqlite3_exec BEGIN TRANSACTION; UPDATE table SET x=1 WHERE y=1; COMMIT TRANSACTION; Thread 2. sqlite3_exec BEGIN TRANSACTION; UPDATE table SET x=1 WHERE y=1; COMMIT TRANSACTION; Thread 3. sqlite3_exec BEGIN TRANSACTION; UPDATE table SET x=1 WHERE y=1; COMMIT TRANSACTION; Thread 4. sqlite3_exec BEGIN TRANSACTION; UPDATE table SET x=1 WHERE y=1; COMMIT TRANSACTION; Does anyone have any thoughts on why this causes the 'can not start a transaction within a transaction' error? After this the database gets locked and does not seem to get freed. How do I recover from the 'can not start a transaction within a transaction' error? Deepak