Subject Re: [IBO] Problems with TIB_Transaction
Author ronald_greven
Hi Jason,

many thanks for you answer. I use a generator now, and it works
perfectly. Great. Thanks again.

Best regards

Ronni

--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@i...>
wrote:
> You need to use a generator to obtain unique values to use as
primary key
> values.
> If you want to maintain a serial line of numbers with no holes,
there is a
> tech info sheet on my web-site that will help. This isn't easy to
accomplish
> with an optimistic locking database like Firebird/InterBase.
>
> Jason Wharton
>
> ----- Original Message -----
> From: "ronald_greven" <ronald_greven@y...>
> To: <IBObjects@yahoogroups.com>
> Sent: Wednesday, November 05, 2003 3:35 AM
> Subject: [IBO] Problems with TIB_Transaction
>
>
> > Hi,
> >
> > First of all, sorry about my bad english, I hope you understand,
> > which problem I have.
> >
> > I have a big problem.
> >
> > I use IB_Objects with a firebird database. Its an multiuser-
> > environment.
> > There is a table called tickets with only one row.
> >
> > number ticketnumber
> > 1 1000000
> >
> > in a one-user environment, no problem.
> > But :
> >
> > Input (User A) : A amount of 100
> > Input (User B) : A amount of 300
> >
> > now there is a loop, for user A : 1 to 100
> > - get ticketnumber
> > - inc ticketnumber with 1
> > - write new record in table ticketpos (ticketnumber 100001)
> > - write back new ticketnumber in table ticketpos
> >
> > in table ticketpos the unique index is for the ticketnumber
> >
> > the same loop for user B : 1 to 300
> >
> > there are 2 active transactions. Each increase the value
ticketnumber
> > with 1 and write it back.
> > now a error occurs : attempt to store duplicate value visible to
> > active transaction....
> >
> > how can i let one transaction wait (ex. user A) for the commit of
the
> > other active transaction (user B)?
> >
> > Wow, that was hard to explain. But I hope, you can help me...
> >
> > Best regards
> >
> > Ronni