Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread AfterDeleteTrigger - all fields null
Mon, Jun 23 2008 9:43 PMPermanent Link

Oliver Bock
I have added an AfterDeleteTrigger to my DBISAM v4 (latest) server, but
when I get called all the TDBISAMRecord fields are null.  They are fine
with BeforeDeleteTrigger.  The DELETE SQL is running locally on the
server inside a server procedure using the session provided by
OnServerProcedure.   Is there something silly I might be doing?  It is
not particularly important because I have switched to
BeforeDeleteTrigger, but I am curious in case it is a clue that I am
doing something stupid.


  Oliver
Mon, Jun 23 2008 10:29 PMPermanent Link

"Raul"
Are you looking at the Value or OldValue property - OldValue is the one to
use here.

Tim did discuss this long time ago: other thing to keep in mind is that
AfterDeleteTrigger fires after record is deleted (while BeforeDeleteTrigger
fires before and delete might actually fail so if you're logging here then
AfterDeleteTrigger is the one to use as record is for sure gone).

Raul


"Oliver Bock" <oliver@nospam.com> wrote in message
news:F4D08B17-3024-4926-A63B-44F0E8FE4C57@news.elevatesoft.com...
>I have added an AfterDeleteTrigger to my DBISAM v4 (latest) server, but
>when I get called all the TDBISAMRecord fields are null.  They are fine
>with BeforeDeleteTrigger.  The DELETE SQL is running locally on the server
>inside a server procedure using the session provided by OnServerProcedure.
>Is there something silly I might be doing?  It is not particularly
>important because I have switched to BeforeDeleteTrigger, but I am curious
>in case it is a clue that I am doing something stupid.
>
>
>   Oliver

Tue, Jun 24 2008 12:36 AMPermanent Link

"Robert"

"Oliver Bock" <oliver@nospam.com> wrote in message
news:F4D08B17-3024-4926-A63B-44F0E8FE4C57@news.elevatesoft.com...
>I have added an AfterDeleteTrigger to my DBISAM v4 (latest) server, but
>when I get called all the TDBISAMRecord fields are null.  They are fine
>with BeforeDeleteTrigger.  The DELETE SQL is running locally on the server
>inside a server procedure using the session provided by OnServerProcedure.
>Is there something silly I might be doing?  It is not particularly
>important because I have switched to BeforeDeleteTrigger, but I am curious
>in case it is a clue that I am doing something stupid.
>

Why would you expect to have a record after you delete it?

Robert
>
>   Oliver

Tue, Jun 24 2008 3:14 AMPermanent Link

Oliver Bock
Raul wrote:
> Are you looking at the Value or OldValue property - OldValue is the one to
> use here.
>
> Tim did discuss this long time ago: other thing to keep in mind is that
> AfterDeleteTrigger fires after record is deleted (while BeforeDeleteTrigger
> fires before and delete might actually fail so if you're logging here then
> AfterDeleteTrigger is the one to use as record is for sure gone).

Thanks, this makes sense.  I had not considered OldValue at all!  I was
looking in AsInteger, which I guess uses Value.


  Oliver
Tue, Jun 24 2008 3:16 AMPermanent Link

Oliver Bock
> Why would you expect to have a record after you delete it?

I do not expect it to exist in the table, but I expect to see its values
in the CurrentRecord parameter to the trigger function.  Surely that is
the purpose of AfterDeleteTrigger?  It is not much use to know that a
record has been deleted unless you know which one!


  Oliver
Image