Subject Re: [firebird-support] Re: Generators for auto-increment - with override
Author Ann W. Harrison
Pierre wrote:

>> GEN_VALUE = gen_id(GEN_TEST_ID,0);
>> if (new.TEST_ID > GEN_VALUE) then
>> GEN_VALUE = gen_id(GEN_TEST_ID,new.TEST_ID - GEN_VALUE);

Alan McDonald wrote:

> if you use this under heavy load you'll ruin your database

I don't think so. The way to screw up generators is to try to set them
backward. Since the amount added to the generator (new.TEST_ID -
GEN_VALUE) is always positive, having two users run it at once shouldn't
be a problem. If new.TEST_ID is less than GEN_VALUE, there's a chance
that it will duplicate an existing key value, but that is the
application's problem.


Regards,


Ann