Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 9 of 9 total |
Record Locking |
Wed, Dec 20 2006 11:49 AM | Permanent Link |
"Brian Kennedy" | Hi. Using DBISAM Version 4.24 Build #1. Due to the nature of my
application and how some of the automation features operate, I need to use Optimistic record locking. However, there are some areas of my app where it would be nice to manually control the ability to edit records if they are in use by another user. Is there a way to manually check and see if a particular record is in use or manually lock a record so it cannot be edited by another user even when utilizing Optimistic locking? Thanks in advance. Brian Kennedy |
Wed, Dec 20 2006 12:42 PM | Permanent Link |
"Jose Eduardo Helminsky" | Brian
I don´t know if is a good design but I use a special field I fill *BEFORE* edit and clear just after POST. If this field contain some information then it is used by another user. It works ok but in situations like power down you need to create a special function to unlock all records, IOW clear the values of this field in ALL records. Eduardo |
Wed, Dec 20 2006 9:06 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Brian,
<< However, there are some areas of my app where it would be nice to manually control the ability to edit records if they are in use by another user. Is there a way to manually check and see if a particular record is in use or manually lock a record so it cannot be edited by another user even when utilizing Optimistic locking? >> Unfortunately, no. You must switch to pessimistic locking in order to allow an Edit to obtain a record lock. However, don't switch the record lock protocol while the application has edits in progress or you could run into problems. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Dec 21 2006 10:26 AM | Permanent Link |
Presumably if the extra field was a "lock time field" then you could
simply automatically expire a lock if it had been locked for too long? /Matthew Jones/ | |
Thu, Dec 21 2006 11:00 AM | Permanent Link |
"Robert" | "Brian Kennedy" <briank@mtcpro.com> wrote in message news:8B059145-12F0-4DAF-8F3D-C5E89D940B46@news.elevatesoft.com... > Hi. Using DBISAM Version 4.24 Build #1. Due to the nature of my > application and how some of the automation features operate, I need to use > Optimistic record locking. > > However, there are some areas of my app where it would be nice to manually > control the ability to edit records if they are in use by another user. If the record id or some other unique numeric field (even if it is calculated) on each record to be locked is less than 1000, you can use semaphores. Place a semaphore when you start editing, and test the semaphore before you edit. In fact, you do not need to edit the record, since this will be all your logic and not dependent on the DBISAM engine at all. I have a couple of apps where my logic requires that if an operator is reviewing or updating a certain customer, that customer (ALL its data) should be blocked from all other operators. Since my customer numbers are all under 1000, semaphores are an easy solution and they go away when the application ends. Robert |
Thu, Dec 21 2006 1:23 PM | Permanent Link |
"Jose Eduardo Helminsky" | Matthew
Yep. It would be a solution too. Eduardo |
Thu, Dec 21 2006 2:02 PM | Permanent Link |
"Brian Kennedy" | Thanks for all of your input. It is very helpful. I think Jose's option
would work best for this scenario as the table contains well over 1,000 records. Once more question for Tim before I proceed: -User 1 opens a record for modification. - While User 1 is editing the record, User 2 opens the SAME RECORD, makes a change, and saves. - User 1 clicks SAVE and a DBISAM exception occurs because the record has been altered by User 2. Question: Is there a way to force a save on User #1's record anyway? Thank you. Brian "Brian Kennedy" <briank@mtcpro.com> wrote in message news:8B059145-12F0-4DAF-8F3D-C5E89D940B46@news.elevatesoft.com... > Hi. Using DBISAM Version 4.24 Build #1. Due to the nature of my > application and how some of the automation features operate, I need to use > Optimistic record locking. > > However, there are some areas of my app where it would be nice to manually > control the ability to edit records if they are in use by another user. > Is there a way to manually check and see if a particular record is in use > or manually lock a record so it cannot be edited by another user even when > utilizing Optimistic locking? > > Thanks in advance. > > Brian Kennedy > |
Thu, Dec 21 2006 2:27 PM | Permanent Link |
"Jose Eduardo Helminsky" | Brian
> -User 1 opens a record for modification. > - While User 1 is editing the record, User 2 opens the SAME RECORD, makes > a change, and saves. > - User 1 clicks SAVE and a DBISAM exception occurs because the record has > been altered by User 2. > > Question: Is there a way to force a save on User #1's record anyway? The only way to do this is trapping the error, save the current record values, apply a Refresh, update the fields with fields saved and post again. Eduardo |
Thu, Dec 21 2006 3:14 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Brian,
<< Question: Is there a way to force a save on User #1's record anyway? >> Eduardo is correct. EDB allows this via the TEDBSession.RecordChangeDetection property which controls whether row changes raise an exception or not. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |