Subject Re: [IBO] Generators, Triggers, & TIBOQuery
Author Svein Erling Tysvær
One way to get Generators incremented twice, is to carelessly use both a
trigger and GeneratorLinks. In your trigger, you must make sure you only
call the generator if the field is null (GeneratorLinks will automatically
supply a value). IBO will have problems if you rely on triggers for primary
keys rather than GeneratorLinks, since the trigger is applied at the server
and IBO then loses track of the record (the trigger has assigned a new
primary key on the server without telling the client (IBO) its value).

Set

At 20:34 25.01.2001 -0600, you wrote:
>I'm using TIBOQuery. I have a master-detail setup as follows:
>
> Master1 Link Table Master2
>
> KeyID1 KeyID1 KeyID2
> field1 KeyID2 fieldX
> field2 fieldY
> field3
>
>This is a many-to-many relationship. I have a grid for Master1 on a form
>and another grid to show what records from master2 are linked to it. I
>insert a record in Master2 which has a generator and a trigger so IB will
>automatically create a unique Key. After this new record is created KeyID2
>is returned and passed to the Link Table to link Master1 to Master2 for this
>new record. I'm getting an error on the applyupdates of the Link Table for
>it's KeyID2. When I manually go look at the record that was inserted in
>Master2 the KeyID2 is one higher than what was returned earlier. How is it
>getting incremented twice? Any ideas?
>
>
>Don Gollahon
>(dlgllhn@...)
>"What in Eternity does it matter?"
>
>
>
>
>