Subject | Re: [firebird-support] Re: Generators for auto-increment - with override |
---|---|
Author | Ann W. Harrison |
Post date | 2005-01-05T16:27:15Z |
Pierre wrote:
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
>> GEN_VALUE = gen_id(GEN_TEST_ID,0);Alan McDonald wrote:
>> if (new.TEST_ID > GEN_VALUE) then
>> GEN_VALUE = gen_id(GEN_TEST_ID,new.TEST_ID - GEN_VALUE);
> if you use this under heavy load you'll ruin your databaseI 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