On 10 Feb 2012, at 11:47am, Sreekumar TP wrote: > I have a 'database is locked' issued which can be reproduced as follows. > > I have two applications opening the database in WAL mode. The threading > mode is SERIALIZED. Environment is PC/Linux. > > > > Step1: Launch App1 followed by App 2 ( same executables) > Step 2: App1 Prepares a SELECT statement and executes the statement. > Step 3: The statement is not reset and finalized. > Step 4: App1 wait on keyboard input > Step 5 : App2 prepares a statement to update a few records. The statement > is executed, reset and finalized > Step 6: Go back to App1, prepare an UPDATE/INSERT statement and execute it.
Sreekumar, imagine what would happen if two users both got to step 4 at the same point at the same time. There are no circumstances under which either of them could proceed. Whichever of them tried to proceed would invalidate the SELECT that the other one was still in the middle of. When writing your software, imagine that the database is locked from the 'execute' until you have done the 'finalize'. You want to do the finalize as soon as possible, to unlock the database for other users. You can't wait for a user to type something: their phone might ring or something. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users