Subject | Problems with TIB_Transaction |
---|---|
Author | ronald_greven |
Post date | 2003-11-05T10:35:47Z |
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
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