On 3/13/2012 10:38 PM, FengTao DING wrote:
Hi all,
I wrote a piece of code, that open two sqlite3 connections, use connection1
to do a SELECT query, while stepping in this query,
when some condition matches, it uses connection2 to do a INSERT query;
when another condition matches, it uses connection2 to do a UPDATE query.
As common result, SQLITE_BUSY or SQLITE_LOCKED(when using
SQLITE_OPEN_SHAREDCACHE) will return when do INSERT or UPDATE.
Just run your INSERT and UPDATE statements on connection1, don't bother
with the second connection. I assume you are not planning to modify the
same data you are iterating over.
Another possibility is opening your database in WAL mode:
http://sqlite.org/wal.html . In this mode, readers don't block writers.
The writer will be able to modify the same data the reader is reading
(but the reader won't see those changes).
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users