Subject RE: [firebird-support] Re: Help with a trigger/procedure
Author Alan McDonald
> Just do the sum, delete, insert single row in a single transaction.
> MGA will take care of the rest for you. If you follow the procedure,
> it is impossible to get inaccurate data.
>
> Transactions starting prior to your sum procedure transaction
> committing will see the old values of the table (and so get the right
> result). Transactions starting after your sum procedure commits will
> not see the deleted records but will see the single record (+ anything
> since the sum transaction started).
>
> Adam

But a transaction started by another user before the sum transaction is
started and seemingly intent on updating a record to be summed but not
committed until after the summing and deleting is committed will ... ahhh
hopefully you're getting my drift... will either cause an exception on
update or block the delete or just not update since the record doesn't exist
anymore.
'UPDATE TABLE SET FIELD=0 WHERE id=1' - If record with ID 1 no longer
exists, this update will silently go away with no exception.
I'm not sure I like this recipe.
If no updates are being contemplated on these records (ie. they're
absolutely static in the design) then maybe,... but if they are being
updated??

Alan