Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 13 total
Thread AfterEdit / AfterPost events at a lower level
Sun, Aug 12 2018 8:47 PMPermanent Link

Adam H.

Hi,

I was wondering if there's any way to execute script after a record has been put into Edit mode, or after it has been posted (or cancelled) at the TDBISAMDatabase level or lower. (ie, Session, or even Engine level) as opposed to having to assign script to every AfterEdit event of every dataset?

The request I have is that some of my sites are having problems with users and locked records. They want to be able to see who has a record locked. (They're not interested in switching the locking method).

I'm aware that DBISAM doesn't do this natively, but i was thinking if I created a table called LOCKEDRECORDS where I populate the tablename, the record ID, a timestamp, and the user/computer when a user initiates editing a record, and then delete it after an AfterPost or AfterCancel event - then I could give them the information they want.

I was hoping there was a way to achieve this in one location as opposed to doing it at a per-dataset level?

Cheers

Adam.
Sun, Aug 12 2018 10:46 PMPermanent Link

Raul

Team Elevate Team Elevate

<<
Adam H. wrote:

I was wondering if there's any way to execute script after a record has been put into Edit mode, or after it has been posted (or cancelled) at the TDBISAMDatabase level or lower. (ie, Session, or even Engine level) as opposed to having to assign script to every AfterEdit event of every dataset?

>>

Sure - you can use engine triggers

https://www.elevatesoft.com/manual?action=viewtopic&id=dbisam4&product=rsdelphiwin32&version=10T&topic=Customizing_Engine

Only downside is that you have to compile this into the dbsrvr yourself

Raul
Mon, Aug 13 2018 3:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

Raul is correct, and the CurrentServerUser property that you want is passed in the TriggerSession parameter:

https://www.elevatesoft.com/manual?action=viewevent&id=dbisam4&product=rsdelphiwin32&version=10T&comp=TDBISAMEngine&event=BeforeUpdateTrigger

https://www.elevatesoft.com/manual?action=viewprop&id=dbisam4&product=rsdelphiwin32&version=10T&comp=TDBISAMSession&prop=CurrentServerUser

You're probably only going to be interested in the update and delete triggers.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Aug 13 2018 7:27 PMPermanent Link

Adam H.

Hi Raul and Tim,

Thanks for your replies...

It looks like I can do this locally by throwing a TDBISAMEngine component in the application which would save me recompiling the engine.

However the BeforeUpdateTrigger event doesn't give me what I need. This only occurs prior to updating the record (ie, before Posting any changes). It doesn't change on the 'OnEdit' event.

Since I'm wanting to record when a record is locked for editing - I need a solution that will trigger both at an OnAfterEdit event as well as an OnAfterPost/Cancel event.

Just wondering if I've missed something or whether there's not an event on the TDBISAMEngine that will execute immediately after an Edit, but prior to other changes been made?

Thanks

Adam.
Tue, Aug 21 2018 1:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

Sorry about the delay in responding.

<< However the BeforeUpdateTrigger event doesn't give me what I need. This only occurs prior to updating the
record (ie, before Posting any changes). It doesn't change on the 'OnEdit' event. >>

That's correct - when you factor in optimistic locking, this is the only place where an actual "edit" is occurring.  The edits in the TDataSet descendants (TDBISAMTable and TDBISAMQuery) are actually just "get a lock" calls with some buffer management at the TDataSet level.

<< Just wondering if I've missed something or whether there's not an event on the TDBISAMEngine that will execute immediately after an Edit, but prior to other changes been made? >>

Unfortunately, no.  However, I can certainly see about adding "Record Lock" and "Record Unlock" triggers.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Aug 22 2018 1:07 AMPermanent Link

Adam H.

Hi Tim,

<< Unfortunately, no.  However, I can certainly see about adding "Record Lock" and "Record Unlock" triggers. >>

Could you? That would be awesome and so handy! Thank you!

Cheers

Adam.
Mon, Aug 27 2018 12:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< Could you? That would be awesome and so handy! Thank you! >>

Sure, I've got to add query logging, so I'll be in there messing around, anyway.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Feb 5 2019 12:41 AMPermanent Link

Adam H.

Hi Tim,

I was just wondering if you have made any progress with this at all please? Smile

Thanks & regards

Adam.
Wed, Feb 6 2019 11:31 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< I was just wondering if you have made any progress with this at all please? Smile>>

I'm doing some DBISAM work later this week and over the weekend, so I will get it added then.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Feb 6 2019 8:55 PMPermanent Link

Adam H.

Sweet! Thanks Tim!
Page 1 of 2Next Page »
Jump to Page:  1 2
Image