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