Board index » delphi » Record lock
Michael Qua
Delphi Developer |
Michael Qua
Delphi Developer |
Record lock2005-05-19 05:37:43 PM delphi223 stored procedures / triggers IB 6.0.2 is there a way to lock a record for editing? and / or is there a way to find out if another user has modified a record after it is selected (queried?) and before the changes are posted? Thanks, Michael Qua |
Bill Todd
Delphi Developer |
2005-05-19 10:43:43 PM
Re:Record lock
InterBase uses optimistic locking. If you want to lock a record update
the record and set any field to its current value. The record will remain locked for the life of the transactions. The only way to find out of someone else has changed a record and commited the change is to requery the record. -- Bill Todd (TeamB) |
Wayne Niddery [TeamB]
Delphi Developer |
2005-05-19 11:02:16 PM
Re:Record lock
Michael Qua writes:
Quotestored procedures / triggers IB 6.0.2 transaction persists). If you want to lock "for" editing, then you need to store a field yourself that would be updated with a value, like user id, when a user wants to edit it. When other users access this record, the app can check this field. Once a user has finished editing a record (and committing the transaction) then other users can freely post changes. The only way to know if another user has changed anything at that point is to first query the record again and compare fields. Rather than comparing all fields, an alterntaive is to have a Version field in your tables that is updated (via trigger) every time a record is updated. The you only need to check this one field. -- Wayne Niddery - Logic Fundamentals, Inc. (www.logicfundamentals.com) RADBooks: www.logicfundamentals.com/RADBooks.html "Democracy, without the guarantee of liberty, is merely a method of selecting tyrants." - Alan Nitikman |
Dmitry Kuzmenko
Delphi Developer |
2005-05-20 12:52:53 AM
Re:Record lock
Hello, Michael!
Michael Qua writes: Quotestored procedures / triggers IB 6.0.2 about record locking. -- Dmitri Kouzmenko, www.ibanalyst.com |
Quinn Wildman
Delphi Developer |
2005-05-20 01:22:46 AM
Re:Record lock
Please see
support.borland.com/entry!default.jspa?categoryID=157&externalID=1431&fromSearchPage=true It's an article written long ago, but still true. Michael Qua writes: Quotestored procedures / triggers IB 6.0.2 |