Subject RE: [IBO] GeneratorLinks in 5,000,000 words or less
Author Helen Borrie
At 10:20 AM 08-02-01 +0100, you wrote:
> >Svein,
> >read the original code again!! This trigger is going to fire on **every**
> >insert and blat whatever value comes through.
> ><g>
>Reread as
>if NotSuppliedPK
> PK := GeneratorValue
> if StupidlyAssignedPKValue > CurrentGeneratorValue then
> Increment Generator to ValueEqualToOrGreaterThanStupidlyAssignedPKValue
>Apart from the horrifying thought that someone has assigned the PK without
>using the generator, I still don't see any danger (excepting overflow if
>StupidlyAssignedPKValue is huge). I know that Temp_ID may not be current at
>the time of incrementing the generator, but that should only mean that the
>generator was increased by more than intended - never less. Am I still
>asleep (I'm normally awake at 10AM in Norway) or is it my understanding of
>'blat' that is missing? ;o}

No, correct observation - I was wrong in supposing that key violations
would be inevitable.

So it's not dangerous, really, just an unnecessary squandering of gen.
values, which could be a problem with < v.6 IB but not likely with v.6 +.

Still...why do it? I guess, a workaround if you have people potentially
accessing your database with StupidlyAssignedPKValues... <g> better to let
them blat your generators than blat your data.

Apologies to Michael for the kneejerk misinterpretation of your
unconventional code.


All for Open and Open for All
InterBase Developer Initiative ยท