Thank you very much for the answer and I apologize for my misconception. My
confusion came from the fact the database handle was used by two different
threads and one of them was executing operations inside a transaction.
Is that possible to obtain more than one handle to the same in memory
instance of the database?

Thank you,

Iulian.

-----Original Message-----
From: D. Richard Hipp [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 19, 2005 1:44 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Multiple Threads and Transactions

On Mon, 2005-09-19 at 13:27 -0400, Iulian Popescu wrote:
> Hello,
> 
>  
> 
> I'm kind of new to the SQLite. I'm running an instance of the database in
> memory. I'm trying to figure out if the transaction isolation is also
valid
> between threads. To give a concrete example, two threads as part of the
same
> process share the same database connection. Suppose a transaction is
started
> in one thread and inserts some rows in a table A. If the same thread does
a
> SELECT * FROM A it should see the inserted records if my understanding is
> correct. What will happen if another thread does a SELECT from the same
> table A before the first thread commits the transaction? Will it see the
> records inserted by the first thread? Based on the tests I have made it
> seems to - weather I expected not. Is that correct or am I doing something
> wrong?
> 
> I've noticed if I do the same thing with a database on disk and between
> processes, the second process won't see the changes until the first one
will
> commit the transaction.
> 

Isolation only occurs between separate database handles.  If
you do two statements against the same database handle, they
will not be isolated.  I do not understand why you would expect
that they would be.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>


Reply via email to