Subject Re: Generator and Triggers with IB6 from Delphi and IBX
--- In ib-support@y..., "Robert F. Tulloch" <tultalk@a...> wrote:
> Hi:
> I didn't like that either. If you like I will send you what I did.
If I remember it
> is an sp which finds the next sequential number, add a record with
that number then
> returns the number to the call. If you rollback, it cancels the
child records and
> deletes the one added by the sp. It also handles collisions by
waiting random length
> of time and trying again. Times out after I think 5 tries.
> Works fine. Folks told me to keep the gen_id for uniqueness and
add another field
> with the id. But since I needed the Id unique also, it was a silly

Hi, Robert.
I have a doubt it is solution. If two transactions got the same
max(Id) and tries to insert record, one of them will cause violation
of uniquiety. In snapshot transaction repeat a try is useless. In
read_commited it is load on server (max is expensive enough). Anyway,
if transaction got value N will be rolled back and other that got N+1
commited, you have a hole in Id sequence.

Best regards.