Subject | Sequence of changes under transaction |
---|---|
Author | rlssv |
Post date | 2003-06-13T12:55:35Z |
Can I trust the sequence of edits and changes done by triggers under
transaction control ?
My situtation is this
I am Using Delphi 5 and the Tdataset compatible IBO components.
I have a table Members with a balance-field among other things.
I have a table Postings with payments etc... This table has a trigger
that
updates the Balance-field of the member (OnAfterInsert)
When receiving a payment I open the member table to find the
name/adress and
balance of the member.
I *may* put the Member table in edit-state (the operator may edit some
fields).
When the operator finishes entering payment info I start the
transaction,
then post the member table and then insert the payment-record, so
that the
trigger updating of the Balance comes last.
Finally commiting the changes.
(I did first have an error in updating balance due to the fact that I
was
posting the member with its original contents AFTER the trigger had
updated
the balance-field)
My problem is now that *sometimes* the balance is not right as if it
has not
been updated by the trigger or as if the update is overwritten with
the
original balance.
So my question is: Is it possible that this sequence can be reverted
in some
cases ?
- René, SSV
transaction control ?
My situtation is this
I am Using Delphi 5 and the Tdataset compatible IBO components.
I have a table Members with a balance-field among other things.
I have a table Postings with payments etc... This table has a trigger
that
updates the Balance-field of the member (OnAfterInsert)
When receiving a payment I open the member table to find the
name/adress and
balance of the member.
I *may* put the Member table in edit-state (the operator may edit some
fields).
When the operator finishes entering payment info I start the
transaction,
then post the member table and then insert the payment-record, so
that the
trigger updating of the Balance comes last.
Finally commiting the changes.
(I did first have an error in updating balance due to the fact that I
was
posting the member with its original contents AFTER the trigger had
updated
the balance-field)
My problem is now that *sometimes* the balance is not right as if it
has not
been updated by the trigger or as if the update is overwritten with
the
original balance.
So my question is: Is it possible that this sequence can be reverted
in some
cases ?
- René, SSV