Alex Katebi <[EMAIL PROTECTED]> wrote:
> Do I need to enable shared cache mode plus read uncommitted option?

You only have one connection (one call to sqlite3_open), right? Then it 
doesn't matter. "Shared" only makes a difference if there are at least 
two connections to share between.

> Also you mentioned earlier:
> "(but you will experience "dirty reads" with all the attendant
> problems)."
>
> What is a dirty read?  What problems does it cause?

Dirty read is another term for read uncommitted. Your select statement 
may see changes made to the database while the statement is still 
active. This is especially "interesting" if you have a query that may 
scan the same table several times. For example:

select * from table1
where exists (select * from table2 where table2.value = table1.value);

Suppose you have two records in table1 both having value=1 - let's call 
them A and B. Looking at the statement, one would think that, regardless 
of what's in table2, it should always return both A and B, or neither.

So, you step through the statement above. For each record in table1, it 
scans table2 in search of a matching record. At some point, a call to 
sqlite3_step returns record A. Then you run another statement that 
deletes one and only record from table2 that had value=1. A subsequent 
sqlite3_step call won't find record B anymore. So you get A but not B, 
which may be surprising.

Igor Tandetnik 



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

Reply via email to