Re: [sqlite] Is there a command to lock a database for a short while (0.25 sec, say)
On Wed, 17 Apr 2013 15:39:50 +0200 "J Trahair"wrote: > I'm looking for a way to ensure other users aren't allowed to write > to the database during this quarter-second period. That might work for you this time, but it doesn't scale well; historically that's why the DBMS took over locking. You might instead want to consider a more relational approach. For example, you could have a "current version" table somewhere with one row. Various tables would have "version" columns. The application could select from views that join to the current-version table. Your update could add rows with a new version, update the current-version row, and at its leisure delete rows for the prior version. Because the update is atomic, the transition is instantaneous; no one is ever blocked but for an instant. Of course I don't know specifically what you're trying to do. I'm just saying that lock-the-world isn't a general solution, and the DBMS supports many general alternatives. --jkl ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Is there a command to lock a database for a short while (0.25 sec, say)
Don't forget that your "other" applications will need to extend their connection time outs, otherwise, while "this" application has the lock, the "other" applications will time out and throw errors. On Wed, Apr 17, 2013 at 9:43 AM, Simon Davieswrote: > On 17 April 2013 14:39, J Trahair wrote: > > Hi everyone > > > > Can my application lock the database for its own exclusive use at the > beginning of a series of INSERTs UPDATEs and SELECTs, then unlock it again > afterwards? I've read about the five locking states (unlocked, shared, > etc.) but I assume the dll handles all that at INSERT or UPDATE time. I'm > looking for a way to ensure other users aren't allowed to write to the > database during this quarter-second period. > > http://www.sqlite.org/lang_transaction.html > BEGIN EXCLUSIVE > > > > > Thanks in advance. > > > > Jonathan Trahair > > Regards, > Simon > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Is there a command to lock a database for a short while (0.25 sec, say)
On 17 April 2013 14:39, J Trahairwrote: > Hi everyone > > Can my application lock the database for its own exclusive use at the > beginning of a series of INSERTs UPDATEs and SELECTs, then unlock it again > afterwards? I've read about the five locking states (unlocked, shared, etc.) > but I assume the dll handles all that at INSERT or UPDATE time. I'm looking > for a way to ensure other users aren't allowed to write to the database > during this quarter-second period. http://www.sqlite.org/lang_transaction.html BEGIN EXCLUSIVE > > Thanks in advance. > > Jonathan Trahair Regards, Simon ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Is there a command to lock a database for a short while (0.25 sec, say)
Hi everyone Can my application lock the database for its own exclusive use at the beginning of a series of INSERTs UPDATEs and SELECTs, then unlock it again afterwards? I've read about the five locking states (unlocked, shared, etc.) but I assume the dll handles all that at INSERT or UPDATE time. I'm looking for a way to ensure other users aren't allowed to write to the database during this quarter-second period. Thanks in advance. Jonathan Trahair ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users