Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 8 of 8 total |
Testing for a lock |
Mon, Nov 15 2010 9:41 PM | Permanent Link |
ClockOn | is there a way to know if there is a transaction or table lock, rather than having to try and causing an exception?
|
Tue, Nov 16 2010 5:35 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << is there a way to know if there is a transaction or table lock, rather
than having to try and causing an exception? >> No, and such a function really wouldn't be feasible because the only way to test for such a lock is to attempt the lock, which is effectively what you're doing with a try..except block anyways. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Nov 16 2010 4:41 PM | Permanent Link |
ClockOn | thanks tim thats what I thought, but wanted to just double check. You just never know...
|
Tue, Nov 16 2010 4:59 PM | Permanent Link |
Gregory Sebastian | Did you mean Database transaction ? If so there is one :
Database.InTransaction . Regards Gregory Sebastian "ClockOn" wrote in message news:486F7CD9-D54C-4CD0-81B3-E0BA49F7F74D@news.elevatesoft.com... > is there a way to know if there is a transaction or table lock, rather > than having to try and causing an exception? > |
Wed, Nov 17 2010 6:39 PM | Permanent Link |
ClockOn | Thanks Gregory, but as far as im aware that only works for the current session, if another session has a transaction then InTransaction does not work...
|
Wed, Nov 17 2010 11:54 PM | Permanent Link |
Gregory Sebastian | Hi Clockon,
<<Thanks Gregory, but as far as im aware that only works for the current session, if another session has a transaction then InTransaction does not work...>> Yes I think its just for the current session/database . If your transaction/updates cannot be affected by other sessions, I think you must attempt to Lock the table or open them exclusively. <<is there a way to know if there is a transaction or table lock, rather than having to try and causing an exception?>> You could setup your own function like : function TryToLockTable(TableToLock : TDbiSamTable) : Boolean; begin try TableToLock.LockTable; result := True; except result := False; end; end; It will report to you on success or failure without raising an exception but you still need to handle the failed lock attempt either way . Regards Gregory Sebastian |
Thu, Nov 18 2010 6:34 PM | Permanent Link |
ClockOn | Thanks gregory, I was wondering more so if the server tracked the status of the locks when in C/S mode really. Thanks for your help but, much appreciated...
|
Mon, Jan 3 2011 2:04 PM | Permanent Link |
Robert Kaplan | "Gregory Sebastian" <gregorys@nospam-ezysoft-dev.com> wrote in message news:E85DD2CB-34E0-40F7-A600-178E9CBA5F99@news.elevatesoft.com... > > function TryToLockTable(TableToLock : TDbiSamTable) : Boolean; > begin > try > TableToLock.LockTable; > result := True; You need to unlock the table here if you want to leave eveything the way you found it. Robert |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |