Hi all, I'm doing a little stress test on a server application and run into a problem when two threads are trying to access the database. Here is the background: 1. shared cache is enabled prior open any DB connection. 2. Each thread then opens a DB connection. 3. Thread A just reads table entries continuosly by doing sqlite3_prepare_v2 and followed by some sqlite3_step to parse the result set. He then uses sqlite3_finalize and after a few ms he repeats everything. 4. Thread B is triggered to update or insert some a new values in some tables. To do so I obtain an EXCLUSIVE transaction, do the insert/update and COMIT.
Now, a problem arises occasionally that thread A gets an SQLITE_MISUSE when trying to call sqlite3_step, most likely because thread B currently writes into the DB, I guess. Now, my question: How to handle the SQLITE_MISUSE ? I'm prepared to deal with SQLITE_BUSY or SQLITE_LOCKED but I don't know what to do when a sqlite3_step returns the SQLITE_MISUSE error. Without the shared_cache enabled I don't get SQLITE_MISUSE but the usual busy or locked states and I can just wait until the locking dissapeared. Is it recommended to use additionally the "PRAGMA read_uncommitted = True;" ? Maybe I should use an exclusive transaction on the simple "SELECT * FROM table" calls but that will block any parallel reads, not very useful. Actually, I don't understand why I don't get a LOCK state in shared cache mode as well, although I think it is by design. thank you Marcus Grimm _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users