On 30 Nov 2010, at 8:11pm, cricketfan wrote:

> Drake, I am using SQLITE in threadsafe mode. Transaction inside another
> transaction isnt that equivalent of nested transactions? Should that be
> allowed? I have no problem opening another handle but just trying to
> understand the intricacies, thanks.

The database handle is not just a pointer to the file on disk, it's used to 
store some details and state of the current operation.  The way you're using a 
single handle tries to cram the state of two different operations in it at 
once.  It's not going to work.  If you have two different threads that might 
access the database at the same time, you need two different handles.

You could get rid of the problem by implementing some sort of semaphore system 
between your threads to prevent them using the database at the same time.  But 
that would defeat the point of using two threads in the first place.  So it's 
probably best to let SQLite handle the semaphoring for you, by using two 
different handles.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to