While the idea of uniquely identifying a user is interesting, the assumption that there is only one user for each IP address is questionable at best - Consider assigning a 'session id' of some kind instead. In *theory* (and yes, I've seen it happen in reality) the source address can change between two successive TCP connections with a multi-homed host. *** Doug F.
-----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Keith Roberts Sent: Saturday, October 17, 2009 7:53 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] suggestions for avoiding "database locked" on ajax On Fri, 16 Oct 2009, Roger Binns wrote: > To: General Discussion of SQLite Database <sqlite-users@sqlite.org> > From: Roger Binns <rog...@rogerbinns.com> > Subject: Re: [sqlite] suggestions for avoiding "database locked" on ajax > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > P Kishor wrote: >> So, what suggestion might you all have for getting around this? > > Why not set a busy timeout? > > Roger As each user's IP address is unique, you could use a LOCK column for the whole database, or a particular table. You could then store the IP address of the user initiating the transaction. When a transaction starts, you can use a trigger to test whether the LOCK column is NULL for empty. If so, set the LOCK column to value of the users IP address. If another user from a different IP address attempts a similar transaction, then block that transaction from continuing, until the LOCK on the other IP address has been removed. Once the transaction has finished, release the LOCK by clearing the user's IP address from the LOCK column by setting it back to NULL. I'm not sure how you would go about dealing with muliple transaction being stalled, and waiting to get the LOCK freed, so each one can continue. Maybe muliple retries, until the user's can get access to the db? Kind Regards, Keith Roberts ----------------------------------------------------------------- Websites: http://www.php-debuggers.net http://www.karsites.net http://www.raised-from-the-dead.org.uk All email addresses are challenge-response protected with TMDA [http://tmda.net] ----------------------------------------------------------------- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users