On Oct 08, 2006 3:36 PM, Narinder Chandi wrote: > > 5. Don't use transactions as an undo-mechanism as you would in 4D. > > Instead store all the relevant data in memory and let the > > user edit it. Once the user clicks the save button, you start > > a transaction update the relevant records and commit (or rollback) > > the transaction. > > This way you keep your transactions short and lock records only > > for a short while. > > I have to disagree with you here - perhaps I will regret > it! Consider this - I access a Customer record to which is related > everything else such as Addresses, Contacts, Orders, Invoices, etc. > Then 2 issues arise : > * firstly, without the transaction you have to do more work > to track which records are being added, modifed, deleted > * secondly, I want to ensure that only a single user thinks > they have WRITE access to the Customer record - this also > automatically prevents another user from simultaneously making > changes to both the Customer record and records in related table > since they will get the record as READ ONLY access > - to my mind the best way is via a transaction to secure > the lock on the Customer record
The locks in REALSQLDatabase (SQLite) is at the DB file level - there's no table or record levels. Also, just using "BEGIN TRANSACTION" on SQLite does no locks, nothing! A lock is only made when doing the first read or write operation. If you need to prevent any read/write access to the DB you must use explicit transactions like "BEGIN IMMEDIATE TRANSACTION" or "BEGIN EXCLUSIVE TRANSACTION". But you must be carefull when using a "BEGIN EXCLUSIVE" as the entire DB is locked until you commit. More info at: http://www.sqlite.org/lang_transaction.html http://www.sqlite.org/lockingv3.html > Of course, I'm open to alternate suggestions and strategies > for record loading/locking for multi-user systems built with RB. I presume you already know that REALSQLDatabase is for one-user access only. If you need multi-user access you must use "REAL SQL Server". Don't know if "REAL SQL Server" provides other lock level mechanisms. Carlos _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
