Subject RE: [firebird-support] Re: Triggers suitability
Author Alan McDonald
> Just add an field say called 'version' BigInt to your DB Record and add a
> trigger for insert and update, which updates this field via a
> Generator. Now
> when you read the record, before you post, check if the value of
> 'version'
> is still the same, if not, someone else updated the record in the
> meantime.
>
> Create Generator Gen_Version
>
> In trigger before insert and update
> New.Version = Gen_ID(Gen_Version,1);
>
> If you use a different Generator for each Table of interest, the
> check for
> the 'version' value merely has
> to be a Gen_ID(Gen_Version,0) call
>

huh? if 10 other records have been versioned in the meantime, the generator
value will have advanced with no reference to the record in question. You
have to test your current record verion with the one in plave immediately
prior to posting.
Alan