Subject | Re: Master-Detail constraint checking |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-04-28T17:56:37Z |
--- In ib-support@yahoogroups.com, "sugi" <truesaint@c...> wrote:
here. Let's say we have relationship invoice - positions,
read_commited transactions and triggers on Invoice_Positions like
Insert
Update Invoices Set Sum_Positions=Sum_Positions+New.Cost
Where ID=New.Invoice_ID
Update
Update Invoices Set Sum_Positions=Sum_Positions+New.Cost-Old.Cost
Where ID=New.Invoice_ID
Delete
Update Invoices Set Sum_Positions=Sum_Positions-Old.Cost
Where ID=New.Invoice_ID
if transaction mode is wait, we'll not get conflicts at all. Some
delay, maybe. In some cases cashed updates can be used to minimize
this delay by shortening frequency of data change attempts on server
side, in some - make each position changing in own short transaction.
Or did I misunderstood subject of the discussion?
Best regards, Alexander.
> Dear all,the
>
> Let's assume a classic accounting database where you have a
> master-detail relationship between JOURNAL and JOURNALDETAIL. One of
> rules says that for every JOURNAL, the sum of (JournalDetail.debit)must
> be equal to the sum of (JournalDetail.credit). But normally thisrule is
> only satisfied by the end of the posting sequence. Here's a sampleDear all :) I can't understand why do you need trigger on commit
> posting sequence (in pseudocode):
here. Let's say we have relationship invoice - positions,
read_commited transactions and triggers on Invoice_Positions like
Insert
Update Invoices Set Sum_Positions=Sum_Positions+New.Cost
Where ID=New.Invoice_ID
Update
Update Invoices Set Sum_Positions=Sum_Positions+New.Cost-Old.Cost
Where ID=New.Invoice_ID
Delete
Update Invoices Set Sum_Positions=Sum_Positions-Old.Cost
Where ID=New.Invoice_ID
if transaction mode is wait, we'll not get conflicts at all. Some
delay, maybe. In some cases cashed updates can be used to minimize
this delay by shortening frequency of data change attempts on server
side, in some - make each position changing in own short transaction.
Or did I misunderstood subject of the discussion?
Best regards, Alexander.